button that only works twice (SC 2.6.2, Twine 2)

16 views
Skip to first unread message

eUba25

unread,
Jul 6, 2016, 10:10:46 AM7/6/16
to Tweecode / Twine
Hey everybody!

For an educational game I need a button, which triggers an audio, that only works twice, e.g. says "listen", user clicks and hears audio once, button text changes to "listen again", user clicks and listens again, button disappears.

I tried this:

<<set _counter to 2>>
<span id="btn"><<button "listen!">>
	<<audio test play>>
	<<set _counter-->>
	<<if _counter gt 0>>
		<<replace "#btn">>
			<<button "listen again">>
				<<audio test play>>
			<</button>>
		<</replace>>
	<<else>>
		<<replace "#btn">>No more tries!<</replace>>
	<</if>>
<</button>></span>


but it doesn't continue after the second click. Any ideas?

best, euba


Reply all
Reply to author
Forward
0 new messages