Scripting in articy:draft

With version 2.2., articy:draft introduces its own easy to use expression language called "articy:expresso" and a set of accompanying features to support the designer/writer in the scripting process. You can now create, manage and use global variables throughout the project - making it possible to define conditions precisely and change the values of variables via instructions when reaching certain points in your game flow.

Testing Scripts in Simulation Mode

NEW in 2.4!
You can test your articy:expresso scripts within articy:draft by using the simulation mode of the presentation view.

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.



If the scripting support is activated, the auto-completion will offer a list of all matching variable sets or variables 1 when writing in a script textbox. You can select an entry from the list via left-click or via the arrow-keys and ENTER.



Conflicts in the script are visualized by words underlined in red 1 and the conflict icon in the upper right. Hovering over the icon will show a tooltip describing the conflict 2:



articy:expresso Syntax


articy:expresso is an easy to learn expression language, which can help you define conditions and instructions (variable testing and assignment). Its syntax is basically a subset of the C# syntax.

Conditions & Instructions

The concept of articy:expresso centers around conditions and instructions. Conditions are used to test the values of variables and thus to control the game flow. Instructions are their counterpart and are used to modify the values of variables.

If you want to combine multiple variable checks in one condition, you can use the logical operators AND, OR and XOR.
Example: GameState.talkedToGuard == true && Inventory.collectedTokens >= 10

In instructions multiple assignments must be separated by a semicolon.
Example: Inventory.key = true; Inventory.collectedTokens += 5;

To learn more about conditions and instructions, click here.

Variables

Variables can be of type boolean (true/false) or integer (number). They are always addressed in the following notation: VariableSet.Variable.
Example: You created a global boolean variable called "key" that is set to true, if the player finds the missing key. This variable is inside the variable set called "Inventory". To use this variable in conditions or instruction write: "Inventory.key".

Operators

The following relational operators can be used to compare variable values.

== Is value equal to...

!= Is value not equal to...

<= Is value less than or equal...

>= Is value greater than or equal...

< Is value less than...

> Is value greater than...



The following logical operators can be used to concatenate comparisons.

&& Logical AND

|| Logical OR



The following arithmetic operators can be used:

+ Add

- Subtract

* Multiply

/ Divide

% The modulo operator computes the remainder after dividing its first operand by its second. (Example 5 % 2 = 1)

++ Pre-/Post Increment (+1)

-- Pre-/Post Decrement (-1)



The following assignment operators can be used to set variable values. Assignment operators can be used in instructions only, not in conditions.

= Set value to...

+= Set value to current value plus...

-= Set value to current value minus...

*= Set value to current value multiplied by...

/= Set value to current value divided by...

%= Sets the value to the remainder after dividing the first operand by the second (modulo).

Short form

Instead of writing "Variable == true" you can also just write "Variable" and instead of writing "Variable == false" you can write "!Variable".

Comments

It's possible to add comments to a script via:
  • // for a single-line comment and
  • /* insert comment here */ for multi-line comments
Comments won't be evaluated and are just a tool to describe the intentions behind an expression.

Examples

These are examples for conditions with articy:expresso:
Inventory.key == true
GameState.talkedToGuard == true && Inventory.collectedTokens >= 10


Typical instructions in articy:expresso look like this:
Inventory.key = true;
Inventory.collectedTokens += 5;