I might write the second example as
on click do t:"|" split "5|4|3|2|1|Boom!" me.text:t[(count t)%1+sum(me.text=t)*keys t] end
Using the mod operator (%), taking advantage that for a list x, "keys x" is equivalent to "range count x", and that a failure to find a match for the current button text is harmlessly equivalent to matching the first option.