Number Variable

Hi,

How do I implement number variable in Lectora?

Example as below:

Regards

Malvika

Discussion (18)

You've done it wrong, you don't have a button anywhere on the item. Your activity images have an OnShowModVar action. Also what is your end plan? Show a total point score? Show a score per item?

See the screenshot below as to how I would have handled this request.

BananaBTN-dedicatedVariable

  • On mouse click: modify _Banana variable set equal to 2.

BananaBTN-oneVariable

  • On mouse click: modify _totalHealthyScore variable by adding 2 to the current score.

Please take a look at my examples I posted in a preview response that will show you exactly how to do it - with an image button or transparent button.

Noted Carl.

I added action 'Modify Variable' with Add/Subtract Variable but it isn't doing any action for me.

Regards

Malvika

Yep. So you'll want to use the BananaBTN-oneVariable solution I provided above.

Make your four images buttons or at least transparent buttons. See screenshots below.

New variable:

Button for healthy options:

Button for unhealthy options:

Lectora doesn't have variable types.

If you assign a number to a variable, it's a number variable. You can use the Actions for numbers (say, "Add 1 to myVariable") and test for values ("If myVariable is less than 2, move the photo off the screen") and it will work.

Note: I am not using actual Action syntax above.

This is the end result I am trying to achieve - https://veronicab.com.au/wp/wp-content/uploads/articulate_uploads/300-number-variables/story.html

@andrew-robertson - I tried it without transparent button. (saw your message later).

Malvika, you have two buttons for each graphic. Only the top one is triggered by mouse clicks, so the one under it, which modifies _TotalHealthy, never triggers. You can put both actions on a single button, instead of using two buttons.

@andrew-robertson - I have added the suggested actions. There seems to be some miss.

Score is not reflecting in total column, nor it reflects when I click on banana or other elements.

Regards

Malvika

@carlfink - I tried having two actions under one button.

@carlfink - I tried having two actions under one button.

And what happened when you tried it?

It doesn't seem to reflect any count of banana or burger?

File as attached.

I tried this link - https://www.youtube.com/watch?v=QEu1HgXhlaQ but not sure about 'Change Content' action.

It doesn't seem to work.

See attached.

Any thoughts on how can I make this work?

Any thoughts on how can I make this work?

@mmalhotra-9265 did this work for you?

Yes Andrew, it worked for me. Your file became my bible, and helped.

Thank you.