im using Twine 2.0 with sugarcube 2 and here's the scenario
im using interactive button to open special menu option in my game and its need 5 and 10 success chance to open it.
everytime it's clicked, the button will generate number 1 , 2 , 3 ,4 , 5 by random. if its generate 2 or 3 it will be failed and the success rate will be back to 0 but if its generate any number except 2 or 3 its success.
and i want every click will have 10 seconds cooldown so anyone cant click the button with brute force LOL
everything is run as planned but how do i refresh the cooldown after the button has been click ? here's the code
Menu option one <span id="suc5">(5 success)</span>
Menu option two <span id="suc10">(10 success)</span>
Success: <<set $rate to 0>><span id="success-rate">$rate</span>
<<set $bReady to false>>
<<set $cDown to 10>><span id="countdown">$cDown</span> seconds remaining!
<span id="statusQ"></span>
<<button "the button">>
<<if $bReady is true>>
<<set $randPoint to random(5)>>
<<if $randPoint eq 2 or $randPoint eq 3>>
<<set $rate to 0>>
<<else>>
<<set $rate++>>
<</if>>
<<replace "#success-rate">>$rate<</replace>>
<<if $rate eq 5>>
<<replace "#suc5">> <a data-passage="Hell" class="karma-link">Open</a><</replace>>
<<elseif $rate eq 10>>
<<replace "#suc10">> <a data-passage="Heaven" class="karma-link">Open</a><</replace>>
<</if>>
<<else>>
<<replace "#statusQ">>not yet!!<</replace>>
<</if>>
<</button>>
<<set $command to "<<timed 1s>>">>
<<for $i to 0; $i lt $cDown; $i++>>
<<set $command += "<<set $cDown -= 1>><<replace \"#countdown\">>$cDown<</replace>><<set $bReady to false>><<next>>">>
<</for>>
<<set $command += "<<replace \"#countdown\">>Ready<</replace>><<replace \"#statusQ\">><</replace>><<set $bReady to true>><</timed>>">>
<<print $command>>
any help will be appreciated, sorry for my bad english
Comments
Anyway, the following should be more or less what you wanted: You'll note that I made it disable the button, so that it cannot be clicked on, and moved the timer display nearer to the button, to make it look a bit nicer.