Howdy, Stranger!

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

If / else / has nightmare!

edited November 2015 in Help! with 2.0
Doh! It wasn't until checking through this post that I saw my error. I was using an 'if' to check for $Drink when I should have been checking for $ClearLIquid. Read on if you like, but the issue is now resolved.

Problem:

Player is at a passage where he has two options. 'Take everything' (which includes a bottle of water) or 'Push on' (without taking anything.

At the passage following 'Push on', I want to offer him the option to drink water, but only if he chose the 'Take everything' option at the previous passage.

These are the two passages. The first is where he gets the option to take everything, the second is the passage after he chooses to push on.
<<if not $visitedBody>>\
<<set $visitedBody to true>>\
The crow takes off.

Clearly a body, and very dead. The poor man's face is bloated, blotched with green.

A backpack lies trapped benath him.

A quick search of the dead man's pockets reveal a pocket knife and a box of bullets.

[[Push on]]
<<click [[Take everything|Approach object]]>><<set $hasBullets to true>><<set $hasKnife to true>><<set $hasPack to true>><<set $hasClearLiquid to true>><<set $hasSleepingBag to true>><<set $hasHoodedFleece to true>><<set $hasBakedBeans to true>><</click>>
<<else>>\
The body lies plundered.

[[Push on]]
[[Examine takings->packcon]] <</if>>
<<if not $Drink>>\
<<set $Drink to true>>\
Steady pace along the long empty road now. Making good time, but the darkness is fading rapidly as the sun makes for the horizon.

Thirst developing. Dry lips.

[[Stay on the road]]
[[Head for the forest and make camp for the night->Camp]]
<<if $hasDrink>>[[Drink clear liquid|Push on]]<</if>>
<<else>><<set $hasClearLiquid to false>><<set $hasDrink to true>>Tasting tentatively. A drop to the lips. <em>It's water!</em>

Drinking furiously now, a quarter of the contents gone in a few gulps.

[[Stay on the road]]
[[Head for the forest and make camp for the night->Camp]]<</if>>

This is how I currently have it, but can't work out why it's not working. For the record, the problem is that the option to drink water never shows up, whether I choose 'Take everything' or not.

Comments

  • Just a heads up, you need to mark someone's comment as 'solved my problem' to get your question out of the 'unsolved' list

    By the way; I love the look of your work. I bet that's a lot of fun to work through :D It's just like the old adventure stories that got me into this :D
  • Sorry, zededd, do you mean the 'Did this answer the question? Yes • No'.

    Up until your post, no one had replied, so I couldn't close it.

    And thank you for the compliment. My narrative style is a lot different with this one. I've set myself the rather difficult task of never using the possessive pronoun 'you'. It's a lot more difficult than you might imagine.
Sign In or Register to comment.