change state of object with multiple sliders

Dec 27, 2015

Hi Guys,

could you pls help. In the attached SL2 file I am using 6 sliders that change states of 6 objects. What I need is to write a text (name of the drink) if variable 1 is equal to xy AND variable 2 is equal to yz etc... basically one text for one possible outcome of the variables.

thank you

Peter

8 Replies
Ashley Terwilliger-Pollard

Thanks Peter for sharing your .story file here. Have you already started to set this up in your file? Is it the "drink" slider that you're using? I don't currently see any triggers to change the value of a variable - but you'll want to do so likely based on the states of your objects and then look at using the "And" condition to ensure the variable is adjusting only when the first item AND the second item match what you've set up. 

Peter Schmidt

trigger

hey Ashley,

thank you for your reply. Yes, I am trying to use "AND" condition somehow. Shall I create one trigger for each beverage combination? For example if there is a numer "2" in the "number of shots" (slider 1 position nr. 1) AND letter "L" in the drink box (drinkslider position nr. 1) I want to write the name of the drink (rectangle caption state 2).

and sorry for that many question, still learning SL :)

happy new year

Peter

Walt Hamilton

Peter,

I know that when you are using the wizard to create a trigger, it gives you the option to have a trigger "fire" when a variable changes. However, it is a very unreliable means of getting a trigger to fire (probably a timing issue, and those can be tricky to sort out, especially with large numbers of triggers.)  I got your sample to work by changing the "when" part of the trigger. When I changed it from "when variable changes" to "when drink slider moves" it changed the name of the drink.

While that avoids the timing issue of when a variable actually changes, it introduces a new problem; one that is fortunately easy to solve. Attaching the trigger to the movement of the slider means that the conditions are only true if the other variable has been set first, and I'm certain that is unacceptable. What it means is that you have to attach the same trigger to BOTH sliders. That way it doesn't matter which slider the user sets first, the drink name will change.

Another thing I noticed is that the syrup slider changes the decaf variable, the flavour slider changes the shots variable, the customize slider changes the milk variable and some of the sliders change numbered variables. It was very confusing for me to figure out what the triggers are referring to. Here is a hint that will make learning SL go much faster for you. Make the names you create more descriptive. For example, you have a slider named "milk slider' and a variable named "milkslider".  I recommend naming the slider "milkslider" and the variable "milkvar" or milkvariable". That way it is very clear that the milkslider changes the milkvariable.

Having a standard naming convention allows you to name objects according to a set form at the very beginning, and never lose time being confused. Using your own naming system, instead of the default system (like slider1), also means you don't have to rename them to keep them straight. As you get more experience using SL, you will be amazed at how much time you can save.

Try making that change, and straightening out the relationships between the sliders and variables, and I think you will have what you want, If not, don't hesitate to ask again.

Ashley Terwilliger-Pollard

Hi Peter, 

Sorry to miss you last week - I was off for a bit to celebrate the holiday. I'd agree with everything Walt mentioned here, especially the note about "when variable changes" as that trigger is waiting for the exact moment the variable changes, and therefore if it's already occurred but the values for the two items haven't been set - that trigger will never execute. You may want to look instead at using states as that is consistent throughout the slide, not just when it's set. 

If you're still having difficulty, feel free to share an updated copy of the .story file here as it looks like you've got plenty of community support to assist you! Everyone likely needs the coffee at the start of the new year. ;-) 

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