I'm having issues trying to put the code together for something. I'm using Harlowe on Twine 2.
How can I have passages that show only once, the first time you visit that passage? I want it so that the first time the passage is visited this whole part is shown.
You tread through the thick patches of of branches and vegetation. You stand still for a second on the damp ground and suddenly notice something squirming right next to your foot. It's an orange meter-long centipede (the legs longer though, like a spider with a red horn adorned on the head. The type of insect that makes your soul try to crawl out of you in any direction. You only have a split second to react!
What do you do?
Try to stand still and wait to see if it passes->B6 Wait
Quicly try to stomp on it before it attacks!->B6 Stomp
Step back and make a run for it!->B5 Jungle
And then after the first it's just a standard message?
Comments
(set: $ExploredPassage to false)
Then you have to put a link that could turn the variable on "true" when you visit the passage, but under a "if" condition
(if: $ExploredPassage is false)[ (link: "NameofPassage")[(set: $ExploredPassage to true)
You can write text here
link to whatever you want
]]
(else:)[Write here what you want, it's the Passage description you'll see from the second time. You could put other links or other conditions to be checked and so on]
Pay attention to the numbers of square brackets to close to make the code "right": I spend a lot of time searching for the Lost Bracket!
So the first time the variable is false and the game will display all the choices you want, the second time the variable will be true, and so the game will dispaly all the code that lies after the condition (else:)
I hope the tip could help you.
Thanks SixPix. I'm having trouble understanding the part with (link: "NameofPassage").
I did as greyelf suggested in the other post and put a startup passage and put my variables there. I set the variable to zero in the first passage.
I also put in the code as you said inside of the passage that I want to display a certain message the first time.
Now I start the game and go to the passage and just get a blank as if it's not processing at...
This is what I have on the Passage.
(if: $ExploredB6 is false)[(link:"B6 Wait")[(set: $ExploredB6 to true)
You tread through the thick patches of of branches and vegetation. You stand still for a second on the damp ground and suddenly notice something squirming right next to your foot. It's an orange meter-long centipede, only with legs like a spider and a red, black-tipped horn on it's "head". The type of monster that would make your soul want to run for it. You only have a split second to react!
What do you do?
Try to stand still and wait to see if it passes->B6 Wait
Quicly try to stomp on it before it attacks!->B6 Stomp
Step back and make a run for it!->B5 Jungle
(else:)This is what would normally appear
]]
I attached the debug view.
I'm also not sure if I'm doing as greyelf mentioned right. The startup passage I named "Startup" and I put in the tag "Startup". I didn't set it as the starting point though because as I had understood Twine will do this automatically and read the code from startup but start the story in the other passage. Am I right with this?
The issue with your example is the placement of close square bracket of the (if:) macro's associated hook, you have the (else:) macro inside the (if:) macro's hook. It should be something like the following: notes:
a. I replaced the $ExploredB6 is false with an equivalent not $ExploredB6
b. I added indentation and line-breaks to make the example more readable and so you can clearly see the open and close square brackets of each associated hook.