Script to Mute sound

Started by punk_Blood, October 07, 2010, 10:27:29 pm

Previous topic - Next topic

punk_Blood

anyone know how to do this?
i have a selection in my options menu i made, and you can set the sound ON/OFF, and i was wondering what do i have to put to mute the sound?
just because im dead doesnt mean that i cant be alive

stripe103

I haven't tried it, but looking at Ryex's Collapsing CMS and it's Options menu, the codes for changing music and sound volume is
$game_system.bgm_volume = VALUE IN PERCENT
$game_system.sfx_volume = VALUE IN PERCENT

punk_Blood

it says it cant be coerced into fixum

whatever that means...
just because im dead doesnt mean that i cant be alive

Valdred


$game_system.bgm_volume = 0
$game_system.sfx_volume = 0


No %s

nathmatt

just to clarify don't add the percent sign
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


stripe103

What I meant with "in percent" was that the lowest value is 0 and the highest is 100.

Blizzard

No offense to anybody, but I simply have to post this:

LOL!

A levelup for everybody here, you just made my day.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

punk_Blood

it doesnt work for me :/
this comes up AND YES, i did try it in a new game to see if there would be any script collisions
just because im dead doesnt mean that i cant be alive

Ryex

you have to make the instance variables public first
I no longer keep up with posts in the forum very well. If you have a question or comment, about my work, or in general I welcome PM's. if you make a post in one of my threads and I don't reply with in a day or two feel free to PM me and point it out to me.<br /><br />DropBox, the best free file syncing service there is.<br />

punk_Blood

wut? i am a n00b scripter... i dont understand what you mean
just because im dead doesnt mean that i cant be alive

stripe103

Add this below all attr_accessors in Game_System.
attr_accessor :bgm_volume
attr_accessor :sfx_volume

nathmatt

no wounder id doesn't work decided to look at Game_System add this script above main

Spoiler: ShowHide
class Game_System
 
  def bgm_volume(vol)
    bgm = @playing_bgm
    Audio.bgm_play("Audio/BGM/" + bgm.name, vol, bgm.pitch)
    Graphics.frame_reset
  end
 
  def bgs_volume(vol)
    bgm = @playing_bgm
    Audio.bgs_play("Audio/BGM/" + bgs.name, vol, bgs.pitch)
    Graphics.frame_reset
  end
 
  def me_volume(vol)
    bgm = @playing_bgm
    Audio.bgm_play("Audio/BGM/" + me.name, vol, me.pitch)
    Graphics.frame_reset
  end
 
end


to use put this to change the bgm volume
$game_system.bgm_volume(vol)

this to change the bgs volume
$game_system.bgs_volume(vol)

and this to change the me volume
$game_system.me_volume(vol)

vol is the volume you want
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


ForeverZer0

I always just use the Mute button on my computer, but hey, that's me.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

punk_Blood

freakin awesome man thanks :D

oh and @ForeverZer0,
my games in fullscreen and i want the person to be able to mute the music if he or she wishes without having to go the extra mile and push the power on their speakers
just because im dead doesnt mean that i cant be alive