Hello, I've been trying to figure out how to check multiple attributes at once like so
[press button]:
{if code=2 code1=5 code2=3:[ding!]}{else:bzzz}
but I can't figure out how to properly separate the attribute checks. I've looked around online but haven't seen a clear answer.
--constant
In most programming languages you have and
, or
, and not
operators; but Squiffy's text processor doesn't. For cases like this, you'll need to put mmultiple {if
blocks inside each other.
Example:
{if code=2:{if code1=5:{if code2=3:[ding!]}}}
Unfortunately, this doesn't work well with {else
blocks. You might have to do something like:
{if code=2:{if code1=5:{if code2=3:[ding!]}{else:bzzz}}{else:bzzz}}{else:bzzz}
(giving each of the if statements its own else)
Or use a temporary variable, for example:
{@not codecorrect}
{if code=2:{if code1=5:{if code2=3:{@codecorrect}}}}
{if codecorrect:[ding!]}{else:bzzz}
(setting a temporary attribute to true or false, depending if the code is correct – this is probably helpful if you have a long 'else' clause)
thank you so much, I've been banging my head against this. It seems like it's working now.