| title | Wait |
|---|---|
| order | 39 |
| description | Pause the script for a number of milliseconds, or until the player clicks. |
wait pauses the script. With a time, the game holds for that long and then goes on by itself; the player's clicks don't shorten it. Without a time, the game stops until the player clicks, as it does after a line of dialog, but without showing a new line.
'wait [<milliseconds>]'| Part | Type | Default | What it does |
|---|---|---|---|
<milliseconds> |
whole number | none: wait for a click | How long to wait, in milliseconds (1000 is one second). Only whole milliseconds count: wait 1.5 waits 1 ms. A word that isn't a number, like wait 5s, opens an error dialog, then waits for a click. |
monogatari.characters({
'y': {
name: 'Yui',
color: '#c28cf0',
},
});
monogatari.script({
'Start': [
'y The truth is...',
'wait 2000',
'y I\'ve always liked this place.',
'end',
],
});When the player clicks past "The truth is...", the line stays on screen for two more seconds, then Yui's next line appears by itself. Clicking during those two seconds does nothing.
Waits also time a run of statements that don't stop for the player, such as scene changes and sounds:
monogatari.assets('scenes', {
'afternoon': 'afternoon.jpg',
'nightLight': 'night-light.jpg',
});
monogatari.assets('sounds', {
'bell': 'bell.mp3',
});
monogatari.script({
'Start': [
'show scene afternoon with fadeIn',
'wait 1500',
'play sound bell',
'wait 3000',
'show scene nightLight with fadeIn',
'y The lamps are on.',
'end',
],
});Put the scenes in assets/scenes/ and bell.mp3 in assets/sounds/. The palace fades in in the afternoon, the bell rings a moment later, and three seconds after that the palace at night shows with Yui's line.
wait on its own stops the game until the player clicks, where the next statement wouldn't wait. Use it to let the player look at a new scene before the text comes back:
monogatari.assets('scenes', {
'nightLight': 'night-light.jpg',
});
monogatari.script({
'Start': [
'y Come, I want to show you something.',
'hide textbox',
'show scene nightLight with fadeIn',
'wait',
'show textbox',
'y Beautiful, isn\'t it?',
'end',
],
});With auto-play on, a click-wait lasts as long as the player's auto-play speed, like a line of dialog. Skip mode passes it.
| Statement | The game moves on |
|---|---|
wait <milliseconds> |
By itself, when the time is up. Until then, clicks, the advance keys, auto-play and skip mode don't move it on. |
wait |
When the player clicks (or presses an advance key, or auto-play or skip mode moves on). |
During a timed wait the game isn't frozen: the player can open the menus. If they open one, the wait still ends on time and the game goes on behind the menu.
wait isn't a statement the player stops at: going back passes over it and lands on the line the player stopped at before it.
During a timed wait that follows a line the player clicked past, Back does nothing: the player can go back once the wait is over.
| Dialog title | When | What to do |
|---|---|---|
The specified time was not an integer |
The word after wait isn't a number: 'wait 5s', 'wait soon'. The dialog names the statement. Once it's closed, the game waits for a click, as wait with no time does, so a released game (without the debug module) behaves the same. |
Write the time as a number of milliseconds: 'wait 5000'. |
Before 2.9.0, no dialog showed for this.
- Next: go on to the next statement at once.
- Show Text Box: bring the text box back after the player looked at the scene.
- Dialog: lines the player clicks through.