- In game, bugfix : now, when a text is hidden, the following messages to which it's merged won't be read.
- In the editor, actions are now sorted by "type" categories, to help you find the action you want more easily.
- And, the most important feature : the game has been updated with the capability to evaluate expressions. For those who do not understand, don't worry : it's not needed to use the editor as usual, but for people who wanted to be able to do more things with variable, it can come handy.
It also goes with a new action "evaluate condition", to which you have to provide a boolean expression that will be evaluated and redirect the player.
So, since expressions are a bit particular, I'll give basic info about how to use them. There are two practical examples in paragraph 6).
1) Where can an expression be used ?
An expression can be used
- In the action "evaluate condition", as first argument
- In the action "Test a variable's value", as both variable to test and value to compare to. In this action, you have to indicate you're using an expression by writing 'xpr=' at the beginning of the argument.
- In "Define a variable", the value will be interpreted as an expression if it begins with 'xpr='.
2) How does an expression work ?
The idea is simple : like a calculator. You know, if you type '1 + 1 * 2' in a calculator, it will output 3. It's the same here.
It can use variables as input. For example, if you defined the variable "smurf" to the value 1, '1 + smurf' will evaluate to 2.
3) How must an expression be written ?
There's a precise - but simple - syntax to follow.
- Numbers and operators can be entered as-is. will output 6
Code: Select all
1 + 5
- Strings must be entered between simple quotes will output I am 18 years old
Code: Select all
'I am ' . 18 . ' years old'
If your string contains a simple quote, escape it with backslash :will output I'm saying hello.Code: Select all
'I\'m saying hello'
- Simple variable names (that contain only lower-case, unaccented letters) can be entered as-is . will output 2 if smurf is set to 1
Code: Select all
1 + smurf
- Complex variable names (with spaces, etc.) have to be double quoted. will output the content of the variable named My variable.
Code: Select all
"My variable"
If your var name contains a double quote, escape it with backslash :will output the content of the var named This is "plop".Code: Select all
"This is \"plop\" !"
- Binary operators have their own priority order, but you can use parentheses to change it and group terms. will output 25, whereas
Code: Select all
1 + 3 * 8
will output 32Code: Select all
(1 + 3) * 8
- There are special functions that can be called with f: followed by the function's name, and its arguments in parentheses, separated by commas. will output true if the player can see evidence 1, else false.
Code: Select all
f:evidence_is_revealed('preuve', 1)
- - as unary operator to take the opposite of a number. Ex :
Code: Select all
-5
- ! as unary operator to take the opposite of a boolean. Ex : will return false.
Code: Select all
!true
- +, -, *, /, %, ^ as binary operators for basic operations on numbers. / is the integer division, % the modulo, and ^ the exponent. Ex :
Code: Select all
5 - 8 + 7 ^ 2
- =, !, <, > as binary operators to compare objects. By the way, a ! b means "a is different from b" Return a boolean.
- . to concatenate two strings. Ex :
Code: Select all
'I am ' . 'fine !'
- &, | to operate on boolean. & means 'and' and | means 'or'. Ex :will always output false, whatever the content of plop is, since 3 is never equal to 1
Code: Select all
(1 = 3) & plop
- str_begins_with. takes two arguments, and checks if the second one is at the beginning of the first one. Returns a boolean. Ex : will return true.
Code: Select all
f:str_begins_with('plop', 'pl')
- str_ends_with. Idem, but at the end of the string. Ex : will return true.
Code: Select all
f:str_ends_with('plop', 'op')
- str_contains. Idem, but anywhere in the string. Ex : will return true.
Code: Select all
f:str_contains('plop', 'lo')
- str_first_word. Extracts the first word of a string. Ex : will return Apollo
Code: Select all
f:str_first_word('Apollo Justice')
- evidence_is_revealed. Checks if the player can see a piece of evidence. Takes two parameters : the type and id. The type is 'preuve' for evidence, and 'profil' for a profile. Returns a boolean Ex : checks if evidence 1 is in the record, returns true then, or else false.
Code: Select all
f:evidence_is_revealed('preuve', 1)
6) Practical examples
For those who just want to do basic things and do not understand the rest of it, or for those who don't really get it and need more examples, here we go :
a) How to check an evidence is revealed and redirect the player ?
-> Use the "evaluate condition" action, with that expression :
Code: Select all
f:evidence_is_revealed('preuve', 1)
You can check for several evidences a the same time by doing like that :
Code: Select all
f:evidence_is_revealed('preuve', 1) & f:evidence_is_revealed('profil', 5)
Code: Select all
f:evidence_is_revealed('preuve', 1) | f:evidence_is_revealed('profil', 5)
b) How to increment a variable ?
If you want to increment a variable, to count the number of times the player saw a message for example, you have to use the "define variable" action.
Let's say you want to add 1 to the variable name count, you'll have to do
Define variable
Variable's name : count
Variable's value : xpr=count + 1
Don't forget the 'xpr=' at the beginning to indicate you're using an expression.
Here's basically how it works, I hope it's not too hard to understand