Variables that will not change

Hi heroes, 

I'm struggling with two variables that for some reason won't change by the triggers I have set up. The first variable "Flik_VadBygger" is set to true when the states of 6 objects are visited on a layer. It does change to true if I set it to change if the user clicks 1 of the objects but not when all 6 are visited as it is supposed to be.  

The second variabel is also tricky. It's called "Flik_begrepp". It is set to change to true when the 2 objects on the layer have status "besokt". But a problem could be that these 2 objects cannot have status "besokt" at the same time...

Any idea of how I should set the two triggers to change when all the objects on each layer have been visited? 

Thankful for your assistance, 

Maria

 

9 Replies
Walt Hamilton

I think that you are finding out that while it is very alluring, the concept of "When XXX is state of ..." doesn't work consistently. Sometimes, if the timing is right, it does, but too often the results are exactly what you are experiencing. The solution is to use "state of XX is ..." ONLY in the condition part of a trigger.

You say, "The first variable "Flik_VadBygger" is set to true when the states of 6 objects are visited on a layer. It does change to true if I set it to change if the user clicks 1 of the objects but not when all 6 are visited as it is supposed to be. ", and along with the problem, you give the answer.

The trigger is "Adjust variable Flik_VadBygger to True when user clicks Object1 on Condition Object 2 state == Visited AND Object3 state == Visited etc. Each object needs the trigger to set the variable if all the others have been visited. Of course, this assumes that you are allowing the objects to be clicked in any order, have given each object a Visited state, and have not written triggers to set the objects to visited state when you click the objects.

The second variabel is also tricky. It's called "Flik_begrepp". It is set to change to true when the 2 objects on the layer have status "besokt". But a problem could be that these 2 objects cannot have status "besokt" at the same time...

This problem is different, but no more difficult. Again, do not trust the state. As you have pointed out, it is impossible for it to work. Create two T/F variables, one for each object. Create a trigger for each object that adjusts its variable to True when clicked. create a second trigger for each object that adjusts Flik_begrepp to True when user clicks Object1 if ObjectVariable is True.

Maria Jonsson

Hi Walt and thank you sooo much for a great description. It works perfect now thanks to you. But  it is annoying that we can't trust states. I have used these kind of set ups before without having to add variables and triggers for each object just by using the states and triggers without any problems.  This way every slide takes much longer to build. It must have happened something in latest versions of SL. 

Have a great weekend!

Ashley Terwilliger

Hi Maria,

Thanks for reaching out and sharing your file! 

I was playing around with your file and tested on a new file as well. It seems that the variable didn't change after adding the 5th trigger to change the state of your text boxes to normal when the user clicked the other object. I tested removing each of those triggers and once I got below 5 the variable was set as I expected. 

I know variables/states can have some odd behavior if you're applying triggers to change the state versus allowing the states to change based on the built-in ways that states behave, but it doesn't seem that's what's happening in this copy. I'm going to share it with our team as a possible bug, so I'm glad that Walt's workaround will help you in the meantime. 

You mentioned creating a similar set up prior to the latest version - are you using Update 15? Do you remember what update prior it worked in? 

Maria Jonsson

Hi Ashley :-)

Thanks for testing this. Yes I have been using the latest version of SL3 Update 3.3.15007.0. during this project. I really don't know what version I used when this set up was working fine, it was about 5 months ago. 

Unfortunately this work around was far too time consuming because of all the objects I had to make all those triggers for, so I decided to rebuild the course. I also failed in making the next buttons (my own) activated after the user had clicked on each object (due to the trigger problem). 

I would be happy if your team could find any reason to this behavior. 

Otherwise, what is the right way of using states, triggers and variables in order to be assure that they will function smoothly? 

Best regards

Maria

Walt Hamilton

Ashley,

Since SL 2 was new, i have known that When State of XXX is ... does not work because of timing issues. I have a file a user posted in 2015 where she had 5 buttons,  and wanted the trigger to execute if 4 of them were in a certain state. If worked if she listed the first four buttons, but if she listed 1, 2, 3, and 5 it didn't work. I have always thought it was related to timing. Now your research shows it is related to the number of objects (which may exceed SL's ability to track, or could be a timing question). Either way, thanks for doing the research that clears up the function/no function threshold on that particular bug.

Further info for the engineers: By timing, I mean when the state of one object changes, Sl lacks the ability to check the state of all the objects quickly enough to fire the trigger reliably. I'm currently leaning toward the too many objects theory.

Ashley Terwilliger

Hi Maria and Walt,

This example is definitely unusual, as it's strictly the trigger to adjust the text box when the user clicks on the object that is causing it. The states of the objects are working fine to adjust the variable in the first trigger.

With that in mind, Maria, did you look at adding in those text boxes to the visited state of each object? That would remove the need for your additional trigger and keep the variable trigger you were using. 

Walt, good insight as well. And, I've always found the issues were connected to a trigger of When X changes as Storyline is looking for the change to happen on that slide, at that moment you've defined. 

Maria Jonsson

Hi Ashley, yes the variable "Vad_bygger" works when I move the text into the object states. Hm.. funny, because I had lots of slides with different kind of objects where I use the states and have had the same type of problem, that the variables not change as supposed. I rebuild the entire course inte more slides and less layers to avoid as much variables as possible. Not as nice design as before but a lot more stable.