I’m trying to make an attribute check where if {Attack}=15 or more, the story continues on [[Section10]]. But if it {Attack}=10 or less, you get sent to [[Section11]]. How can this be done? I have tried this:
[[fight]]{if {Attack}=15+:[Sec10]}
But to no result. I’m obviously doing something wrong, but I am unsure what?
{Attack}
displays an attribute named Attack
.
{if {Attack}=15+:
would check if the attribute named {Attack}
is a text string containing the characters 1
, 5
, and +
.
If you want to check if an attribute is equal to 15+
, you would do something like:
@set Attack = 15+
{if Attack=15+:This will be true}
If you want to check if it's 15 or higher, you're not checking for "equal to". You're checking for "greater than or equal to". So the comparison operator should be >=
rather than =
.
Example:
@set Attack = 17
{if Attack >= 15:This will be true}
Comparison operators are:
=
- is equal to>
- is greater than<
- is less than<>
- is different from<=
- is less than or equal to>=
- is greater than or equal toSo in your example, you would do:
{if Attack >= 15:[[Section10]]}
{else:[[Section11]]}
Thank you for the reply! However, when I type this code into Squiffy, it doesn’t come out as intended. Is this a bug or is there another issue? I inputted the code but it comes out as Section11 as the clickable word rather than fight
@set attack = 12
{if attack>=15:{@next=Section 10}}
{if attack<=10:{@next=Section 11}}
{if next<>Section 11:{if next<>Section 10:{@next=Limbo}}}
[[fight]]({next})
[[Section 10]]:
You're in Section 10.
[[Section 11]]:
You're in Section 11.
[[Limbo]]:
What do you want to do for numbers you haven't declared?
I'm always late to the party.
Try this:
{if att>=15:[[Section 10]]}
{if att<=10:[[Section 11]]}
Thank you for the reply! However, when I type this code into Squiffy, it doesn’t come out as intended. Is this a bug or is there another issue? I inputted the code but it comes out as Section11 as the clickable word rather than fight
Sorry, I was just basing it on the code you posted. You had a section link [[Attack]]
, followed by a passage link [Section10]
if the condition is true. It wasn't clear that they were supposed to be the same link.
I think it should be:
{if Attack >= 15:[[Attack]](Section10)}
{else:[[Attack]](Section11)}
Edit:
I only just noticed you said "if it's 10 or less" for the alternate condition. So you don't need an else
in that case; it would be:
{if Attack >= 15:[[Attack]](Section10)}
{if Attack <= 10:[[Attack]](Section11)}
I seem to recall that you need to be careful adding spaces around the operatives. Years back, I had a frustrating issue because of that. Of course, giving my coding, it could have been something else...