Explore the community Forums Lectora Lectora Questions & Answers Working with Varibles in Lectora Reply To: Working with Varibles in Lectora

#374056 Score: 0
Profile photo of Tim K
Tim K
friend finder
junior moderator
wise owl
curious george
Group Member
354 pts

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.