Expressions
An expression is a calculation or a condition: %a + 1, ( 2 + 2 ) * 3, #Hits < 50, %a = 1 && %b = 2.
It is built from values, variables, operators and parentheses.
set %var 1337 ; a valueset %temp %var ; a variableset %next %var + 1 ; an operatorset %calc ( 2 + 2 ) * ( 3 - 1 ) ; parentheses: 8set %flag ! #true ; an operator before a value: 0display ok %next %calc %flaghaltWhich commands calculate
Section titled “Which commands calculate”Only five commands work out expressions: set, if,
while, until and return. Every other command
takes its parameters as they are: wait %a + 1 waits %a ticks and ignores the rest. To pass a calculated
value to another command, calculate it with set first:
set %a 19set %delay %a + 1wait %delay ; 20 ticks: one secondhaltSpaces matter
Section titled “Spaces matter”A line is split into words at spaces, and every operator and parenthesis has to be a word of its own:
set %b 1set %a %b + 1 ; right: 2set %c %b+1 ; wrong: "%b+1" is one word, so nothing is addeddisplay ok %a %cif ( %a > 1 ) ; right display ok %a is bigger than 1if (%a > 1) ; wrong: "(%a" and "1)" are not understood display ok never shownhaltCalculations use whole numbers only. A value that is not a number counts as 0 in arithmetic. See
Operators for every operator and the order they are worked out in.
Lines and blocks
Section titled “Lines and blocks”A script is a list of lines. Each line holds one command and its parameters, and runs from the first word to
the end of the line or to a ;, which starts a comment.
- A long line can continue on the next lines: start each continuation with
+. The pieces are joined without a space, so write+ more text(with a space after+) where you want one. - A block is a group of lines between a
{line and a}line. Blocks belong toif,else,for,while,suband a few others. The braces go on lines of their own, and the{has to be the line right after the command it belongs to.
set %a 3if %a > 2{ set %b %a * 2 display ok %b}display ok This is a long message that+ goes on over two lines.haltBased on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.