Complex <If> Command maybe too complex?

Trying to get this command to work:

<<if  $secret eq true $playerScore += 18>>

Well done you have discovered the secret<</if>>

I get the

Error: <<if>>: bad conditional expression in <<if>> clause: unexpected token: identifier :frowning:

trying to do too much with it. Maybe I should separate them?

Nested sub-conditional expressions need to be conjoined with logical-AND (and or &&) or loginal-OR (or or ||). In this case, however, it seems as though you’re attempting to increment $playerScore, which you do not want to do as part of the conditional test but rather as a separate <<set>>.

For example:

<<if $secret>>

<<set $playerScore += 18>>Well done you have discovered the secret<</if>>

Here are a couple examples of how you’d conjoin sub-conditional expressions:

<<if $hasRedCard and $hasBlueCard>>
	Has both red and blue cards.
<</if>>

<<if $lockpick >= 10 or $hasSkeletonKey>>
	Has either 10+ lockpick skill or a skeleton key.
<</if>>
1 Like

Excellent advice this has helped with the issue greatly. Thanks.