Skip to content

Set Lines

When you want to change variables from script, you do it with a set line, for example:

[set SomeNumber 9]

Optionally you can use an "=" between the variable name and the value if you want, but you don't have to.

All variables are considered to be dialogue scoped variables, unless they are prefixed with global., in which case they are set as global variables.

# This sets a global variable which persists across all dialogues
[set global.SomeBool true]

Setting Literal Values

Here's how you set variables using each of the supported types from simple literals:


[set SomeInt 5]

Floating point

[set SomeFloat 53.835]

Note: do not include any suffix like 'f'


[set SomeBool true]

Supported arguments are true, True, false and False


This is for text (FText) you expect to display to the player.

[set SomeText "Hello world"]

If you need to include double quotes inside the text, you can escape them like so:

[set SomeQuotedText "This has \"quotes\" in it"]

Note: Literal text is automatically tagged for localisation just like text in speaker lines and choices.


Names (FNames) are not localised unlike text, so are good for signalling more descriptive values to / from code.

[set SomeName `HelloWorld`]


[set SomeGender feminine]

The 3 gender options are masculine, feminine and neuter

Setting Values Using Expressions

Rather than a literal value, you can set a variable based on an expression, which is a potentially compound statement, which can reference other variables and perform operations.

See the Expressions section for a complete discussion, but for example you could do things like this:

[set SomeInt = {SomeInt} + 1]
[set SomeBoolean = {AIsTrue} or {BIsTrue}]
[set IsLargeEnough = {SomeInt} > 10]

Note that I've used the '=' symbol here; I don't have to, it's optional, but I find it easier to read when there are expressions on the right instead of literals.

See Also