The wait action pauses script execution for a specified amount of time or until the player interacts. Once the time has passed (or the player clicks), the game automatically continues to the next statement.
Action ID: Wait
Reversible: Yes
Requires User Interaction: Optional (required if no time specified)
Parameters
Name
Type
Optional
Description
time
number
Yes
The time in milliseconds to wait before continuing.
Behavior
With Time Parameter
When a time value is provided, the game:
Blocks all user interaction
Waits for the specified duration
Automatically advances to the next statement
In this example, after the first dialog is shown and the player clicks to continue, the game waits for 5 seconds (5000 milliseconds) before showing the next dialog.
Without Time Parameter
When no time is provided, the game pauses and waits for user interaction:
This is useful for creating pause points where you want the player to manually advance.
Time Conversion
The wait action accepts time in milliseconds. Common conversions:
Duration
Milliseconds
1 second
1000
5 seconds
5000
10 seconds
10000
1 minute
60000
0.5 seconds
500
Error Handling
If an invalid (non-numeric) time value is provided, the engine will display an error:
The error message will indicate the invalid time value and the location in your script.
Examples
Dramatic Pause
Scene Transition Delay
Timed Event Sequence
Technical Details
During a timed wait, the block global is set to true, preventing user interaction
monogatari.script({
'Start': [
'y The truth is...',
'wait 2000',
'y I\'ve always loved you.',
'end'
]
});
monogatari.script({
'Start': [
'show scene black with fadeIn',
'wait 1000',
'show scene bedroom with fadeIn',
'y Where am I?',
'end'
]
});
monogatari.script({
'Start': [
'play sound thunder',
'wait 500',
'show scene lightning with flash',
'wait 200',
'show scene dark_room',
'y What was that?!',
'end'
]
});