0 votes
asked by (120 points)
(if: $inv contains "mortar and pestle", "dagger" )[You see the flower depicted in the cave. This will help you protect yourself. Maybe you can make the flower into a paste with the mortar and pestle and poison the dagger with it.](else:)["This flower looks intresting," you tell yourself. You stand up and walk away]

2 Answers

+1 vote
answered by (114k points)
edited by

Please use the Insert Code Snippet button to add code examples to your question, it makes them easier to find and read.

You need to break down the overall conditional expression in your (if:) macro example into each of its logical sub-expressions, using the and operator listed in the Boolean section you join those sub-expressions together again.

eg, The over all logic of the expression in your example is:

1. Check if the collection in the $inv variable contains the String "mortar and pestle".
2. Check if the collection in the $inv variable contains the String "dagger"
3. Check if point 1 and point 2 are both true at the same time.

The TwineScript to do that is:

(if: $inv contains "mortar and pestle" and $inv contains "dagger")[ do something... ]

note: If the above point 3 was: Check if either point 1 or point 2 is true (not necessarily at the same time); then you would replace the and operator with the he or operator listed in the Boolean section like so:

(if: $inv contains "mortar and pestle" or $inv contains "dagger")[ do something... ]

 

0 votes
answered by (4.4k points)
yep greyelf's right. just remember you gotta use 'and's instead of commas, and even if you still mean in the same variable you've got to write '$inv' twice
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...