Hi! Nice forum.
Would it be possible, once a link has been visited, to disable it in all other passages? I could do this with variables, but I was wondering if I could alter the story settings somehow to avoid having to code each instance. To clarify, I would still want the text to appear, just not as a link. So, for example, if three separate passages all contained a link from the word tree that led to the same passage, the word tree would then not be highlighted should the player visit one of the others after following the link in one of them.
Sorry for the poorly worded question!
Comments
Unfortunately, as far as I know, there's no, like, "setting" that does as you wish. Variables, like you say, will do it.
It's not quite what you're seeking, but there's the <<choice>> macro. I haven't used it, but from this quote, it seems like it does something similar: "choice is now usable in Sugarcane. It now creates a link that can only be clicked once in the whole story."
There's also Leon Arnott's <<replace>> macro, but again, it's not quite what you want.
Maybe someone will come along and offer more help than I'm able.
Seems like the easiest way to conditionally make the word "tree" a link would be with something like: You can set a variable as Boolean and true by: I think using Twine's "Replace across entire story..." would make implementing the above trivial.
Most of original post below:
...what about using find and replace to find all instances of the link you want to disable and replacing it with whatever code is needed to accomplish what you want?
I just ran across this today and it seems pretty neat: you can give a variable a passage name and then make that variable your link.
So you could code something up where, once the player follows the link, the variable changes to a different passage name, and from then on the link goes to that second passage.
[quote]Passage One
<<set $storedPassage = 'Passage One'>>
[[Check Inventory|Inventory]]
Inventory
You have:
+ Item A
+ Item B
<<print "[[Close Inventory|"+$storedPassage+"]]">>
will render a link to your storedPassage (Passage One);"
From: [url=https://groups.google.com/forum/#!searchin/tweecode/find/tweecode/zU2FRmMbK14/vJZaBCYIbIYJ]here.
Do you mean <<autolink>>? Google isn't helping me here.
@loopernow
Oh nice, I never noticed 'replace across entire story', that does make things a bunch easier. Thanks!
One more thing. Is there a way to treat all uninitialised variables as 0? Basically I'd like to avoid having to set the 'visited' variables for every passage to 0 at the start of the story.
[quote]All new variables are now 0 by default, regardless of whether you've set them or not. As for checking visited passages, you can try the function that gives a result of however many times you've visited the passage, so that e.g. might give 2 if you've been to the Brewery passage twice. visited() on its own gives the results for the current passage. checks if it's the first time you've been to the passage.
Edit: scrap that, I actually figured something out for myself!