Forum Discussion
Add Variable Count One Time Only
I am adding a variable count for slide layers where the variable is incremented by 1 at the start of the timeline. Is it possible to only have the variable count increment if this is the users first time viewing the given layer?
Action = Adjust Variable
Variable name is Score
Operator = + Add
Value = Value 1
When = Timeline starts
Object = Layer
The goal is to award points for visiting each layer, but I don't want to add points for simply revisiting the same layers.
- MichaelHinzeCommunity Member
Have a look at the attached and see if this setup would work for your project. I use a button's Visited state to determine if a variable should be increased.
- TimBallewCommunity Member
Thanks Michael! Great idea, I think that should do the trick.
- TimBallewCommunity Member
I tried this using one of the content library templates and it works for the first 3 layers, but not the 4th. The triggers are all setup identically, not sure what I am missing here.
Hello Tim,
Thanks for sharing your file so that we could understand what you were describing. I was able to see the same behavior you were reporting, but inconsistently as it did work for me at times.
That being said, grouped items can do that at times. I like to use variables on the layers when the layers are dependent on being viewed.
Check out my solution attached and see if that assists you.
- TimBallewCommunity Member
Thanks Leslie, that did the trick!
However I'm a little confused on what you did. You had the default value for each Step as False, but why did it not continue to increment if you clicked the step multiple times?
I had to add an additional trigger to change the step from False to True after the first click. Then it wouldn't continue to increment, but yours worked without the additional trigger. So I feel like I am missing something or at the very least wasn't as efficient as I could have been.
Thanks Again!
Hi Tim - I used different variables.
So, each step started as false, right?
I'm adding to the score as long as the step is still false, meaning not visited. Notice that trigger order is important here - adjusting the score prior to the layer opening...
Because, the step changes to true (visited) once that timeline starts:
Does that help?
- VictoriaSubl967Community Member
That is fabulous and solved a problem I've had for a long time!
- TimBallewCommunity Member
Ahh I missed the trigger on the layer.
I basically did the same thing, I just set the step = True on the base layer between the add score and show layer triggers.
Thanks, that was very helpful!
Awesome - glad to be able to assist Tim :)
Oh, another tip Tim -
If you're ever looking at a file and trying to track variables (like we just did here), you can click on the number in the variables panel to see where it is being used.
I know that saves me when trying to dive in and understand user files :)
- RachelCrabtr843Community Member
Thanks Michael Hinze for uploading your storyline file. It was useful for my project. I was struggling to create a situation where users were required to hover over info buttons prior to proceeding in the training.
The condition placed on the shape to add1 only if the shape wasn't in a state of visited did the trick to prevent repeated var increases for hovering over the same button.
Thanks!!
- MichaelHinzeCommunity Member
Good to hear the "old stuff" is still useful :-)