Help with simple interaction, best practices example

venturi01 Community Member Posts: 5
I am still getting used to how lectora conditionals and objects work.  All i want to do is hide a prompt after i click 3 buttons.  I have 3 variables that when all 3 are equal to 1.  the prompt hides.   So far i cant get it to work, and i think its because i am not running my actions correctly.  I have attached the file, hopefully someone can help me.  I just need a best practice example to follow so i can understand this.


  • smiller7502
    smiller7502 Community Member Posts: 181
    The basic problem is that nothing was triggering your Hide Prompt action at the top of the title explorer.

    In the attached version, I've made the following changes:
    • Put that action inside a group. While it might seem weird to have a "group" with just one action, it allows triggering the action with a "Run Action Group" action.
    • Added an On Click > Run Action Group action to each of the buttons to run the new group.
    That's all that was strictly necessary to fix the problem, but I made one other change as well: I changed the "Add to Variable" actions to "Set Equal To" actions. This is safer when you just need to know whether a button has been clicked or not, because with an "Add to Variable" action, if the learner clicks the same button a second time, your variable equals 2 and the test fails. With a "Set Equal To" action, it doesn't matter if the learner clicks the button once or 100 times, the variable is still 1.

    One other note: As you get more advanced with Lectora, you may regret naming your variables VAR_Something. You can display the value of a variable on the screen by putting VAR(VariableName) in a text box or message, and having that look like VAR(VAR_QDC) might be confusing; there'd be similar confusion in JavaScript, in which you can pull in a Lectora variable value with a line like var x = VarVariableName, and seeing VarVAR_QDC would kinda make me nuts. Maybe that's just me, though.
  • venturi01
    venturi01 Community Member Posts: 5
    Thank you very much!