Changing States with Variables

Nov 19, 2012

Either I don't see it, or it's just not there, but why can't I have the state of an object change if a variable is true?

26 Replies
Steve Flowers

You can change a state based on many different events. If you want to change a state when an object appears or slide starts IF a variable is true your trigger would need to use the When the Timeline Starts event with a conditional check. See the attached for an illustration of both methods.

Marilyn Bender

I seem to have a similar problem. I have a menu at the start of my course with a button for each of five scenes. I have set the state of each menu buttons to change when it has been visited. However, if the learner starts a scene but doesn't finish it, I want the menu button for that scene to change back to normal instead of showing it has been visited.

I set up variable for each menu item and set the initial value for false. The varible is triggered to change to true when the timeline starts on the very last slide of it corrosponding scene.  I am using the variables also to show a layer with a change in a caption on the menu slide depending on if its the first time viewed (base layer) at least one scene has been viewed (return layer) or when all scenes have been played (finished layer) and that is working, so I know the variable is changing  on the last slide to true. There are triggers on the menu slide to change the state of the menu buttons back to normal if the corresponding values are equal to false (the initial, unchanged value) But its not working that way  - the state of the menu item is not changing back to normal if the learner navigates away from a scene before reaching the final slide which changes the variable to true.

Can you tell by the screen shots of my setting what might be wrong? Is there an alternate way to make the state change back?

Curtis Kynerd

I have a similiar problem.   I have a layer located on a master slide.  On that layer I have a text box called Module 1 that has a normal state and a visited state.  I want the state of Module 1 to change to Visited when a variable changes from false to true.  This variable changes to true when a particular slide is visited.  However, the state of Module 1 never changes. I know the variable is working correctly because I have tested it successfully.  I can't seem to figure out why the state of Module 1 never changes.  The trigger is the first trigger on the layer.  below is the screen shot of that layer:

Steve Flowers

Hey Curtis, 

Couple of questions. First, is the object you want to change on a layer or on the base layer? There is a featurebug that disallows targeting objects with triggers on a master slide layer.

Second, do you want this to change the object just when the variable changes or when the timeline starts (slide loads) IF the variable is true. If you want to see this whenever a slide loads, you'd need to change the When: event to When: Timeline Starts IF mod1done==Equal to True. Otherwise, it'll only fire when the variable changes and not keep persistent visual state when the slide changes.

tran trai

Dear all,

I'm just newcomer and I am working in a small assignment for my students but I do not know how to work with states. And I would be much appreciated if you could assist me through the work.

In my attachment as you can see, all I want it to be is:

- When I first enter the test , I want the 1 to change colour from orange to blue, for example. And if it is not answered or if it is skipped, the colour is not changed (orange) in the next slide. 

- If the question is submitted, the colour of 1 will be changed to black, it is disabled and that colour keeps unchanged in the rest of the slides.

Thank you and hope your soon reply.

Ashley Terwilliger-Pollard

Hi Tran, and welcome to Heroes! 

This discussion is a bit older so I'm not sure that other folks are still subscribed. It looks like you're trying to control these variables from your slide masters but I didn't see any triggers to change it to disabled within your slide master or individual triggers. 

I did want to point out this helpful videon on how to work with slide masters and variables and I'll continue taking a look at your file to see where I could assist with some additional ideas and tips. 

tran trai

Dear Leslie McKerchie,

All I try to do is that I want the question numbers changing three states as follow:

-  First state: when I first enter the test the number state is different from the others.

-  Second state: if the question is skipped and the state is unchanged to the next slides.

- Third state: if the question is answered, then the state is disabled to next slides.

And at the end, when we come back, the rest of unanswered questions will be highlighted so that we can answer them again.

 

tran trai

Dear Leslie McKerchie,

I'm sorry to make you confused,

All I need is your help to look at the first slide and I will follow your directions to take care the rest.

If possible, could you give me an another example of yours as being described as follows:

-  First state: when I first enter the test the number state is different from the others.

-  Second state: if the question is skipped and the state is unchanged to the next slides.

- Third state: if the question is answered, then the state is disabled to next slides.

- And at the end, when we come back, the rest of unanswered questions will be highlighted so that we can answer them again.

Thanks in advance.

Leslie McKerchie

Thanks Tran - That makes a bit more sense and should make your request more helpful for the community to advise on best practices and advice for your custom design set-up.  

Just to share my thoughts - It looks like you have it set up for the first and second requirement, but that third requirement being conditional and needing to be displayed on other slides - is where the challenge presents itself. All the elements are not on the master slide, so it seems that you would have to put each requirement across all slides to reflect each question number appropriately? Not sure how effective that is. Even the built-in functionality of Submit All does not have a visual of which questions were skipped. You may want to submit that as a feature request here.

Jerson  Campos

Jumping in a little late and it looks like this was solved, but I wanted to add some bit of info.  I've used this method to change states on items as well, but for some reason, once in a while during review, the state doesn't change.   At times, the "When timeline starts" on a slide just seems to skip or not execute properly.  What I had to do was delay the trigger by 1/2 a second. I would add an item off screen and start it at 1/2 a second in the timeline. Then I would point the trigger "when timeline starts" to this object. 

Sandra Aria

Hi, I have question about changing the state of rectangle when variable changes. Below is picture of my trigger. My question is - is it possible to change the state of the rectangle not immediately when variable is equal to the value 8, but after couple of seconds? In the timeline I tried to move the rectangle starting from 2sec, but this one didn't help. Thank you!

Variable