0 votes
by (120 points)
edited by
I'm trying to make an explore town process.

in my "Town" passage, i have an "explore" link to a new passage. In the "explore" passage, for example, the player finds a grocery store, I want to add that grocery store to the "Town" passage, but only if the player has found it in the "explore" passage. I don't want a "grocery store" passage to appear on the "Town" page before you have found it.

Can anyone help?

I am using Sugarcube 2.21

Thanks in advance.

1 Answer

0 votes
by (159k points)

You can use a Boolean story variable to track if something has happened, like finding a Grocery Store.

1. Use the <<set>> macro within your projects StoryInit special passage to initialise your story variable to false, this value represents that fact that the Reader hasn't found the Grocery Store yet.

<<set $foundGrocery to false>>

2. In your Explore passage you will use another <<set>> macro to change the story variable's value to true to indicate that the Grocery Story has been found.

You look around the town and find the Grocery Store. <<set $foundGrocery to true>>

[[Return to the town square|Town]]

3. In your Town passage you will use an <<if>> macro to check the current value of the story variable and conditionally show the link to the Grocery Store based on whether it has been found or not.

You arrive at the town square and wonder what to do next.

[[Go exploring|Explore]]
\<<if $foundGrocery>><br>[[Visit the Grocery Store.|Grocery Store]]<</if>>

 

by (120 points)
Thanks a lot for the help greyelf!!!
...