0 votes
by (140 points)
Hi there, (I'm working in Sugar Cube)

I think I asked this question before, but I don't think I got the answer I was looking for,

In this scenario, The user would click on the word (for this situation, between asterisks). Example, 'You are a *Wizard*.' I want to know how, if a user were to click on *Wizard* it would change so that other options were shown. So *Wizard* would change to, *fairy*, *frog*, etc. I want these choices to be temporary until the user has come to that they want to be. Also, I would like to know how to make the code for the choice to continue on with the story, after coming to their conclusion.

Thank you so much

2 Answers

0 votes
by (23.6k points)

If I understand correctly you want something like the following.

Put this into your StoryInit passage:

<<set $allClasses to ["wizard", "fairy", "frog"]>>
<<set $current to 0>>

This into a passage with the tag "widget":

<<widget "class">><<nobr>>

<<linkreplace "$allClasses[$current]">>
	<<set $current++>>
	<<if def $allClasses[$current]>>
		<<set $current to 0>>


And this into the passage where you want the text to appear:

You are a <<class>>.

No need for any special code to make the choice final. Just have a regular link/button somewhere linking to the next passage. Whatever the player has chosen last will remain chosen.

0 votes
by (8.9k points)

I think this Twine Cookbook code will do exactly what you need.

This site has been placed in read-only mode. Please use the Interactive Fiction Community Forum instead.