Slider play sound when value change

Hi,

it sounds simple but I cannot fix this issue with a simple slieder:

Have a silder where player can set his own difficulty

image

I would like to hear a sound as soon as the slider is moved and every time the value changes.
How to trigger sound when DifficultySlider.Value() changes?

When I set “DifficultySlider is beeing dragged” I can hear sound once when clicking on slider but not every time when value change.

The difficulty user had previous was stored in a variable.
Now, when I only set “variable ≠ DifficultySlider.Value()” and the variable has the value 10, the sound plays only at 9 and 11, every time slider passes this value.

Any idea how to solve? Thank you


Click on ? button on top and drag game slider

Hi ZeroX4,
thank you for the screenshot.
Don’t know how it works for you, but as long I’m on slider I can hear the sound every 0.5 seconds. Independent from moving or not moving slider…
But how to hear sound only when moving slider and the slider value change?

So i miss understand you
I made it so as indication for player to play game sound so player can decide is it to loud or to low and adjust it on the fly
While you want sound to be played when you actually move the slider
Exactly when value changes

So here are your 2 options
Each red rectangle is separate option so do not use them both at the same time
Option with specifying value (bottom one) is not perfect
If you move slider too fast it will like not register value change
For example if you move fast enough for it to skip from 10 to 40 then you wont hear sound for 20 and 30 (i know you have like 0 1 2 3 4 up to 11 but i have 100 that’s why i made it 10 increments SOO for you it will be easier to setup)
WHILE 1st option (top one) will spam it even if you move slider even a tiny bit
What have green underline in top rectangle is what is needed ONLY for top method so you do not need that for bottom one

Method #1 the top one

Method #2 bottom one

Pick your poison

Hi ZeroX4,
the method #1 with the variable and compare variable ≠ slider value is working just for the next bigger or smaller value (as wrote in my first post).
The method #2 is working only when I write down a single event for every DifficultySlider.Value(). Using “OR” works like method #1. Don’t know why.

However, method #2 is not the most elegant, but it works. Thank you.

1 Like

For number 2 you can use mod(), mod() returns the remainder of the 1st number divided by 2nd number. (or the 1st number if it’s less than the 2nd) (If it returns zero then it’s evenly divisible)

1 Like

Check what Keith wrote above his method is same as mine 2nd one but require less configuration

1 Like

Hi,
the mod is a nice idea (out of my focus for that issue), but as you wrote down, the sound with mod(Slider.Value(), 10) = 0 will only sound every decimal value: at 10, 20 & 30.

Change to mod(Slider.Value(), 2) = 0 will sound just at even values.
Have had to add a second event with second condtion to get also a sound when value is uneven:

Now it works. Thank you both for your help.