Working with Varibles in Lectora

lkeilert5880 Community Member Posts: 2
Hello, everyone.

can anyone here explain to me how to work with the variable in Lectora?
I'm just new to using the program and I can't figure out how to use it.

For example:
I have added a link to graphics so that you can click on them and a pop-up window will open. Only after about 10 seconds if you have not clicked on it, a signal arrow should appear which flashes in e. g. one second time. Is it possible to cover this with a variable cover?

Thank you very much!


  • timk
    timk Community Member Posts: 1,245 ✭ Legend ✭
    Hi Lukas,

    welcome to the community.

    Variables can always be used when you want to know or remember what a user has done or what has happened on the page. You can create a variable, e.g. "linkclicked", initial value = 0. Add an action to the link:

    On: Click
    Action: Modify variable
    Target: linkclicked
    Type: Set equal to
    Value: 1

    In the beginning the variable equals 0, and you'll know the link has not yet been clicked as clicking the link sets the variable value equal to 1. The other way round: If the variable is equal to 1 you know the link has been clicked.

    Similar with making an object blink: You can use a variable to count the number of times an image has blinked, variable "blinks", initial value 0. Make the arrow initially invisible. Use any action to show it.

    Add actions to the arrow:

    On: Show
    Action: Hide
    Target: This object
    Delay: 1 second

    On: Show
    Action: Modify variable
    Target: blinks
    Type: Add to variable
    Value: 1

    In the beginning "blinks" equals 0. Each time the image is shown 1 is added and the image is hidden again after 1 second.

    On: Hide
    Action: Show
    Target: This object
    Delay: 1 second

    To make the blinking stop after a certain number of times, add a condition to the action:

    Only if "blinks" less than 3. This way the arrow will be shown and hidden again 3 times. When the image has been shown for the 3rd time, "blinks" will be equal to 3 and the show action will not be executed again.