Control
Control is a class that has some utility methods for flow control.
Control.do([
character1.say("hello"),
// play sound and shake image at the same time
Control.allAsync([
sound.play(),
shake(image1),
]),
]);Static Method
do
Execute actions in order, waiting for each action to complete
actions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
doAsync
Execute actions in order, do not wait for this action to complete
actions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
any
Execute all actions at the same time, waiting for any one action to complete
actions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
all
Execute all actions at the same time, waiting for all actions to complete
actions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
allAsync
Execute all actions at the same time, do not wait for all actions to complete
actions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
In any, all, and allAsync, each entry in the array runs as its own concurrent branch. A single chained statement (e.g. image.pos(a).pos(b)) is split into multiple parallel branches, which conflict when they target the same element. To run several steps in sequence within one branch, wrap them in Control.do([...]):
Control.all([
Control.do([image.pos(a), image.pos(b)]), // sequential, one branch
sound.play(), // another branch
]);repeat
Execute actions multiple times
times: number- timesactions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
whileLoop
Execute actions while condition is true
condition: Lambda<boolean> | LambdaHandler<boolean>- condition to checkactions: ActionStatements- ActionStatements- Returns
ChainedControl- Chained Control instance
breakLoop
Break the current loop (repeat/while) Can only be used inside a loop body
- Returns
ChainedControl- Chained Control instance
sleep
Sleep for a duration
duration: number | Awaitable<any> | Promise<any>- sleep duration- Returns
ChainedControl- Chained Control instance
waitForClick
Pause execution until the user clicks anywhere on the stage (excluding GUI elements such as dialog, buttons, menus). Similar to inserting a pause with no duration in a Sentence.
Useful for creating "click to continue" moments in ADV mode, or for pausing within NVL blocks until the player is ready to proceed.
scene.action([
character.say("Read this carefully..."),
Control.waitForClick(),
character.say("Now we continue."),
]);- Returns
ChainedControl- Chained Control instance