#True and #False
#True and #False are on/off values: #True for yes, on, done,
#False for no, off, not yet. They make conditions short and easy to read.
Without them, a setting is usually written as text:
set %usemagery yes
if %usemagery = yes display ok Heal with Magery.if %usemagery = no display ok Heal with bandages.haltWith them, the condition reads like a sentence:
set %usemagery #True
if %usemagery display ok Heal with Magery.if ! %usemagery display ok Heal with bandages.haltif %usemagery runs the next line when %usemagery is true; if ! %usemagery turns the test around and runs it
when it is false.
Why it has to be #True
Section titled “Why it has to be #True”#True is the number -1 and #False is 0, the same values comparisons such as %a = 1 give. if,
while and until treat only -1 as true. So:
%flag holds |
if %flag |
if ! %flag |
|---|---|---|
#True (-1) |
runs | skips |
#False (0) |
skips | runs |
Text, such as yes |
skips | runs: text counts as 0, so yes behaves like #False |
1 or any other number |
skips | also skips |
Set flags with #True and #False, never with yes or 1, and if %flag / if ! %flag always do what they
say.
Based on a quick guide by Una from the EasyUO wiki.
Based on the EasyUO wiki, edited for EasyUO Reforged. This text is available under the GNU Free Documentation License 1.2.