Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

FPSC Classic Scripts / Music Volume Button or slider

Author
Message
Josh Josh
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Cambridge
Posted: 4th Jan 2008 22:56
does anyone know a script for my main menu so people can alter the volume, either by sliding a slider or pressing a button.I have tried but i cant seem to do it, please can you help me?
CoffeeGrunt
17
Years of Service
User Offline
Joined: 5th Oct 2007
Location: England
Posted: 5th Jan 2008 01:07
You can't, so tell them to turn their speakers up/down......

They should be doing that anyway.

xplosys
18
Years of Service
User Offline
Joined: 5th Jan 2006
Playing: FPSC Multiplayer Games
Posted: 5th Jan 2008 02:02
If I remember correctly, sound/music volume is set in the setup.ini file when the game loads. After that, there is no changing it from within game. If you could (like with a third party program) you would have to reload the game to apply the changes.

Best.

Josh Josh
16
Years of Service
User Offline
Joined: 4th Jan 2008
Location: Cambridge
Posted: 5th Jan 2008 11:34
Thanks for the replys, very quick

It's just, i looked on wikipedia for .fpi scripting and came up with loads of commands and one of them was:
Quote: "MUSICVOLUME=X sets the music volume in the range of 0-100"

Where would i put that command if it is useable?
Thanks
sps999
17
Years of Service
User Offline
Joined: 23rd Oct 2007
Location: On my Computer
Posted: 13th Jan 2008 05:30
Not all commands can be used in FPSC, that is one of them. Nickydude's guide has a list of commands that you could use in .fpi scripting for FPSC.

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 13th Jan 2008 06:17 Edited at: 13th Jan 2008 06:19
Okay, I want to say something about this:

That command SHOULD be working and DOES work for me. Just make note that by DEFAULT, all music and sounds in DBP are set at volume 100 (Full Volume).

Also, that command only effects the music and not other sounds in the game, so if they were to turn the music volume down then all the other sounds would seem louder.

And another thing is that the command ONLY effects the CURRENT music, and if you were to change the music in a later level, then the volume will be defaulted to 100 again.

Hope that was informative for everyone.


The one and only,
~PlystirE~

Urlforce:
Dude, I'd rather be declared a dbpro noob than an fpsc legend any day!
Peter gee
16
Years of Service
User Offline
Joined: 11th Jan 2008
Location: behind you!!!!
Posted: 21st Jan 2008 18:11
could u get me a link

don't touch that cookie, it's mine!

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 21st Jan 2008 18:32
Quote: "Also, that command only effects the music and not other sounds in the game, so if they were to turn the music volume down then all the other sounds would seem louder."


How do you get to play music? Does the Musicinzone.fpi actually work? In what format must the "music" be (as compared to sound)?

Was going to take a break... But I missed FPSC!
Peter gee
16
Years of Service
User Offline
Joined: 11th Jan 2008
Location: behind you!!!!
Posted: 21st Jan 2008 19:23
okz could some1 post the link or the script

don't touch that cookie, it's mine!

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Jan 2008 19:43 Edited at: 21st Jan 2008 19:46
Plystire is right, once again.

The musicvolume does work, but only for music and not sound.
He is right about ther reset of the music volume on load too.

Quote: "In what format must the "music" be (as compared to sound)?"

The formats that I use for the music are WAV and OGG, but I prefer the OGG.

The easiest way to achieve this is to use the incstate and decstate actions to navigate up and down with two keys for input.
So, if one key is pressed it incstates to the next state that raises the musicvolume higher than the state before it.
And, if key two is pressed then it decstates to a previous state and the volume is set again to a lower level than the state it came from.
I would have thought one of you guys would already have made a script like this, but then again I don't think I have ever made one either.
I have played with the music, but never a volume control.
Like Coffe Grunt suggested, most people would just turn their speakers down.
However, I see what you want to do here. You want to lower the music but keep the sound effects. That's cool.

I'll play aroud with this today and see what I can come up with.

