Conditions & Instructions

Use Built-in Scripting Support

If you want to use articy:expresso and the built-in scripting support, enable the checkbox "Use built-in scripting support" within the project settings under the tab "Flow". This option activates the auto-completion, syntax highlighting and error detection for all pin labels and other script textboxes (activated by default).

If you want to use plain text inside input and output pins you need to deactivate this setting, otherwise the text will be marked as conflicts. We recommend having script support enabled and using single // or multi line /* (…) */ comments for the occasional plain text entry.



Conditions

Conditions can be used at three different places in articy:draft: At input-pins of flow nodes, in dedicated condition nodes and inside script fields of object templates.

Conditions at Input-Pins

Using a condition at the input-pin of a flow node means that the game's flow can only progress through this node, if the condition is met. To add a condition to a node, simply double-click an input-pin, which opens the "Edit pin"-dialog. Here you can define your condition by using articy:expresso.
Example: Let's assume the player can choose between three topics in a multiple-choice dialogue, but one topic shall only be selectable, if the other two topics were selected before. In this case the condition at the input-pin of the dialogue fragment could look like this:



Condition Nodes

Condition nodes are the best way to create if/else-scenarios. This node type comes with a scripting field 1 instead of the usual description textbox, so that the condition is visible at a glance. Furthermore, a condition node has exactly two output-pins: The green output-pin is chosen if the evaluation of the condition returns true - the red pin if it returns false 2.



Example: In the image below the conversation proceeds differently depending on the outcome of the condition. As long as the variable "awake" is not set to true, the upper dialogue fragment 3 will be triggered. At the output-pin of this dialogue fragment 4 "awake" is set to true. If the player now talks again with this NPC, the condition will return false and the lower dialogue fragment 5 will be triggered. Thus it's possible to let the same dialogue take different routes depending on the current state of certain variables.



Instructions

Just like conditions, instructions can be used at three different places in articy:draft: At output-pins of flow nodes, in dedicated instruction nodes and inside script fields of object templates.

Instructions at Output-pins

Instructions at output-pins of flow nodes are executed as soon as the node is left via this output-pin. To add an instruction to a node, simply double-click an output-pin, which opens the "Edit pin"-dialog. Here you can define your instruction by using articy:expresso. You can add multiple instructions to a pin by separating the assignments with a semicolon.



Instruction Nodes

Instruction nodes are especially useful, if multiple events shall lead to the same variable changes. This node type comes with a scripting field instead of the usual description textbox, so that the instruction is visible at a glance.

Example: In the image below four flow fragments describing different quests lead to one instruction node 6 that increments a variable called "sideQuests_solved". So every time the player solves one of the quests, the counter is increased by one. The instruction node is followed by a condition node 7 checking the variable's value. If "sideQuests_solved" is equal or higher than 2 the flow continues. Else the player has to solve more side quests first.