Page 1 of 1

Volume Controlled by Slider?

PostPosted: Tue Dec 20, 2005 7:14 pm
by NyahKitty
I'm trying to set up a graphical volume control based on the y axis position of the slider I can grab and drag with a mouse.

Naturally I want the volume to increase when the slider dragged up and decrease when the slider is dragged down.

How might I set it up just using events or even conditional events?
And then also, how might I simply script this?

I actually got the slider working so that it only can be dragged vertically and barriers at the top and bottom, so the slider can't be moved too far.

PostPosted: Tue Dec 20, 2005 7:35 pm
by NyahKitty
I'm currently trying:

-Actor: Volume Slider
-Event: Left mouse button down, no drag
-Script:
setVolume(0, y);


That doesn't seem to do anything, but I think I'm close.
Suggestions anyone?

PostPosted: Tue Dec 20, 2005 9:45 pm
by makslane

PostPosted: Tue Dec 20, 2005 10:19 pm
by NyahKitty
Yes, that's the thread I consulted for the slider.
It's just using it to change the volume of the game that is difficult.

Here's the URL to the file:

http://www.hodgepodgestudios.com/files/MISCELANEOUS/Dr_DeGroot.zip

Thanks!

PostPosted: Tue Dec 20, 2005 10:34 pm
by Game A Gogo
you know, there is a place in play music event on the script that represent the volume, create a var named volume, and on where there is the volume tingy, place volume, and on your slider, put the var as equal to the slider position.

not sure if this work, but i hope it dos.

PostPosted: Wed Dec 21, 2005 2:18 pm
by makslane
To change the music volume just set the variable musicvol (http://www.game-editor.com/docs/script_ ... m#musicvol)

To get the value from your slide actor, you can calc based on current x position and initial x position:

musicvol = (x - xini)/slider_size;

PostPosted: Wed Dec 21, 2005 7:00 pm
by NyahKitty
Is there a similar function for using the slider as a global volume setting for sounds?

The program sounds an alarm when the timer reaches zero.
So I'm using sound, rather than music.

PostPosted: Fri Dec 23, 2005 9:13 pm
by makslane
No, you need get the channel returned by the PlaySound function, put in some variable and use the setVolume to change.

PostPosted: Thu Dec 29, 2005 4:36 pm
by NyahKitty
Is there an example of this somewhere, so I can take a look at it?

PostPosted: Mon Jan 02, 2006 12:35 pm
by makslane
Look the sample:
http://game-editor.com/examples/slider.zip

The sliderPos actor set the pos variable between 0 and 1.
The sound actor use the pos valut to update the sound volume.