-
Notifications
You must be signed in to change notification settings - Fork 7
Variables_Condition_Statements
LUTE defines variables that will live on Flow Engines. Rather than forcing designers to use code, we have defined some common variables that when used allow Nodes, Orders and Engines to share data and create more complex experiences.
Simply put, a variable is named location to store data. Variables exist on the Flow Engine and are used to keep track of progress, items, choices and more related to the player. They are often used to pass data from one order to another or be used when checking conditions.
Variables do not automatically save and restore between play but the Save Variable mechanisms can be used to save and load variables from/to disk.
Typically when using conditional statements, we use a variable and an operation (such as equals or does not equal). This evaluation is typical when using common variable types (such as integers and strings) and will compare the provided input with the variable in question. However, certain variables (such as inventory items and locations) will use more complex evaluation methods; whilst it is not imperative to understand this at a high level, if one wishes to create new variables and custom evaluation methods then they should seek to understand this further.
Variables can be created within the Flow Engine Inspector and become visible in the Flow Engine Inspector and Window:


Each Variable needs a name which is how they are presented when used in ORders and drop-downs. You can set values of variables directly in the varibale list for most variable types. A common example might be an integer variable called 'Lives' which may initially be set to start at 3.
As we find in C#, Variables in LUTE declare the type of data they are going to contain.

Simple experiences will likely use booleans, integers and strings along with more complex types such as Locations.
Much like we would define the scope of a variable in C#, we can do the same in LUTE (currently allowing private, public and global).

- Private is not available to other Engines which ensures that the variable is only relevant to the Engine it has been created on.
- Public indicates that the variable can be found and is intended to be used or modified by other Engines. Those other Engines will need to be able to directly access the Engine the variable is declared on to modify it.
- Global allows for sharing state among all Engines, without direct access to other Engines. It also ensures that the value of the variable can exist and outlive the Engine that it was declared by.
When looking for variables, the Engine will first look for variables on itself and then for any public variables contained on other active Engines in the scene.