Operators
Operators are special characters (or a sequence of them) that represent special meaning in the code. In FLEx we can categorize them into few groups.
Comparison operators
For use inside of conditions.
>greater operator -@courage > 5<lesser operator -@courage < 5>=greater-or-equal operator -@courage >= 5<=lesser-or-equal operator -@courage <= 5==equality operator -@courage == 5
Equality operator can be used with any variable type, other operators work only with integer and float values.
Interpolation operators
They are used inside of interpolation contents.
General logic is as follows: <value or variable> <operator> <value or variable> => <value>.
+addition operator -@perception + 5-subtraction operator -@perception - 5*multiplication operator -@perception * 5/division operator -@perception / 5
Addition operator can be used with any value types. If at least one part is not a number then everything is coerced to a string value.
Other operators can only be used with integer and float values.
Effect operators
Effect operators are used inside of effect blocks. They mutate the values of variables upon selection of a passage by a player.
=assignment operator -@evil = true+=addition assignment operator -@luck += 1-=subtraction assignment operator -@luck -= 1*=multiplication assignment operator -@luck *= 0.5/=division assignment operator -@luck /= 0.5
Assignment operator replaces old value of the variable with a new one (types must match!).
Other operators mutate the existing value in-place and can only be used with numbers.
Logical operators
They’re used to chain multiple conditions together.
&&logical and operator -@brave == true && @sanity > 5||logical or operator -@brave == true || @sanity > 5
See also
- Conditions reference.
- Effect block.
- Interpolation reference.