Forum Discussion

ChrisWalkerBH's avatar
ChrisWalkerBH
Community Member
5 days ago
Solved

Numeric variable trigger is not affecting state of Next button

I'm creating a Storyline activity in which the learner needs to select exactly eight items from a list of 15 in order to move forward. In order to accomplish this, I created the following triggers and variables:

  • I set the Next button to the Hidden state at the start of the slide's timeline.
  • I created a variable that adds 1 when an item is clicked while Normal or Down and subtracts 1 when an item is clicked while Selected.
    • I originally tried having the variable add 1 when an item had the Selected state rather than making it based on the click, but that didn't work either.
  • I deleted the Hover state to prevent interference.
  • I set a Change Variable trigger to change the Next button's state to Normal when the variable is equal to eight.

The Next button never appears no matter how many items I select or deselect items. I even created a custom Continue button with the same triggers to see if it was simply built-in button weirdness. It did not work either. I feel like I must have the variables set up incorrectly.

Each of the items on the slide has an Object Trigger like "Object_BCanteen."

I'm not entirely sure how to attach a Storyline file to a post here, but I'd be happy to do so if someone can enlighten me.

Thanks,

Chris

  • Thanks for sharing the screenshot.

    Without seeing the full slide, the first thing I'd suggest is to add your reference variable for %Items_Castaway% to your slide to see if it's counting correctly.

    But the thing that stands out the most is the trigger order and how you're counting the selected items. Storyline's Selected state should work because it automatically toggles between Normal and Selected. Here's what I'd try:

    I attached a quick .story file you can look at to see if it helps.

10 Replies

  • CarlFink1's avatar
    CarlFink1
    Community Member

    To attach a file, click the paper clip icon, which might be hidden behind a three-dots menu:

     

    • ChrisWalkerBH's avatar
      ChrisWalkerBH
      Community Member

      Either my company or this site doesn't allow me to attach files because I don't have that option when I click the three dots. Thanks for the speedy response, though!

  • Thanks for sharing the screenshot.

    Without seeing the full slide, the first thing I'd suggest is to add your reference variable for %Items_Castaway% to your slide to see if it's counting correctly.

    But the thing that stands out the most is the trigger order and how you're counting the selected items. Storyline's Selected state should work because it automatically toggles between Normal and Selected. Here's what I'd try:

    I attached a quick .story file you can look at to see if it helps.

    • ChrisWalkerBH's avatar
      ChrisWalkerBH
      Community Member

      This worked like a charm! I don't fully understand why, though.

      I originally had my "Add value 1" trigger set up like you suggested and I get why that works.

      Where I'm lost is the "Subtract value 1" trigger. Wouldn't this subtract 1 on the user's initial click of an item (while the item is in a Normal state)? Or does the trigger order literally go User clicks Selected item > item changes state from Selected to Normal > Storyline subtracts 1 because item is no longer in the Selected state?

      Thanks for the help and especially the file you posted!

      • AndrewBlemings-'s avatar
        AndrewBlemings-
        Community Member

        The default state-toggle between Selected and Normal happens after triggers are run, best I've ever seen. The triggers can be easier to understand if the three parts are rearranged.

        If you check the Group tick-box in the Triggers pane, Storyline will rephrase the trigger as "When the user clicks Canteen, Subtract value 1 from Items_Castaway If the state of Canteen is not equal to Selected."

        I personally like to internally frame it as "If the state of Canteen is not equal to Selected when the user clicks [it], subtract one from Items_Castaway.

        That may better highlight that the action is only performed if the button is a certain state the moment it was clicked. If the button is allowed to change to the Selected state, then it would no longer be the state it was when it was clicked.

  • I think it would be better to redo this, add selected state if you don't have one.

    Create a layer:

    Add these triggers

    reset your variable to 0
    change state of next to disabled
    Add one if buttion is selected... (15 times)
    Change state of next to normal if your variable equal to 8
    Hide layer this layer


    Add trigger to all buttons to show the layer

  • Adding a reference would help you have very confused state conditions

  • ChrisWalkerBH​: I agree with PhilMayor​. Use an invisible layer to calculate how many buttons are in the Selected state. 

    I'll add a few notes:

    • As DavidAnderson​ mentioned, Storyline automatically toggles between the Normal and Selected state, so you don't need triggers for that. (Here's more info about built-in states.) As Phil mentioned, just add a trigger to each button to show the invisible layer.
    • As David also mentioned, troubleshooting is easier when you show the variable reference in a temporary text box. That lets you see whether the value changes as expected.
    • Have the triggers in the invisible layer run in that order when the timeline starts on the layer. (Note: Another option for hiding the layer would be to make the layer's Timeline as short as possible, and have a trigger that hides the layer when the Timeline ends.)
    • Be sure to set the Slide Layer Properties to "Reset to initial state." 
    • Because you want exactly 8 items selected (no more, no less), add an Else statement to the trigger that changes the state of Next to Normal. The Else statement should change Next to Disabled. That will ensure that if the user clicks another button after Next is enabled, Next will be disabled again. Then they'll have to deselect a button before Next is enabled again.
    • ChrisWalkerBH's avatar
      ChrisWalkerBH
      Community Member

      The use of the variable reference and the Else state were immensely helpful in troubleshooting and improving this slide. Thanks to both you and PhilMayor​!

  • Until a project is posted, hang onto the debugging ability of putting a textbox onscreen with a reference to a variable. If you for instance add %Items_Castaway% to a textbox, the course will replace that with the value of the variable when you preview the content. As you select and deselect buttons, that would better enable you to confirm how the logic is and isn't working. Then when it comes times to publish the final content, just be sure to hide the trigger and textbox.