Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

How do I use the not operator with variables? [SOLVED]

edited July 2014 in Help! with 1.x
Suppose $wrench can have many values throughout the game: "held", "hidden", "lost", "broken", etc.

I want something like this: <<if $wrench is not "held">>You don't have the wrench.<<endif>>

I ran some tests to no avail. Is there a way to do this, or at least a list of things the not operator will work on? Without not, I'd have to make a rather complicated <<if>>:

<<if ($wrench is "hidden") or ($wrench is "lost") or ($wrench is "broken") or ($wrench is "in trunk") or ($wrench is in "in puddle")>>You don't have the wrench.<<endif>>

If the mods are reading, the wiki could do with more examples than the sole visited() one presented.

Comments

  • What you're looking for is:
    <<if $wrench neq "held">>
    There's a list of operators on the twine wiki. Uhh, the link is http://twinery.org/wiki/expression down at the bottom.
  • Thanks. I just find the examples in the chart there too terse. For instance, how would you use their 'not visited("Waterfall")'  with an <<if>> or <<set>> or whatever is allowed?
  • Like so:
    <<if not visited("Waterfall")>>the player has never been to the waterfall<<endif>>
    Since visited() actually returns an integer, you could also do that as:
    <<if visited("Waterfall") is 0>>the player has never been to the waterfall<<endif>>
    Or:
    <<if visited("Waterfall") eq 0>>the player has never been to the waterfall<<endif>>
  • I see. Thanks.
Sign In or Register to comment.