Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

[Sugarcube] Dialogue options, saving passage text..

edited August 2015 in Help! with 2.0
I was messing around trying to find a way to have a lot of options in one passage, with new text appearing and the click options disappearing. I also wanted to be able to go back to previous passages using an index on the sidebar and have the same text appear exactly as it did when you left.

I figured out a way to do it but it's kind of ridiculous. My question is, is there a better way to do this?
<<if visited("Passage 1") > 1>>
<<print $part0>>
<<print $part1>>
<<print $part2>>
<<print $part3>>
\
<<else>>\
<<set $part0 = "Hello passage 1.  <br> Choose an option.">>\
<<print $part0>>
<br>
<span id="Options1"> 
<<click "Option1">>
<<set $part1 = "I pick option 1! <br><br> You see Passage 1 Part 1 Option 1.  <br><br>Which option do you pick now?"
>>\
<<replace "#Options1">><<print $part1>>
<br>
		<span id="Options21">\
		<<click "Option1">>
		<<set $part2 = "Option 1 again!<br><br> You see Passage 1 Part 2 Option 1!">>\
		<<replace "#Options21">><<print $part2>>
<br>
			<span id="Options31">\
			<<click "Option1">>
			<<set $part3 = "Option 1 again!<br><br>You see Passage 1 Part 3 Option 1!">>\
			<<replace "#Options31">><<print $part3>>
                        <</replace>><</click>>\
            
			<<click "Option2">>
			<<set $part3 = "This time, option 2!<br><br>You see Passage 1 Part 3 Option 2!">>\
			<<replace "#Options31">><<print $part3>>
                        <</replace>><</click>></span>\
\
		<</replace>><</click>>\

		<<click "Option2">>
		<<set $part2 = "You see Passage 1 Part 2 Option 2!">>\
		<<replace "#Options21">><<print $part2>>
<br>
			<span id="Options32">\
			<<click "Option1">>
			<<set $part3 = "This time, option 1!<br><br>You see Passage 1 Part 3 Option 3!">>\
			<<replace "#Options32">><<print $part3>>
                        <</replace>><</click>>\
            
			<<click "Option2">>
			<<set $part3 = "This time, option 2!<br><br>You see Passage 1 Part 3 Option 4!">>\
			<<replace "#Options32">><<print $part3>>
                        <</replace>><</click>></span>\
\
		<</replace>><</click>></span>\
\
<</replace>><</click>>\

<<click "Option2">>
<<set $part1 = "You see Passage 1 Part 1 Option 2!">>\
<<replace "#Options1">><<print $part1>>
<br>
		<span id="Options22">\
		<<click "Option1">>
		<<set $part2 = "Option 1 again<br><br>You see Passage 1 Part 2 Option 3!">>\
		<<replace "#Options22">><<print $part2>>
<br>
			<span id="Options33">\
			<<click "Option1">>
			<<set $part3 = "Option 1 again!<br><br>You see Passage 1 Part 3 Option 5!">>\
			<<replace "#Options33">><<print $part3>>
                        <</replace>><</click>>\
            
			<<click "Option2">>
			<<set $part3 = "This time, option 2!<br><br>You see Passage 1 Part 3 Option 6!">>\
			<<replace "#Options33">><<print $part3>>
                        <</replace>><</click>></span>\
\
		<</replace>><</click>>\

		<<click "Option2">>
		<<set $part2 = "You see Passage 1 Part 2 Option 4!">>\
		<<replace "#Options22">><<print $part2>>

			<span id="Options34">\
			<<click "Option1">>
			<<set $part3 = "You see Passage 1 Part 3 Option 7!">>\
			<<replace "#Options34">><<print $part3>>
                        <</replace>><</click>>\
            
			<<click "Option2">>
			<<set $part3 = "You see Passage 1 Part 3 Option 8!">>\
			<<replace "#Options34">><<print $part3>>
                        <</replace>><</click>></span>\
\
		<</replace>><</click>></span>\
\
<</replace>><</click>></span>\

<<endif>>

[[Passage 2]]

So basically you click Option 1 or Option 2 and those links disappear, replaced by the next bit. It continues until you have 3 Options selected. When you move to Passage 2 and come back, it resets. But with the if statement at the beginning that doesn't happen- the saved variables show up. But before I go doing this 50 times I want to know if there's a better way, because I think there has to be. Is there a way to make a macro or something?
Sign In or Register to comment.