Game silenced mode

This script is for people that have certains OS that cant silence programs manually
or if you thing that this system is better. Using this script you can use rpg maker
while listening music, for example.

Note that im open to feedback, suggestions and corrections.

  1. #==============================================================================
  2. # Game silenced mode
  3. # By gerkrt/gerrtunk
  4. # Version: 1
  5. # License: MIT, credits
  6. # Date: 10/04/2012
  7. # IMPORTANT NOTE: to acces the more actualitzed or corrected version of this
  8. # script check here: http://usuarios.multimania.es/kisap/english_list.html or my
  9. # pastebin here: http://pastebin.com/u/gerkrt
  10. #==============================================================================
  11.  
  12. =begin
  13. ------- INTRODUCTION ----------
  14. This script is for people that have certains OS that cant silence programs manually
  15. or if you thing that this system is better. Using this script you can use rpg maker
  16. while listening music, for example.
  17.  
  18. Note that im open to feedback, suggestions and corrections.
  19.  
  20. ------ USE ---------
  21. Is very simple to use. Just put the option Silenced_game to = true and the game will
  22. skip all the music. And = false for the oposite.
  23.  
  24. Note that you can erase this script for final or public versions as it isnt used
  25. for normal players.
  26.  
  27. =end
  28.  
  29. module Wep
  30.   Silenced_game = false
  31. end
  32.  
  33. #==============================================================================
  34. # ** Game_System
  35. #------------------------------------------------------------------------------
  36. #  Esta clase almacena las variables sobre datos y comandos del sistema, como
  37. #  la reproducción de música y sonido, el windowskin, temporizador, etc
  38. #  Llama a $game_system para acceder a las variables incluidas aquí.
  39. #==============================================================================
  40.  
  41. class Game_System
  42.  
  43.   #--------------------------------------------------------------------------
  44.   # * Reproducción de Sonidos
  45.   #   A partir de aquí están las métodos que incluyen los datos sobre la
  46.   #   reproducción de todo tipo de sonido(música, ambiente, efecto sonoro, etc)
  47.   #   Para que los comandos de reproducción funcionen corréctamente la variable
  48.   #   que contiene el archivo de sonido debe ser la clase RPG::AudioFile
  49.   #   y contener en su método de inicio (nombre, volúmen, tono)
  50.   #   Puedes llamar a esta clase con el siguiente método:
  51.   #   RPG::AudioFile.new(nombre, volúmen, tono)
  52.   #   Los valores por defecto son ("", 100, 100)
  53.   #--------------------------------------------------------------------------
  54.   # * Reproducir Música
  55.   #     "bgm" es la variable que incluye el archivo que se reproduce
  56.   #--------------------------------------------------------------------------
  57.   alias wep_gs_bgm_play bgm_play
  58.   def bgm_play(bgm)
  59.     if Wep::Silenced_game
  60.       return
  61.     end
  62.    
  63.     wep_gs_bgm_play(bgm)
  64.   end
  65.  
  66.   #--------------------------------------------------------------------------
  67.   # * Reproducir Sonido de Fondo
  68.   #     "bgs" es la variable que incluye el archivo que se reproduce
  69.   #--------------------------------------------------------------------------
  70.   alias wep_gs_bgs_play bgs_play
  71.   def bgs_play(bgs)
  72.     if Wep::Silenced_game
  73.       return
  74.     end
  75.    
  76.      wep_gs_bgs_play(bgs)
  77.   end
  78.  
  79.   #--------------------------------------------------------------------------
  80.   # * Reproducir Efecto Musical
  81.   #     "me" es ña variable que incluye el archivo que se reproducirá
  82.   #--------------------------------------------------------------------------
  83.   alias wep_gs_me_play me_play
  84.   def me_play(me)
  85.     if Wep::Silenced_game
  86.       return
  87.     end
  88.    
  89.      wep_gs_me_play(me)
  90.   end
  91.  
  92.   #--------------------------------------------------------------------------
  93.   # * Reproducir Efecto Sonoro
  94.   #     "se" es el archivo que se reproducirá
  95.   #--------------------------------------------------------------------------
  96.   alias wep_gs_se_play se_play
  97.   def se_play(se)
  98.     if Wep::Silenced_game
  99.       return
  100.     end
  101.    
  102.     wep_gs_se_play(se)
  103.   end
  104.  
  105. end
  106.  
  107.  
  108. module Wep
  109.   Scripts_list = [] unless defined? Scripts_list
  110.   Scripts_list.push ('Game silenced mode')
  111. end  
  112.  
Expand to see the code.
I know that you can simply doing it by pressing F1 and turning sound off. What OS does that not work on?
I'm just curious because to my knowledge that works on all versions of Windows from XP and after. I haven't tried any volume control on any Linux distros, but I assume that Wine shouldn't have any problems handling that.

On another note, it would be wiser to alias the Audio module since this script would miss audio that is not called through Game_System.
I didnt have any idea about that function of RPG Maker XP, anyway it was a very short script.
xDDD, i write to tell that for me the script is usable even with that, i have bugs with that f1 sound options, sometimes they dont stop music at all, so they are turned off and the sound works also...

I know is a very strange situation but the script is helping me a lot with the options bugs + windows Xp.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=76500