0 votes
by (220 points)
Say i have a link sent to a passage with a single item "object" known as Room Key and when perchased i want the link to that passage to disappear or become unavialabe. how would i do that? also on a reverse note how would i lock a link like a "Door" until the "Key" is perchased?

1 Answer

0 votes
by (159k points)

The answer to both your questions is to:
a. use a story variable to track if the room key has been purchased or not.
b, use a <<if>> related macro combined with the story variable to conditionally display the links.

1. Intitialise your story variable to false within your project's StoryInit special passage.

<<set $hasRoomKey to false>>

2. Within the passage you can purchase the Room Key from use the current state of the story variable to determine what to show. (note: I have named this passage Reception in my example)

You see a receptionist at the counter.

<<if not $hasRoomKey>>
	\<<link "Purchase a room key, then visiting the Hallway" "Hallway">>
		\<<set $hasRoomKey to true>>
	\<</link>>
\<<else>>
	\You have already purchased your room key.
\<</if>>

[[Visit the Hallway|Hallway]]

3. Within the passage you can use the Room Key in again use the current state of the story variable to determine what to show. (note: I have named this passage Hallway in my example)

You are at the end of a long hallway, there is a closed door with an electronic here.

<<if $hasRoomKey>>
	\[[Use Room Key|Your Room]]
\<<else>>
	\You wish you had a room key.
\<</if>>

[[Return to Reception|Reception]]


As you can see If you visit the Hallway without purchasing the Room Key to will not see the link, and if you return to Reception after purchasing the Room Key you will not be able to purchase the item again.

...