I'm working on an encounter system that checks an array of objects for various things to see if they can be encountered in the current game state (e.g. a party happens in the evening time slot) and want to add arbitrary conditions to be checked (I've no idea what kind of trigger conditions I'll want further down the line).
I iterate through my array checking each prerequisite condition until I get to this one:
Currently the triggerCondition is a string ("1 eq 1") and the <<if>> clause activates.
However in testing something else I wanted to disable the encounter and set it to "1 eq 0" but the result still returns true. The cause is doubtless something sensible like the fact that anything at all is returned (rather than undefined) counts as a true result. I'm not particularly bothered by why it happens - the question is whether I can make the trigger conditions work?
Ideally I want to be able to set a string that'll be called and then evaluated in the context of the if statement. Thanks!
(Sugarcube 2.20.0 and Twine 2.1.3.)
(Also where'd the code button go in the post formatting controls - something to do with last night's maintenance?)