Documentation
Conditional

Conditional

You can create a conditional statement by using the Condition element.

scene1.action([
    new Condition()
        .If((ctx) => ctx.storable.getNamespace("game").get("flag"), [
            character1.say("You have the flag!")
        ])
])

In the condition statement, the game context is provided, you can learn more about the ScriptCtx object.

You can only have 1 If Statement and 1 Else Statement in a condition statement, but you can have multiple Else If Statements.

scene1.action([
    new Condition()
        .If(/* ... */, [/* ... */])
 
        .ElseIf(/* ... */, [/* ... */])
        .ElseIf(/* ... */, [/* ... */])
        .ElseIf(/* ... */, [/* ... */])
 
        .Else(/* ... */, [/* ... */])
])

Note: If you put these statements in the wrong order, the condition will throw an error.