Slider Variable PLUS a constant

Sep 26, 2016

Hi everyone.

I'm trying to create a variable from a slider and a constant number.

I can create a trigger that updates my new variable (TOTAL) that adds 20 to what ever number my slider is on.

For example - Slider =1, my TOTAL variable will read 21

At slider =2, TOTAL = 22 , etc

At some point, my TOTAL variable will never go down (if you're sliding back to 1).

How can I create this?

THANK YOU

23 Replies
Victoria Aleman

Hi Walt and Michael.  I'm hoping one of you can help me.  I'm trying to do something similar to what you did, Walt.  Except I'm adding 15,000 when the slider moves up and want to subtract 15,000 if it moves back down the slider.  (The variable value increase by 15,000 at each step as slider is moved across.)

I have one trigger set:  

Adjust variable X to +Add Value of 15000

When Slider moves (Slider 1)

The value increases correctly by 15,000 when slid across the slider.  However, when the slider is moved back down, it continues to add 15,000.  

How do I get the variable to decrease by 15,000 if the slider is moved back?

Or should I configure my slider properties differently to achieve this same result?

Thanks in advance for any help you can provide.

Victoria Aleman

Hi Walt.  Thanks for the quick reply.  

For this interaction it wouldn't make sense to set the start value to 1500.  In my response to Wendy, you'll see that the purpose of the slider and why that wouldn't make sense.

After submitting my question, I did set up an alternate slider with static amounts as states.  This works, but I had hoped to just have one text box (variable) show the changing amount as the learner moved the slider up and down the bar.

Victoria Aleman

Yes!  That's it!  Thank you!

I've studied how you set that up.  To help me apply this again in the future when creating a slider interaction, can you help me understand the logic that makes this work?

On the Slide Tools Design tab:

1. Start: set to 0.  I'm guessing this Is Slider1 variable's set value.

2. End: set to 150.  Is this the end value of Slider1 variable (the ending valuing at the last step on the slider)?

3. Initial: set to 0.  From what I researched last week on sliders, it's my understanding this is the initial step or location where the slider starts. (just confirming)

4. Step: set to 15.  My understanding is this is the total number of steps.  How did you decide to use this number?  Is this based on the ending value 150?  

5. I see that the first trigger sets the Cost variable to equal the value of Slider1 variable when the slider moves and the second variable multiplies the Cost variable by 1000 when the slide moves. I get that this is what changes the Cost value on screen.  However, I don't understand how it decreases when the slider is moved back down towards the start.

6. How can there be 15 steps and only 10 stops on the slider and it knows to display the appropriate value at each stop up to 150,000?

Thank you, again for your help with this.

Victoria :)

Walt Hamilton

1. You are correct that the start is the variable's first value. In addition, when the timeline starts, the slider is set to the stop (location) that corresponds to that value. So if you move the slider, leave the slide, and return to it, the slider will return to the location where you left it.

2. Yes

3. Yes, unless the variable has changed as #1 describes.

4. Not exactly. The total number of values on a slider is the number of stops (locations). The step value is how far apart those stops are. It can be set from .01 to 150. If it could be set to 15,000 you would not have had a problem :) By setting the total distance the slider moves to 150, and setting the distance between stops to 15, I created 10 stops (well, 11 if you count 0).

5. Every time the slider moves, it completely replaces the variable attached to it. In this case, that is Slider1. That is a built in trigger that you don't see, but it does not add or subtract from the variable, it sets it to the value of the slider in its new position. The first trigger I wrote puts that value into Cost, and the second trigger multiplies Cost by 15000. The variable is constantly updated to the value of the slider. You can watch this by creating a text box on the screen. Inside it put "%Slider1%", without the ". It will show the value of the slider.

Don't hesitate to ask if you have other questions.

Shon Isenhour

A very clever and simple solution, Walt. Now I have a similar, but perhaps more complicated question. How would you do the same sort of interaction using multiplication and division? I want to have a Total number of 30, and as the slider moves to the right, that number gets divided in half (up to 4 times). When the slider is moved back to the left though, I need those numbers to get multiplied or set back to their previous amounts.

That is step 1. The other part of this equation is, I want to have 3 sliders all affecting that total number of 30 in the same way.

Thanks for any help.

Shon Isenhour

Thanks for the quick reply and help, Michael. This is almost exactly what I was thinking for the logic, I just couldn't get all the way there. Thank you.

Yes, I am looking for the aggregate. All 3 sliders, functioning the same way, affecting that total number. So if you drag 1 slider 1 spot, and another slider 2 spots, it would take the total number down to 0.47, just as it did in your example with 1 slider.

Michael Hinze
Jon Bailey

Thanks for the quick reply and help, Michael. This is almost exactly what I was thinking for the logic, I just couldn't get all the way there. Thank you.

Yes, I am looking for the aggregate. All 3 sliders, functioning the same way, affecting that total number. So if you drag 1 slider 1 spot, and another slider 2 spots, it would take the total number down to 0.47, just as it did in your example with 1 slider.

Hm, that would work if the aggregate of the 3 slider positions is <=4. What should happen if all three sliders are all the way to the right?

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