–1 vote
by (410 points)
retagged by
I am trying to make it so that when the player clicks look at the clock and when they go back, the option isn't there. I am attempting to do this using the variable $SeenClock, but it isn't working.

2 Answers

0 votes
by (8.9k points)

It would be better if you posted your exact code, because then we wouldn't have to guess, but:

To tell the game that the player has seen the clock:

<<set $SeenClock to true>>

To display the option to look at the clock only if the player hasn't seen it:

<<if not $SeenClock>>
  [[Look at the clock]]


by (410 points)
Thank you for telling me, but now, when I start the game, it doesn't show anything. All it shows are the other two options.
by (8.9k points)
It's impossible to tell you what's wrong unless you post your code...
by (410 points)

Ok. Here is my code:

(set: $SeenClock to true)
You wake up, opening your eyes tiredly. You can't see anybody in your room.
(if: not $SeenClock) 
   [[[Look at the clock]]]
[[Look at: Closet]]
[[Walk to: Door]]


by (8.9k points)

Aha!  This code sets $SeenClock to true in the first line.  So the if statement is working correctly, because $SeenClock is true.

To fix this, put

(set: $SeenClock to true)

in the passage where the user looks at the clock.

by (410 points)
I meant to put set false
by (8.9k points)

That won't work.  You need $SeenClock to stay true once the player has looked at the clock.  If you set $SeenClock to false in this passage the clock will always be visible.

by (410 points)
but the reason i have the problem is because it is the starting point in the story, and $seenclock isn't defined until the clock passage and if i want it to show on the screen, it needs to be defined as false the first passage.
by (8.9k points)

I'm not a Harlowe expert (your question is incorrectly tagged with SugarCube), so I may be wrong, but I don't think $SeenClock needs to be defined as false before you can use it in an if statement.

<<if not $SeenClock>> should fire if $SeenClock is false but also if it's not defined.

0 votes
by (159k points)
edited by

As explained by @Charlie. you can use a Boolean variable to track if the Reader has seen the clock or not.

1. Initialise your story variable in you're project's startup tagged special passage.

If your project doesn't have such a special passage yet then first create a new Passage (the Name isn't important and can be anything you like, I name mine Startup) then assign it a Passage Tag of startup in all lower-case letters.

Add the following to this passage, it defaults the story variable to false.

(set: $SeenClock to false)

2. Change story variable when the Reader sees the clock.

Add code like the following to the Look at the clock passage meantioned in @Charlie's example.

(set: $SeenClock to true)

3. Use the current value of the story variable to control the displaying of the link.

Use code like the following in the Passage you want the Look at the clock link to conditionally appear in.

(if: not $SeenClock)[
  [[Look at the clock]]