Simple Variable

sgroom
sgroom Community Member Posts: 13 ♪ Opening Act ♪
Hi there, I am new to using variables but need one to achieve a desired effect.



Basically, I have three tabs of information on a page that I would like learners to click. Once they clicked and read all three, I want a text box to appear with further information - not until all three tabs (buttons) have been clicked though.



I've looked on line and seen variables for something similar (activating a next button etc) but not explained in a way that I can do it step by step.



Could anyone help please?



Thanks for reading.

Comments

  • timk
    timk Community Member Posts: 1,239 ✭ Legend ✭
    Use the variable manager to create a variable:



    Name: buttons_clicked (You can choose another name if you like)

    Initial value: 0



    Add an action to each of your buttons:



    1. First Button

    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: a



    Now the variable will contain "a" if the first button has been clicked.



    2. Second Button

    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: b



    Now the variable will contain "b" if the second button has been clicked.



    3. Third Button



    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: c



    Now the variable will contain "c" if the third button has been clicked.



    Add another action to each button.



    On: Click

    Action: Show

    Target: Additional_Texfield



    Condition:

    Only if ("All conditions must but true")

    buttons_clicked Contains a

    buttons_clicked Contains b

    buttons_clicked Contains c



    Add an action on page level:

    On: Show

    Action: Modify variable

    Target: buttons_clicked

    Type: Set as empty



    Only to reset the variable



    Tim
  • sgroom
    sgroom Community Member Posts: 13 ♪ Opening Act ♪
    Wow Tim, that's exactly what I was looking for, even a 5 year old could follow that. It worked perfectly - you are a star.



    Vielen dank

    Steve.
  • kellykungfu
    kellykungfu Community Member Posts: 83
    Steve,



    Another consideration especially if your using SCORM 1.2 and counting precious character space (SCORM 1.2 has a 4k limit is to add a condition to each of the actions on the buttons.



    For example on the first button:



    1. First Button

    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: a

    Condition:Variable=

    Relationship= Does Not Contain

    Value=a ***Please note the a changes to b for the next button, ect***





    If you don't do the condition, a learner can basically click all three buttons repeatedly and the LMS would store each of those button clicks and eventually run out of space.



    Hopefully this helps and makes sense :)





    -kelly















    @timk 61646 wrote:
    Use the variable manager to create a variable:



    Name: buttons_clicked (You can choose another name if you like)

    Initial value: 0



    Add an action to each of your buttons:



    1. First Button

    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: a



    Now the variable will contain "a" if the first button has been clicked.



    2. Second Button

    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: b



    Now the variable will contain "b" if the second button has been clicked.



    3. Third Button



    On: Click

    Action: Modify variable

    Target: buttons_clicked

    Type: Add to variable

    Value: c



    Now the variable will contain "c" if the third button has been clicked.



    Add another action to each button.



    On: Click

    Action: Show

    Target: Additional_Texfield



    Condition:

    Only if ("All conditions must but true")

    buttons_clicked Contains a

    buttons_clicked Contains b

    buttons_clicked Contains c



    Add an action on page level:

    On: Show

    Action: Modify variable

    Target: buttons_clicked

    Type: Set as empty



    Only to reset the variable



    Tim
  • sgroom
    sgroom Community Member Posts: 13 ♪ Opening Act ♪
    Thanks kelly, that's really interesting. I'll give that a go at work tomorrow.
  • benpitman
    benpitman Community Member Posts: 763
    Kelly is right but space does not really matter unless you are retaining the variable from one session to the next. If so, you are limited to 4K including the name of the variable for each you retain.