How to add counter to track number of attempts on Marbleslides

I want to use this Marbleslides activity.

I am wondering how I can add a counter feature so that my students can see how many tries they used before they finally collected all the stars. For example, slide 2 asks students to change the sign of one number. Students can try changing the +8 to -8 (incorrect), the -2 to +2 (incorrect), the +x to -x (incorrect), and the +0.1 to -0.1 (correct). I want this same slide to show how many tries it took to collect the stars. For the student who made the changes in the same order, I want their screen to show 4 tries.

I do not want the reset button (which resets the equation back to the original) to also reset the number of tries count.

I appreciate the help!

I made a workaround using actions with clickable objects. Currently, it counts every time a “button” is clicked, but that could be changed.

Hat tip to @Daniel_Wekselgreene, who made me aware of this technique.

Hi Mark, thank you for the start! I’ll work with this code to see whether I can make it work for my class. Ideally I’d find a way to add a counter for student changes made manually in the sidebar.