I've gotten stuck at wanting to create a clickable, repeatable countdown timer in my Twine Harlowe 2.0 project.
To clarify, I'd like to have a link in a passage that would start a countdown timer in that passage, that, when reaching 0, would allow me to click that same link again to start the same timer again without having to leave the passage.
I've started by using the following:
(set: $counter to 10)
You have |amount>[$counter] seconds left!
(live: 1s)[
(set: $counter to it - 1)
(if: $counter is 0)[(stop:)]
(replace: ?amount)[$counter]
]
to create a perfect, working countdown timer; but I don't understand how to make it start again with the predetermined value of 10 seconds without having to leave the passage.
I've experimented with the (link-repeat:) macro (alone and combined with a (display:) macro to pull the timer from a different passage after I click the link), I've tried to use a (replace:) macro to no avail, and I've tried anything else I can think of with my limited coding knowledge, but I am just stuck on making it clickable and repeatable. Hopefully I'm making sense; and any help in the matter would be deeply appreciated because I have no idea where to go from here.
Thank you!