This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
twine1:if [2016/05/09 19:37] 127.0.0.1 external edit |
twine1:if [2017/10/09 20:39] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | <- [[remember|Remembering Things With Variables]] --------- [[nobr|Removing Line Breaks]]-> | ||
- | |||
=====<<if>>===== | =====<<if>>===== | ||
Line 38: | Line 36: | ||
</code> | </code> | ||
- | Then we can use the <<if>> macro and the [[function|visited() function]] to display a passage indicating victory: | + | Then we can use the <<if>> macro and the [[twine1:visited]]() function to display a passage indicating victory: |
<code> | <code> | ||
Line 71: | Line 69: | ||
<<endnobr>> | <<endnobr>> | ||
</code> | </code> | ||
- | |||
- | ====<<else>>==== | ||
- | |||
- | <<else>> is a macro that is used to indicate text that should be displayed if the condition is //false//. | ||
- | |||
- | <code> | ||
- | The door to the left leads to the pantry. | ||
- | <<if visited("Pantry")>> | ||
- | No way are you going back in there! | ||
- | <<else>> | ||
- | Sounds like a good place to search... | ||
- | <<endif>> | ||
- | </code> | ||
- | |||
- | The <<else>> macro can itself contain another "if //condition//", which causes the contents to only display if THAT condition is true: | ||
- | |||
- | <code> | ||
- | <<if $health is 3>>\ | ||
- | You're in tip-top condition - fighting fit and frankly fearsome. No human or god can lick you! | ||
- | <<else if $health is 2>>\ | ||
- | DOOMED! You're DOOMED, puny player!! You've lost already! YOU CANNOT WIN!! MWAHAHAHAHA! | ||
- | <<endif>>\ | ||
- | </code> | ||
- | |||
- | You can insert as many <<else if>>'s as you want inside an <<if>> / <<endif>> pair. | ||
- | |||
- | (Note: if you prefer, you can also write "else if" as "elseif".) | ||
- | else if | ||
- | |||
- | <- [[remember|Remembering Things With Variables]] --------- [[nobr|Removing Line Breaks]]-> | ||
- |