change variable

J_H_Bailey
04 Jan 2019, 05:15

Can you change a variable inside and IF Else statement?
I know this is not worded correctly, but I want health to decrease inside an ELSE statement.
Example - {if variable=true:You win!}{else dec health 5:You losing health.}
Any way to do this?


Bluevoss
04 Jan 2019, 22:20

Try this...

{if variable: You win!}
{else: {@health-=5} You are losing health.}

The trick inside if-then logic is to use the following to set variables: {@a=1}. No set required.


J_H_Bailey
05 Jan 2019, 01:03

Thanks. That does the trick.
As a follow-up....can I clear the screen with a command inside the else statement? Something like - {else: @clear: Game over.}


Bluevoss
06 Jan 2019, 04:59

That might work. I really don't know. Testing is in order...


J_H_Bailey
06 Jan 2019, 18:23

Doesn't work. Somehow I don't think Squiffy is capable to doing it.