Explore the community Forums Lectora Lectora Questions & Answers Variables don't work Reply To: Variables don't work

#368867 Score: 1
Profile photo of Stan Miller
Stan Miller
LUC16 Attendee
wise owl
curious george
friend finder
LUC17 Attendee
38 pts

First, let’s clear up what happens when you add to a variable. I’m assuming the value of i is initially 0. When the action shown in your attachment 2.png fires, the value of i becomes 7, not 07. If that same action fires again, the value becomes 14; it’s adding as in math, not adding as in extending.


Knowing that, you might be tempted to change your condition to if i >= 7, but that won’t give you the result you want either — because if button 3, for instance, adds 3 to the variable, I could mouse over button 3 three times,  the variable would equal 9, and the test would be true.

The approach that might be easiest to understand is to create a separate variable for each button (button1, button2, etc.) and set the initial value to 0 or False for each variable. On the mouse-over action for each button, change the corresponding variable to 1 or True (using “Set Equal To”, not “Add to Variable”), and make the condition for showing the Next button button1 = 1, button2 = 1, button3 = 1, etc., and all conditions must be true.


This post has received 1 vote up.