It looks like you're new here. If you want to get involved, click one of these buttons!
(set: $chips to 10)
There are still (link: "$chips")[(set: $chips to it -1)] chips left
... so when the number is clicked, the variable decreases by one. The problem is that I want the clicked number to show chips left after each bite. And so, idiotic recursive nesting problem arises, i.e:
(set: $chips to 10)
There are still (link: "$chips")[(set: $chips to it -1)(link: "$chips")[(set: $chips to it -1)]] chips left
... with that code, the user can click the "10", then a "9" appears in its place. But to be able to reach 0, I should nest that 9 more times within itself! crazy
Comments
Thanks again.
You can do what you want with two variables, a hook, and a (live:) macro: Code breakdown:
1. The amount hook:
We use a hook so we can replace its contents with a new copy of the (link:) macro each time the link is clicked. 2. The (live:) macro:
We check every 1/50th of a second to first see if all the chips are gone, if they are we display a zero and stop the (live:) macro, otherwise we check the $selected variable to see if the links was clicked. If it was clicked we reset the hooks contents so it contains the (link:) macro again and reset the $selected variable. You may want to change how often the (live:) macro runs by making the 20ms a large value.