Variables don't work

pkulpinski3055 Community Member Posts: 7

I need to stop users from proceeding to the next page until they explore all content on the current page. I have seven buttons with tooltips hiden in them, so user has to enter all of them with mouse cursor and until he does it, he can't proceed to the next page.

I created action for each of the seven buttons:

on mouse enter - modify variable called "i" - add to variable value (first button adds value 1, second button adds value 2 etc.) (I attach screenshot of the action).

Then I created two actions for button "Next". One action is "display a message" IF variable "i" does not contain 1, variable "i" does not contain 2, varibale "i" does not containt 3 etc. (any condition can be true). The other action is go to next page IF variable "i" contains 1, variable "i" contains 2 etc. (all conditions must be true).

The first action works well, but the other one - doesn't. Even when I enter all the buttons with mouse, I still cannot proceed to next page.

Maybe someone can help me with it? I've only used Lectora for few days, so maybe I'm making some rookie mistake, that I'm not aware of :)

PS. I attach screenshots of actions and conditions.


  • smiller7502
    smiller7502 Community Member Posts: 181
    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.

  • pkulpinski3055
    pkulpinski3055 Community Member Posts: 7
    All clear now! I got it wrong from the beggining. I read this post on blog (, that variables are like containers, so adding to variable means puting something into it, so I thought that if I add to variable 1, 2 and 3, in the variable there will be 1, 2 and 3, and it's 6! Life's gonna be much easier now :) Thank you!