# Using equations in Storyline 2

By
Russell Lash

Is it possible to use equations? For example, with a slider set 1-10, as the user slides the slider, the value is used in an equation and the result saved in another Number variable that is then displayed in a text caption.

EXAMPLE: (this simple example is only to explain the problem. In my project, the equation will be complex with multiple variables and the slider large with many values)

Variables are: Slider1, new_answer

new_answer = slider1 x 10. So, as the slider moves up one step, the value in the text caption increases by 10.

MOST IMPORTANTLY, this should NOT be done by creating 10 different interactions (1 for each step on the slider). This needs to be a real equation handling capability.

Thanks and cheers,

Russ

## 5 Replies

This may be too simplistic for your purposes, but have a look at the attached. The 'new_answer = slider1 x 10' equation can be done with two triggers.

Slider_Math_MH.storySorry, I just realized you are using SL2, see attached.

Slider_Math_SL2_MH.storyThank you Michael for the example. This will be me moving in the direction I need.

Hi Michael

Just to make sure I'm not missing anything, in the example you sent, there is one calculation in the trigger. So, for a more complex calculation (example: x=4x+(y-z) ) will take 3 triggers, is that right? One trigger for each step to solve the equation. And, it will be critical in the sequence of the triggers to ensure an accurate result. OR is there an easier way to do complex calculations (without having to use JavaScript)?

Thanks and cheers,

Russ

That's correct, for more complex calculations, you would need to add additional triggers. And yes, the trigger order is important.