Help! Delay the description of a room? (I'm still stuck :( )

Say you have three lines of text you want to display when the player enters a room:

Line 1
Line 2
Line 3

Is there a way to display Line 1, wait for two seconds, display Line 2, wait for two seconds, and then display Line 3?

I find that added delay when the information you're displaying is critical, helps the player to better focus on the text.

Also, is there a way to display the text, then make it vanish?

Scripting is ok! I'm just trying to see if I can make this happen inside the editor.


I can see two ways to approach that; but both use some JS.

  1. Display the text in a hidden output section, and have an timeout function that shows the first hidden part with the right class and then looks for the next. You could even make a text processor function to output it.

  2. Use the usual wait ("press a key to continue") function; but set a script first to make it time out. For example:

JS.eval("window.setTimeout(endWait, 2000);")

to automatically hit the 'continue' button after 2 seconds.


Is this for the first time the player enters a certain room? (I guess you wouldn't want that for every room, or every time they enter the room.)
In the UI, there is a room script tab, and you can select the "on first enter", and put what you want to happen there.
And, I think, you can add the delays there between each printed line.
When that's done, the room's description will be printed.

As for making a line of test disappear, I don't think so. But you can clear the screen, then show the room's description again without the line you want to disappear. Modern computers are fast enough that there shouldn't be much of a problem.


There is in fact a function in Quest called SetTimeout that does what I wanted but thanks to both of you! You set me on the right track. I've been making great strides, and I'm pretty happy about that!

That didn't work in fact because SetTimeout isn't blocking! I need a method that blocks and I found one: JS.wait. Unfortunately, it doesn't seem to be doing anything in Quest.

Any thoughts?


You can Play a two second Sound, true for wait, false for loop.

play sound (" .mp3", true, false)

And I don't know about disappearing text unless the entire screen clears.


I just did something like this for my intro for my game for the main menu title screen. Feel free to go a different route or change it to fit your needs.

For my room I went to Scripts -> Before entering the room

SetObjectFlagOff (game, "autodescription")
JS.uiHide ("#txtCommandDiv")
JS.uiHide ("#gamePanes")
JS.uiHide ("#location")
JS.uiHide ("#divOutputAlign3")
JS.uiHide ("#divOutputAlign5")
JS.uiHide ("#divOutputAlign7")

#divOutputAlign3 is the Title
#divOutputAlign5 is the Subtitle
#divOutputAlign7 is the author.

Since so far it's just been CSS names to hide it, you can use the HTML tool to find other elements you wish to disappear. So, this is only half your question so far, to make it reappear when you want it, or in my case, a fade(ish), in like effect for a title screen I went to the After entering a room section.

SetTimeout (2) {
  JS.uiShow ("#divOutputAlign3")
  SetTimeout (2) {
    JS.uiShow ("#divOutputAlign5")
    SetTimeout (2) {
      JS.uiShow ("#divOutputAlign7")
    }
  }
}

This then shows the Title, subtitle and the author one at a time with 2 seconds of space in between. You can continue this on and so forth to make other elements such as the game panes, text command box, and others appear when you want it.

If you want only messages to be delayed and not whole elements or panels, then just use the SetTimeout (timeinsecondstowait) {the elements or stuff being delayed i.e your msg commands}

In the editor is Run script after a number of seconds command, which will add the code for you.

For last part for making displayed text vanish, you can use the Undo command that will undo the last transaction which could be the last message you printed, or you could do a sneaky clear screen and then reprint the same information but with the redacted text instead.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums