Forum Discussion

LauraWhitton's avatar
LauraWhitton
Community Member
3 years ago

Help with States dependent on Variables

Hi,

I'm working on a quick activity to incorporate into an ILT. All I'm looking to do is have the characters on the main slide change their state to "Happy" once the appropriate slide is accessed. I've set up variables contingent upon them clicking a button from within those slides. I cannot get their states to change... any thoughts?

I didn't want to use "Visited" because I didn't like the flash of the new state showing before the new slide was accessed - silly, I know. 

Open to your suggestions!

  • Hi, Laura.

    Thank you for sharing your .story file!

    When you use the trigger "When the variable changes", that variable has to change on the same slide as the trigger, which is not the case with your Introduction slide. Instead, I suggest changing the trigger to "When the timeline starts if the variable is True".

    You also need to check the order of triggers on each one of your slides. The trigger that changes the variable to True needs to happen before the user jumps back to the initial slide, or it won't execute:

    I'm attaching the edited .story file with my suggestions. Let me know if that works!

  • MichaelHinze's avatar
    MichaelHinze
    Community Member

    The "When variable changes" option in a trigger only applies to the slide where the change actually happens. In you case that's the scenario slide, NOT the Intro slide. You need to change the triggers on the Intro slide to Change state of Character xyz to Happy WHEN THE TIMELINE STARTS ON THIS SLIDE.

    Also on the scenario slide, you need to reverse the order of trigger on the menu button so that the variables are set BEFORE you jump back to the Intro. See attached where I fixed the setup for Character 3.

  • LauraWhitton's avatar
    LauraWhitton
    Community Member

    Thank you both! I appreciate you. I'm newer to variables, so this is so helpful :) 

  • Hi, Laura.

    I didn't notice that happening with my edited version above, but I can see it in your published version. 

    My suggestion is to recreate that state. You can do it by clicking the character, going to Edit states, and selecting the Happy state. Copy everything (Ctrl+C) and paste it (CTRL+V) in that same state.

    Let me know if that works!