Forum Discussion
Tracking the order of buttons being pushed
Hi Greg, I'm sure there are a few ways to skin this cat, but one way I can think of is to have four variables, they could be type NUMBER and initialised as 0 (zero). For example:
step1
step2
step3
step4
In this example, each button represents a step in making and eating a boiled egg:
Button 1: "add oil to the pan"
Button 2: "heat the pan"
Button 3: "crack egg into pan"
Button 4: "cook egg"
Then, each of those steps, will be assigned a step order. So, if I select "Cook egg", this will assign a value of "4" to the current step, by checking each of the variables step1, step2, step3, step4 by using the following logic:
On click button "cook egg"
Set variable step1 = 4 if step1 is equal to 0 (zero)
Set variable step2 = 4 if step2 is equal to 0 (zero)
Set variable step3 = 4 if step3 is equal to 0 (zero)
Set variable step4 = 4 if step4 is equal to 0 (zero)
Set state "cook egg" disabled
Each of your buttons would have the same set of triggers, but just updating the number, for example:
On click button "add oil to the pan"
Set variable step1 = 1 if step1 is equal to 0 (zero)
Set variable step2 = 1 if step2 is equal to 0 (zero)
Set variable step3 = 1 if step3 is equal to 0 (zero)
Set variable step4 = 1 if step4 is equal to 0 (zero)
Set state "add oil to pan" disabled
Ensure that you set the button to disabled when it has been clicked so the user cannot assign the same number to multiple steps
Then, once the user has selected all of the buttons, in the order they chose, you would just need to check the value of the variables and ensure that step1 is equal to 1 and step2 is equal to 2 etc. This could be done using a Submit button that is enabled once Button 1 to 4 is disabled.
Cheers,
Sam