Number Variables
Jan 30, 2017
By
Amy Burton
Hi all,
Is there a way to stop a number variable going past a certain number?
I have a 'click and find' slide where I have a variable that tells the user how many parts are left to find. When they click on the hot spot, it subtracts one from the variable number. If they click the same part twice, after finding all three, it will go to -1 where I'd like it to stop at 0.
Or.. is there a way of only letting the hotspot minus one from the total number once?
4 Replies
Hi Amy,
Sure, there is a couple of ways that you can do this.
To do exactly what you asked for in your description, simply add a condition to your trigger where "Your_Variable >= Greater than or equal to 0.00"
To set this up, click the Show Condition button at the bottom of the trigger wizard and then click the little plus sign to the right to add a condition. Set it up similar to the example below.
It might be better, though, to allow the user to click each hotspot only once.
If you add a disabled state to your hotspot, you can then add a trigger to disable the hotspot when the user clicks it, preventing a second click. Take a look here to see how you can add states.
Once you've added a disabled state, just add another trigger that sets the state to disabled when the user clicks the hot spot.
Hello Dave,
That's great. Thank you for taking the time to reply.
However, hotspots can't have states so I have changed them to shapes as a work around!
Thank you again! :D
I would add an extra variable for each object, so you know exactly which object was already clicked:
Object1_clicked, default value FALSE
Then you upgrade your original trigger (where you subtract the value), with a condition using this variable
"on condition: variable Object_1_clicked = FALSE"
And then you add another trigger to change the value to TRUE once user clicks this object (make sure, this trigger is AFTER the trigger above)
Adjust variable Object_1_clicked = TRUE when user clicks Object 1
I nearly always use shapes as my hotspots. I find that is more flexible that the built in hotspots. Sorry about the confusion.
This post was removed by the author
This discussion is closed. You can start a new discussion or contact Articulate Support.