Show Text script call not working

Discussion in 'RGSSx Script Support' started by dott, May 10, 2018.

Thread Status:
Not open for further replies.
  1. dott

    dott Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    English
    For various reasons, I have two sets of dialogue that must be processed within a script instead of the event manager. I've been using the script calls I found here, and while they mostly work, the 'Show Text' call doesn't. The dialogue box appears, but it doesn't wait for the player to finish reading and hit a button for the script to keep running. I can't find anything about what needs to be included for the script call to work the same way as the event manager text box, and nothing I've tried seems to work.

    If more detail is needed, an in-depth explanation of how my scripts interact with the problem is below.

    The code below combines both messages into one long message with the face graphic of the second message. Both bubble icons appear at the same time, and when the player moves on from the dialogue box the screen fades out and the script continues. The fifth line of text appears in a new box, since each box can only have four lines, and still has the second message's face graphic. The game waits for the player to finish with the dialogue boxes before fading out the screen.

    Code:
    # suprise icon over monster
    $game_map.events[ 1 ].balloon_id = 1
    # monster dialogue
    m1 = $game_message.face_name = 'Monster1'
    m1 = $game_message.face_index = 0
    m1 = $game_message.background = 0
    m1 = $game_message.position = 2
    m1 = $game_message.add("Hey, what are you doing out of your")
    m1 = $game_message.add("room? Get back there now or I'll make")
    m1 = $game_message.add("you!")
    # angry icon over player
    $game_player.balloon_id = 5
    # player dialogue
    m2 = $game_message.face_name = 'faces'
    m2 = $game_message.face_index = 1
    m2 = $game_message.background = 0
    m2 = $game_message.position = 2
    m2 = $game_message.add("Keep your filthy hands off me, you")
    m2 = $game_message.add("monster!")
    # fadeout screen
    Fiber.yield while $game_message.visible
    screen.start_fadeout(30)
    wait(30)

    The code below shows the first dialogue box, runs all events other than the second message while the first message is active, and fades out the screen as soon as the message is gone. I attempted to debug this one further by shortening the first message to one line and adding '\^' so that it would immediately close the dialogue box. In that case, it displayed the second dialogue box while the screen faded out, then waited for the second dialogue box to exit before continuing with the script.

    Code:
    # monster dialogue 1
    m1 = $game_message.face_name = 'Monster1'
    m1 = $game_message.face_index = 7
    m1 = $game_message.background = 0
    m1 = $game_message.position = 2
    m1 = $game_message.add("Well well well, the little Princess")
    m1 = $game_message.add("managed to escape her room.")
    m1 = $game_message.add("Guard!")
    # flip switch so teleporting guard is visible
    $game_switches[47] = true
    # move guard to just below player facing up
    $game_map.events[8].set_direction(8)
    $game_map.events[8].moveto( $game_player.x, $game_player.y + 1 )
    RPG::SE.new("Teleport", 80, 100).play
    wait(20)
    # monster dialogue 2
    m2 = $game_message.face_name = 'Monster1'
    m2 = $game_message.face_index = 7
    m2 = $game_message.background = 0
    m2 = $game_message.position = 2
    m2 = $game_message.add("Take the Princess back to her chamber.")
    m2 = $game_message.add("Make sure she stays there this time.")
    # angry icon over player
    $game_player.balloon_id = 5
    # fadeout screen
    Fiber.yield while $game_message.visible
    screen.start_fadeout(30)
    wait(30)

    I debugged both scripts with console messages at each line of code, confirming that the game isn't just skipping them. The messages weren't originally labeled "m1" and "m2", but adding the names did nothing, and I left them in for clarity. Putting an Input.trigger? command between the boxes almost works, but it doesn't start waiting for input until after the dialogue box is gone, making the player hit the confirm button twice. Putting a wait command after the message means the game won't run the rest of the code until the wait is over, so the player has time to read, but once the wait is over the problem persists, so the solution only works if the wait is the same as the amount of time it takes the player to read, which is impossible to predict.
     
    #1
  2. Sixth

    Sixth Veteran Veteran

    Messages:
    2,121
    Likes Received:
    788
    First Language:
    Hungarian
    Primarily Uses:
    RMVXA
    Whenever you want it to wait until the player confirms the message, you have to use this line:
    Code:
    wait_for_message
    So use it after the last $game_message.add("...") lines to make the game wait for player input before doing anything else that comes below in the script call.

    Those m1/m2= parts just make the lines longer, but they won't do anything (well, aside from setting that local variable over and over again), so get rid of those.
    If you want to label things in code, use comments instead like you did with those comment lines separating each section of the code.
     
    #2
  3. dott

    dott Villager Member

    Messages:
    7
    Likes Received:
    1
    First Language:
    English
    Thank you very much, this worked perfectly!
     
    #3
  4. SlingB

    SlingB Villager Member

    Messages:
    9
    Likes Received:
    1
    First Language:
    English
    Primarily Uses:
    RMMV
    Hi, I have the same problem but in RPG MV.

    $gameMessage.add("Blah blah blah.");
    wait_for_message;

    How do I use this in RPG maker MV scripting?
    _ I think a better idea is I will ask this as a new question in the MV forum.
     
    Last edited: May 30, 2018
    #4
  5. slimmmeiske2

    slimmmeiske2 Little Red Riding Hood Moderator

    Messages:
    5,172
    Likes Received:
    3,924
    Location:
    Belgium
    First Language:
    Dutch
    Primarily Uses:
    RMXP
    Please do as Mv uses an entirely different language than Ace.

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #5
Thread Status:
Not open for further replies.

Share This Page