Forum Discussion

KimBettendorf's avatar
KimBettendorf
Community Member
2 years ago

Object Trigger + Condition Not Performing as Expected

In a course where learners can click a button, swipe, or use the arrow keys to move forward/backward, I don't want them to be able to move forward until after the audio finishes.

I created a variable called AudioFinished and set it to = true when the media completes. Then set conditional object/keypress triggers to jump to next slide when AudioFinished variable = true.

Except it's not doing what I thought it would. When the Next button appears, you can still click it to move forward before the audio is finished. I feel like I'm missing something obvious, but can't quite figure it out. 

  • Make sure AudioFinished isn't set to default to True, and isn't being used on a previous slide. Otherwise, you'll have to attach your .story file here, so someone can help you look for the problem.

    • KimBettendorf's avatar
      KimBettendorf
      Community Member

      A ha! I knew it would be something obvious. Thank you. It was the default value of the variable.

    • KimBettendorf's avatar
      KimBettendorf
      Community Member

      Quick follow up question for you, when you say "and isn't used on a previous slide" does that mean if I have audio on each slide that needs this same sort of rule, I would need a new variable for that slide?

      For example, if it has 50 slides, then I would need AudioFinished2, AudioFinished3... AudioFinished50 for each slide containing audio?

      If the answer is yes (yikes), is there a more generic trigger I could use to indicate that any audio on a given slide needs to finish before allowing the learner to continue?

  • It might be that you will need a unique variable for each audio, but I can't tell you that without seeing the project.

    Before I created the variables and the triggers, I would try using a Master layout. Duplicate the layout you are using now to create a custom layout with two triggers:

    "Set variable AudioFinished to False when timeline starts on this slide." and "set conditional object/keypress triggers to jump to next slide when AudioFinished variable = true."

    Use that layout for each slide that has an audio, and what you are using now for those who don't. You will still need to have a trigger to set AudioFinished to true on each slide when the audio ends. (Probably. Maybe if you give each audio the exact same name, you can use a trigger in the master that initiates when the media ends. To me, it is easier to copy/paste the triggers than it would be to rename all the audio files. And the headache of keeping them separate from 50 others with the same name - I wouldn't even want to try.)

    Experiment with a few slides to make sure it works. You probably will have to go to each slide, right click it, and change the layout.