Don't forget to visit Conjured Entertainment

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 21st Jan 2008 19:46
Quote: "The formats that I use for the music are WAV and OGG, but I prefer the OGG."


Check this thread: http://forum.thegamecreators.com/?m=forum_view&t=122391&b=21

Was going to take a break... But I missed FPSC!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Jan 2008 19:50 Edited at: 21st Jan 2008 21:04
Oh my Nickydude.

I had no idea because I never saw that thread.

I never use musiczone.fpi or those Sound$0 thingies because they flaked on me too in v1.

Write a script and call the commands straight out instead of doing it that way.

Hang on, and I'll whip up an example for you in the next hour or so.


EDIT
Okay, here we go.

Its been a long time since I played with this music stuff in v1, and now I remember how much I hate that generic main.wav.
I rememeber now that I had to create my own "silence" file in order to get no music.
A zero musicvolume value does not turn it off! You can still hear the music.
So, we need a silence.wav file to have absolute silence. They easy to make a 1 second clip just record with no mic hooked up.
With that said, here is a musicvolume example using the stock scritps...


(1) Just place a blood splat overlay.
Or, any other entity that has strength=0 (unvulnerable) and immobile set to yes. (the blood splat works good for the example.

(2) Once you place the blood splat, right click it and set STATIC to NO, thus making it dynamic.

(3) Set the blood splat's ALWAYS ACTIVE to YES, this way it will work no matter how far the player is away from it.

(4) Save that script above as volume.fpi and assign it the the AIMAIN of the bloodsplat.

(5) Start your engines! (oops this isn't a race)

Here are your control keys used in this script but you can change those to your liking by editing the scancode values.

Insert = Start music
Delete = End music

Page Up   = Increase Volume
Page Down = Decrease Volume

This isn't perfect but it does show that the music and musicvolume actions work.

Don't forget to visit Conjured Entertainment

Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 21st Jan 2008 21:52
Thanks CE! It seems like music=$0 doesn't work, but putting the path to the music directly in the script does.

Was going to take a break... But I missed FPSC!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 21st Jan 2008 21:56
Yeah you could step that to the silence.wav file with the increment keys and get rid of the on/off thingy in the example.
That way you would be creating your own "absolute zero" for the musicvolume.

I have that scancodekeypressed=0 thingy to force a single entry on press.
Otherwise, it cycles from one end to the other with a single press because it registers again before we release it.

This should get you going. Glad it helped.

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 22nd Jan 2008 12:14 Edited at: 22nd Jan 2008 12:21
[EDIT #2]

There is no such command as "decstate". The way to achieve a decstate is to use "incstate=-1".

Just thought I'd mention that so some new scripters don't get confused here.

[/EDIT #2]

[EDIT]

About the $0 and $1 parts of the scripts... what they are supposed to do is load up the SOUND listed in the entity's properties.

Looking into the source code, when it finds either $0 or $1 as the value, it will set the sequence value to either -1 or -2 respectively. In the "MUSIC" code which sets the music it literally says this: "If the sequence value IS GREATER THAN ZERO then load up the music they want". So basically, FPSC is programmed to ignore the $0 and $1 values for music, and yet at the same time still recognises them for it.

As an after-thought, $0 and $1 only refer to the "Sound" and "Alt Sound" properties, so I suppose it doesn't make sense to use them for music?

[/EDIT]

Okay, allow me to say some more on this:

I know, when you turn the volume of the music "off", it doesn't actually go to volume 0 (Not even in DBP)... FPSC is hard-coded to ONLY allow the music volume to range from 80 to 100 (by a percentage given through the command).

The way the volume is changed is like this:



So, here's a bright idea I just had... how about giving it a value of -400? That divided by 5 would be -80 and thus set the volume to 0!

Can someone test that out? I am very curious to see if it works or not.

Quote: "Plystire is right, once again."


For some reason, I felt very happy to read that.


The one and only,
~PlystirE~

Urlforce:
Dude, I'd rather be declared a dbpro noob than an fpsc legend any day!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 22nd Jan 2008 21:19 Edited at: 22nd Jan 2008 22:03
Quote: "There is no such command as "decstate". The way to achieve a decstate is to use "incstate=-1"."


Ooops, my bad. I wasn't thinking again, or was it that I forgot?
Yeah that's it, I forgot that this is the only INC that doesn't have a DEC (the alphafades have a dec, and so do frames!)

Thanks for the correction Plystire.

Quote: "
what you guys entered via the script
Set music volume to 80+(musicvolume/5)"

I haven't looked at v1 code in ages. Is that where you got this formula?


Quote: "So, here's a bright idea I just had... how about giving it a value of -400? That divided by 5 would be -80 and thus set the volume to 0!"

I'll try it.

EDIT
The -400 thingy works in the test game and a final build.

Thanks for the heads up on this Plystire.
Now, I can work around that 80 thing in order to get real values.

So...
If the formula in FPSC is ... gamevolume = 80 + (musicvolume/5) then we could reverse that to get figure out the amount needed.

( X - 80 ) * 5 whereas X equals the real volume level desired.

In other words, if we want a true volume level of 16 then we use...

(16 - 80) * 5 = musicvolume

In this case a musicvolume=-320 would give us a real music volume level of 16 in the end.

Sweet info Plystire. I wasn't aware of this volume formula.
Now, I know why zero isn't zero, and how to make it zero.
Thanks, I owe you one.


...and to think I told my math teacher that I would never use that stuff.

Don't forget to visit Conjured Entertainment

Plystire
21
Years of Service
User Offline
Joined: 18th Feb 2003
Location: Staring into the digital ether
Posted: 23rd Jan 2008 04:29
Quote: "...and to think I told my math teacher that I would never use that stuff."


Hahahaha, yes math comes in rather handy on the computer and in many unexpected areas.

I'm glad I was able to help, now if only we could get nickydude to put this into his next update, then everyone later on down the road will know about it and know how to work around it.

Also, I got this formula out of the V107 source code, so it holds true there as well.


The one and only,
~PlystirE~

Urlforce:
Dude, I'd rather be declared a dbpro noob than an fpsc legend any day!
Nickydude
Retired Moderator
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Look outside...
Posted: 23rd Jan 2008 09:18
Quote: "now if only we could get nickydude to put this into his next update"


Done

Was going to take a break... But I missed FPSC!
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Jan 2008 05:35 Edited at: 24th Jan 2008 05:53
@Nickydude

I think that CE ALARM script found in your "FPS Creator Hint’s ‘n’ Tips Guide – Revision 8" on Page 49 is my script.

The CE made me think it was because I used to do that. (CE=Conjured Entertainment)

I searched through the old scripts on my old computer and found one identical to that one except I also had the line...

;Conjured Alarm

right above the description. (where the header usually is)

The creation date was 10-23-2006 with a modified date of 10-24-2006, so I may have put that other line in after I posted it in the forums.
I don't remember writing it but I am certain it is mine, because I wouldn't have added that header if it was someone elses.

Don't forget to visit Conjured Entertainment

Peter gee
16
Years of Service
User Offline
Joined: 11th Jan 2008
Location: behind you!!!!
Posted: 24th Jan 2008 17:20
please i can't find the link and i need this script please someone give me the link!

don't touch that cookie, it's mine!

Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 24th Jan 2008 20:05 Edited at: 24th Jan 2008 20:14
I put a code snippet of an example of controlling music volume in the second post in this thread.

If you see these things that say
, then click on them to expand the snippet box and view the code.

Its just something to get you started, so you'll need to modify it to suit your needs.
I also recommend editing it with the new formula for getting the musicvolume exact. (explained above)

Don't forget to visit Conjured Entertainment

Login to post a reply

Server time is: 2024-11-24 03:34:50
Your offset time is: 2024-11-24 03:34:50