Adding numbers to a variable - only once

Apr 29, 2016

Hi everybody, I want to measure user progress in such a way that the user gets a certain number of points for visiting a slide. But I want the number of points to be assigned only once. Here's what I'm doing:

1. User at slide 1

2. User advances to slide 2

3. At slide 2, add +10 to variable "progress" when timeline starts (under slide properties, when revisiting = "Resume saved state")

4. Return to slide 1

5. Revisit slide 2... And here is where I expect that because "Resume saved state" is activated, there should be no more points added...

Anybody know what I'm doing wrong? How can I set a variable to add something just once, regardless of how many times the slide is viewed? (and without having to set the condition to adding, when another second variable is true/false)

Here's an example file.

4 Replies
Walt Hamilton

The trigger to add will fire every time the slide starts, without regard to what state you return to.

You need to add only if the slide has not been visited. Cary's sample does this using a shape to track visitation, but you could do the same with a variable. Whichever method you choose, remember that you need a unique shape or variable for each slide, and a trigger on each slide to set it.

Ed Bayo

Guys, thanks so much for the replies. 

@Walt: the idea with the shape state worked best. I just had a few more questions:

Question 1: when placing the trigger directly into an object (instead of the timeline), it doesn't seem to work. Is there an individual / invisible timeline for shapes? It would make my life easier if I could just place the triggers into an object and then copy/paste the object with all triggers inside over several slides at once...

Question 2: when using the default state "Visited", I don't get the effect I need (adding +10 to a variable, but just once). I had to create a new state called "BeenHere". Anybody know why? Is there anything special within the default "Visited" state that other new states don't have?

Thanks for your comments!

Walt Hamilton

Question 1: The only timeline on objects that is available to triggers is When timeline starts and When timeline ends. When an object appears or disappears on a timeline, it can also trigger another action. For example, this trigger changes the state of the rectangle when the Pause button disappears:

 

When the Pause button disappears at 2 sec, the rectangle changes from hidden to normal.

Question 2: Yes, there is something special about all the built-in states. They have triggers that you can't see or change.  Visited is one of the most unpredictable, as to how long it will last. It is most likely to get lost if you click it, then go to other slides, or other branches. The advantage of custom states or variables is that nothing else in the story changes them, so you can know for sure when they will change. The built-in states have their own rules for when they change, which may or may not be what you expect.

 

 

 

This discussion is closed. You can start a new discussion or contact Articulate Support.