Is there something wrong with the logic in my triggers?

Jan 13, 2020

I'm having an issue with a course that I've duplicated in a demo course. In my demo there is a rectangle on the base layer that is normally Hidden, but changes state to Normal when the variable ShowComplete changes to True.

On Layer 1 I have a button that changes the variable Complete to True when it's pressed. There is a second trigger that changes the variable ShowComplete to True when variable Complete changes to True.

Layer 2 is identical to Layer 1 except that it does not contain the second trigger that changes ShowComplete to True. The trigger on Layer 1 seems to be getting executed anyway when the button on Layer 2 is pressed.

For example, if click the button to view Layer 2, then click the Complete button, both Complete and ShowComplete are set to True, when only Complete should change to True and ShowComplete should remain False.

Am I missing something here? Why is the trigger on Layer 1 being executed when only Layer 2 is visible? SL3 .story file is attached.

 

15 Replies
Wendy Farmer

Hi Michael

the variables are global to the project so once you set a trigger to change it to True which you are doing on Layer 1 or Layer 2 - it stays as True unless you reset it back to false before moving to another layer.

See update to your file if this is what you are after. With these triggers the user can do the layers in any order but the ShowComplete won't trigger until both are done

Walt Hamilton

Michael,

The trigger in question is not attached to an object, therefore it is not limited to the layer where the object is.

It is a Variable trigger, and like Wendy says, variables are available everywhere, so anytime this slide is open and the first variable changes, IT (not the clicking of an object) changes the second variable..

Wendy Farmer
Michael Anderson

"changing one variable value based on another variable"

Only if the conditions to change the variable are met.  I don't think I'm following your issue.

You have two layers both with buttons and you only want the COMPLETED button on the base layer to change state if both layer buttons are activated - is that correct.

In my example:

I am adjusting CompleteLayer1 when the user clicks Complete button on Layer1

I am adjusting CompleteLayer2 when the user clicks Complete button on Layer2

Only when these two actions take place will the COMPLETED button using the showComplete trigger execute.

Here is another sample file where I don't use the showComplete trigger but change the state of the COMPLETED button on the base layer with other triggers.

Michael Anderson

No, sorry, it has nothing to do with whether or not each layer is visited. The problem is that I have a trigger on one layer that is being executed when a different layer is shown. In my mind if the layer is never shown, then triggers on it should never run. Walt is saying that this trigger will run regardless of whether or not the layer is shown, because the trigger depends on the value of a variable changing. Doesn't make sense to me. Please look at my original file and the demo link I provided.

Walt Hamilton

Think of the variable as being behind all the layers of a slide. When the first one changes, that is the action that triggers (behind the scenes) the change in the second one. Since the initiating action is the variable change, the trigger must be attached to the variable. To save us the trouble of having to go to the variable manager to write those sort of triggers, Articulate has made them visible on the layer we are viewing when we write it. It is a design decision for convenience's sake, not execution sake.

the only way to limit a variable change to a specific layer is to attach the trigger to an object on that layer.

Wendy Farmer

Walt is correct.

Looking at the triggers you have set.

Base layer you are telling SL to change the state of the COMPLETED button to Normal when ShowComplete = True

Layer 1 - you are Setting ShowComplete = True when variable COMPLETE changes - you have used this variable COMPLETE on both layers 1 and 2.  That's why in my example I use two layer variables so I can control what happens.

When it's changed on layer 1 to True it stays True, so that meets the condition regardless of whether they go to layer 2.

When it's changed on layer 2 to True it meets the condition that is used in the ShowComplete trigger they don't need to go to Layer 1.

Remembering variables are global to the project so when it's changed anywhere (if not reset) it remains in that state.

Michael Anderson

I see, this explains it much better. I thought that the layer itself counted as an object, similar to how some triggers are attached to the base layer rather than an object on the base layer. I have a layer variable, so I can probably add a condition to the trigger so it only runs when that variable equals 1 or 2 or whatever. Thanks.

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