[XP] Juan's Option Menu

Started by Juan, March 16, 2008, 07:29:53 pm

Previous topic - Next topic

Juan

March 16, 2008, 07:29:53 pm Last Edit: October 01, 2013, 12:28:24 am by Juan
Juan's Option Menu
Authors: Juan
Version: 2.2
Type: Custom Component System
Key Term: Menu Add-On



Introduction

This is an option menu made by me.  This option menu can change the windowskin, font, font size, bgm volume, sfx volume,  battle bgm, and change bar style and opacity if your using blizzards tons of add script bar script.


Features


  • Change Windowskin
  • Change Font
  • Change Font Size
  • Change Bgm Volume
  • Change Sfx Volume
  • Change Battle Bgm
  • Change Bar Style if your using blizzards tons of add script with the bar style add on on.
  • Change Bar Opacity if your using blizzards tons of add script with the bar style add on on.
  • Change the Screensize to full screen.



Screenshots

Spoiler: ShowHide



Demo
https://www.dropbox.com/sh/o00xrrjbqm49ajl/m83OKufU0d


Script

Spoiler: ShowHide
#==============================================================================
# ** Juan's Option Menu
#------------------------------------------------------------------------------
# Juan
# Version 2.2
# Type: Custom Component System
# Date 9/21/08
# Date Last Updated 9/30/2013
#==============================================================================
#
#  This work is protected by the following license:
# #----------------------------------------------------------------------------
# # 
# #  Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# #  ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# # 
# #  You are free:
# # 
# #  to Share - to copy, distribute and transmit the work
# #  to Remix - to adapt the work
# # 
# #  Under the following conditions:
# # 
# #  Attribution. You must attribute the work in the manner specified by the
# #  author or licensor (but not in any way that suggests that they endorse you
# #  or your use of the work).
# # 
# #  Noncommercial. You may not use this work for commercial purposes.
# # 
# #  Share alike. If you alter, transform, or build upon this work, you may
# #  distribute the resulting work only under the same or similar license to
# #  this one.
# # 
# #  - For any reuse or distribution, you must make clear to others the license
# #    terms of this work. The best way to do this is with a link to this web
# #    page.
# # 
# #  - Any of the above conditions can be waived if you get permission from the
# #    copyright holder.
# # 
# #  - Nothing in this license impairs or restricts the author's moral rights.
# # 
# #----------------------------------------------------------------------------
#
# Compatibility:
# This script is independent so it doesn't modify anything.
# Compatable with the Sdk
# Compatable with Dream for music files
# Compatable and Supports Tons of add-ons by Blizzard
#
#
#Features:
#
# -> Change Font
# -> Change Font Size
# -> Change Windowskin
# -> Change Bgm volume
# -> Change Sfx volume
# -> Change Battle Bgm Music able to disable
# -> Change Bar Style if your using blizzards tons of add script.
# -> Change Bar Opacity if your using blizzards tons of add script.
# -> A preview window for most options.
#
# Version History
#
# Version 1.0
# -> This script was first made
# Version 2.0
# -> Completely Rewritten
# -> Less Code
# -> Added Full scene option
# -> The option help window now works.
# Version 2.1
# -> Added option to remove battle bgm.
# Version 2.2
# -> Added a preview window for most options.
#
#
#Instructions
# Configurate everything in Juan_Configuration module. 
# To call the option menu use $scene =  Scene_Option.new
#
#
#
#FAQ (Frequently Asked Questions):
#None so far
#
#
#Credits
#Blizzard
#Wcw
#Susy
#
#
#Author's Notes
#Credit me and enjoy
#Any bugs or need help
#Report them here:
#http://forum.chaos-project.com/index.php?topic=782.0
#or
#Email me
#Juanito119@yahoo.com
#Thats it
#enjoy


#==============================================================================
# module Juan_Configuration
#==============================================================================
module Juan_Configuration
 
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
  # Fonts
  Fonts = ['Arial', 'Bookman Old Style', 'Comic Sans MS', 'Mistral', 'Papyrus',
  'Tahoma', 'Times New Roman']
# Option Menu Opacity
Option_Menu_Opacity = 200
#True or false if you want to see the mapground
Map_Background = true
#Windowskins names
Windowskins = ['Red', 'Blue', 'Green', 'Silver', 'Black']
# Battle Bgm Options
Battle_Bgm_Enabled = true
  #Battle bgm name
  Battle_Bgms = [
  #             ['BGM_NAME', VOLUME, PITCH, 'DISPLAY_NAME']
                ['001-Battle01', 100, 100, 'BGM 1'],
                ['002-Battle02', 100, 100, 'BGM 2'],
                ['003-Battle03', 100, 100, 'BGM 3'],
                ['004-Battle04', 100, 100, 'BGM 4']]
#battle bgm variable
Bgm_Variable = 49
# battle bgm lock variable
Bgm_Lock = 49
end
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#==============================================================================
# Game_System
#==============================================================================

class Game_System
 
  attr_accessor :bgm_volume
  attr_accessor :sfx_volume
 
  alias init_juan_cms_later initialize
  def initialize
    init_juan_cms_later
    @bgm_volume = 100
    @sfx_volume = 100
  end

  def reset_battle_bgm
    bgm = Juan_Configuration::Battle_Bgms[$game_variables[Juan_Configuration::Bgm_Variable]]
    $game_system.battle_bgm = RPG::AudioFile.new(bgm[0])
    return # if an event calls this method the "return" is HIGHLY neccesary!
  end
 
  if $dream_music
  def bgm_play(bgm)
    @playing_bgm = bgm
    if bgm != nil && bgm.name != ''
      vol = correction(@bgm_volume)
      dream_ed = bgm.clone
      dream_ed.volume = dream_ed.volume * vol / 100
      DREAM.play_encrypted_audio('Audio/BGM/', dream_ed, 0)
    else
      Audio.bgm_stop
    end
    Graphics.frame_reset
  end
 
  def bgs_play(bgs)
    @playing_bgs = bgs
    if bgs != nil && bgs.name != ''
      vol = correction(@sfx_volume)
      dream_ed = bgs.clone
      dream_ed.volume = dream_ed.volume * vol / 100
      DREAM.play_encrypted_audio('Audio/BGS/', dream_ed, 1)
    else
      Audio.bgs_stop
    end
    Graphics.frame_reset
  end
 
  def me_play(me)
    if me != nil && me.name != ''
      vol = correction(@bgm_volume)
      dream_ed = me.clone
      dream_ed.volume = dream_ed.volume * vol / 100
      DREAM.play_encrypted_audio('Audio/ME/', dream_ed, 2)
    else
      Audio.me_stop
    end
    Graphics.frame_reset
  end
 
  def se_play(se)
    if se != nil && se.name != ''
      vol = correction(@sfx_volume)
      dream_ed = se.clone
      dream_ed.volume = dream_ed.volume * vol / 100
      DREAM.play_encrypted_audio('Audio/SE/', dream_ed, 3)
    end
  end
  else
  def bgm_play(bgm)
    @playing_bgm = bgm
    if bgm != nil && bgm.name != ''
      vol = correction(@bgm_volume)
      Audio.bgm_play('Audio/BGM/' + bgm.name , bgm.volume * vol / 100, bgm.pitch)
    else
      Audio.bgm_stop
    end
    Graphics.frame_reset
  end
 
  def bgs_play(bgs)
    @playing_bgs = bgs
    if bgs != nil && bgs.name != ''
      vol = correction(@sfx_volume)
      Audio.bgs_play('Audio/BGS/' + bgs.name, bgs.volume * vol / 100, bgs.pitch)
    else
      Audio.bgs_stop
    end
    Graphics.frame_reset
  end
 
  def me_play(me)
    if me != nil && me.name != ''
      vol = correction(@bgm_volume)
      Audio.me_play('Audio/ME/' + me.name, me.volume * vol / 100, me.pitch)
    else
      Audio.me_stop
    end
    Graphics.frame_reset
  end

  def se_play(se)
    if se != nil && se.name != ''
      vol = correction(@sfx_volume)
      Audio.se_play('Audio/SE/' + se.name, se.volume * vol / 100, se.pitch)
    end
  end
  end
 
  def correction(volume)
    case volume
    when 100 then return 100
    when 95 then return 97
    when 90 then return 95
    when 85 then return 92
    when 80 then return 90
    when 75 then return 87
    when 70 then return 85
    when 65 then return 82
    when 60 then return 80
    when 55 then return 77
    when 50 then return 75
    when 45 then return 72
    when 40 then return 70
    when 35 then return 65
    when 30 then return 60
    when 25 then return 55
    when 20 then return 50
    when 15 then return 40
    when 10 then return 35
    when 5 then return 25
    end
    return 0
  end
 
end 

 
#==============================================================================
# ** Window_Options
#------------------------------------------------------------------------------
#  This window displays options on the menu screen.
#==============================================================================

class Window_Options < Window_Selectable
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 430, 380)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    @commands = ['Font', 'Font Size', 'Windowskin', 'Bgm Volume', 'Sfx Volume']   
    @commands.push 'Battle Bgm' if Juan_Configuration::Battle_Bgm_Enabled
    @commands.push 'Bar Style', 'Bar Opacity' if $tons_version && $game_system.BARS
    @commands.push 'Change Screen Size'
    @item_max = @commands.size   
    refresh
    self.index = 0
  end 
  #--------------------------------------------------------------------------
  # * Get Command
  #--------------------------------------------------------------------------
    def get_command
    return @commands[index]
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    (0...@item_max).each {|i| draw_item(i, normal_color)}
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #--------------------------------------------------------------------------
  def draw_item(index, color)
    self.contents.font.color = color
    rect = Rect.new(0, 32 * index, self.contents.width - 8, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[index])   
    self.contents.draw_text(0, index / 1 * 32   , self.width - 32, 32, @commands[index], 96)
  end
  #--------------------------------------------------------------------------
  # * Disable Item
  #     index : item number
  #--------------------------------------------------------------------------
  def disable_item(index)
    draw_item(index, disabled_color)
  end

end

#==============================================================================
# ** Window_Option_Help
#------------------------------------------------------------------------------
#  This window displays menu function on the menu screen.
#==============================================================================

class Window_Option_Help < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update(option_update)
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, -8, 440, 32, option_update, 2)
  end

end


#==============================================================================
# ** Window_Option_Help2
#------------------------------------------------------------------------------
#  This window displays configure option on the menu screen.
#==============================================================================

class Window_Option_Help2 < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 640, 50)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(4, -8, 440, 32, 'Configure Options', 0)
  end

end

#==============================================================================
# ** Window_Font
#------------------------------------------------------------------------------
#  This window displays font on the menu screen.
#==============================================================================

class Window_Font < Window_Base
  attr_accessor :current_font
  attr_reader   :font_name
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    @font_name = Font.default_name
    @current_font = Juan_Configuration::Fonts.index(@font_name)   
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Font')
    self.contents.font.color = normal_color
    @font_name = Juan_Configuration::Fonts[@current_font]
    self.contents.font.name = @font_name
    self.contents.draw_text(4, 32, 120, 32, @font_name, 2)
    self.contents.font.name = Font.default_name
  end

end


#==============================================================================
# ** Window_Font_Size
#------------------------------------------------------------------------------
#  This window displays font size on the menu screen.
#==============================================================================

class Window_Font_Size < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Font size')
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, Font.default_size.to_s, 2)
  end

end


#==============================================================================
# ** Window_Windowskin
#------------------------------------------------------------------------------
#  This window displays windowskin name on the option screen.
#==============================================================================

class Window_Windowskin < Window_Base
  attr_reader   :current_skin
  attr_reader   :skin_name   
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Windowskin')
    self.contents.font.color = normal_color
    @skin_name = Juan_Configuration::Windowskins[self.current_skin]
    self.contents.draw_text(4, 32, 120, 32, @skin_name)
  end

  def current_skin
    return (@current_skin == nil ? 0 : @current_skin)
  end

  def current_skin=(val)
    @current_skin = (val.is_a?(Numeric) ? val : 0)
  end

end



#==============================================================================
# ** Window_Bgm_Volume
#------------------------------------------------------------------------------
#  This window displays bgm volume on the option screen.
#==============================================================================

class Window_Bgm_Volume < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Bgm Volume')
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, $game_system.bgm_volume.to_s, 2)
  end

end


#==============================================================================
# ** Window_Sfx_Volume
#------------------------------------------------------------------------------
#  This window displays sfx volume on the option screen.
#==============================================================================

class Window_Sfx_Volume < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Sfx Volume')
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, $game_system.sfx_volume.to_s, 2)
  end

end


#==============================================================================
# ** Window_Battle_Bgm
#------------------------------------------------------------------------------
#  This window displays battle bgm name on the menu screen.
#==============================================================================

class Window_Battle_Bgm < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    bgm = Juan_Configuration::Battle_Bgms[$game_variables[Juan_Configuration::Bgm_Variable]][3]
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Battle Bgm')
    self.contents.font.color = normal_color
    self.contents.draw_text(4, 32, 120, 32, bgm, 2)
  end

end


#==============================================================================
# ** Window_Bar_Style
#------------------------------------------------------------------------------
#  This window displays bar style on the menu screen.
#==============================================================================

class Window_Bar_Style < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Bar Style' + $game_system.bar_style.to_s)
    self.contents.font.color = normal_color
    color1 = Color.new(80, 0, 0, 192)
    color2 = Color.new(240, 0, 0, 192)
    color3 = Color.new(80, 0, 0, 192)
    self.contents.gradient_bar(4, 32, width - 64, color1, color2, color3, 1)
  end

end


#==============================================================================
# ** Window_Bar_Opacity
#------------------------------------------------------------------------------
#  This window displays bar opacity on the menu screen.
#==============================================================================

class Window_Bar_Opacity < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize
    super(0, 0, 160, 96)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.opacity = Juan_Configuration::Option_Menu_Opacity
    refresh
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 120, 32, 'Bar Opacity' + $game_system.bar_opacity.to_s)
    self.contents.font.color = normal_color
    color1 = Color.new(80, 0, 0, 192)
    color2 = Color.new(240, 0, 0, 192)
    color3 = Color.new(80, 0, 0, 192)
    self.contents.gradient_bar(4, 32, width - 64, color1, color2, color3, 1)   
  end

end


#==============================================================================
# ** Scene_Option
#------------------------------------------------------------------------------
#  This class performs option menu screen processing.
#==============================================================================
class Scene_Option   
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     menu_index : command cursor's initial position
  #--------------------------------------------------------------------------
  def initialize(menu_index = 0)
    @menu_index = menu_index
  end
  #--------------------------------------------------------------------------
  # * Main Processing
  #--------------------------------------------------------------------------
  def main
    # Make command window
    @command_window = Window_Options.new
    @command_window.x = 0
    @command_window.y = 50
    # If battle bgm is forbidden.
    if $game_switches[Juan_Configuration::Bgm_Lock] || Juan_Configuration::Battle_Bgms.size <= 1
    @command_window.disable_item(5)
    end
    # Make font command window
    @font_command_window = Window_Font.new
    @font_command_window.x = 430
    @font_command_window.y = 50
    @font_command_window.active = false
    @font_command_window.visible = false
    # Make font size command window
    @font_size_command_window = Window_Font_Size.new
    @font_size_command_window.x = 430
    @font_size_command_window.y = 50
    @font_size_command_window.active = false
    @font_size_command_window.visible = false   
    # Make windowskin command window
    @windowskin_command_window = Window_Windowskin.new
    @windowskin_command_window.x = 430
    @windowskin_command_window.y = 50
    @windowskin_command_window.active = false
    @windowskin_command_window.visible = false
    # Make bgm volume command window
    @bgm_command_window = Window_Bgm_Volume.new
    @bgm_command_window.x = 430
    @bgm_command_window.y = 50
    @bgm_command_window.active = false
    @bgm_command_window.visible = false
    # Make sfx volume command window
    @sfx_command_window = Window_Sfx_Volume.new
    @sfx_command_window.x = 430
    @sfx_command_window.y = 50
    @sfx_command_window.active = false
    @sfx_command_window.visible = false
    # Make battle bgm command window
    @battle_bgm_command_window = Window_Battle_Bgm.new
    @battle_bgm_command_window.x = 430
    @battle_bgm_command_window.y = 50
    @battle_bgm_command_window.active = false
    @battle_bgm_command_window.visible = false
    if $tons_version && $game_system.BARS
    # Make bar style command window
    @bar_style_command_window = Window_Bar_Style.new
    @bar_style_command_window.x = 430
    @bar_style_command_window.y = 50
    @bar_style_command_window.active = false
    @bar_style_command_window.visible = false 
    # Make bar opacity
    @bar_opacity_command_window = Window_Bar_Opacity.new
    @bar_opacity_command_window.x = 430
    @bar_opacity_command_window.y = 50
    @bar_opacity_command_window.active = false
    @bar_opacity_command_window.visible = false
    end
    # Make option help window
    @option_help_window = Window_Option_Help.new
    @option_help_window.x = 0
    @option_help_window.y = 430
    # Make option help2 window
    @option_help_window2 = Window_Option_Help2.new
    @option_help_window2.x = 0
    @option_help_window2.y = 0
    # Make spriteset
    @spriteset = Spriteset_Map.new
    # Execute transition
    Graphics.transition
    # Main loop
    loop {
      # Update game screen
      Graphics.update
      # Update input information
      Input.update
      # Frame update
      update
      # Abort loop if screen is changed
      if $scene != self
        break
      end
    }
    # Prepare for transition
    Graphics.freeze
    # Dispose of windows
    @command_window.dispose
    @font_command_window.dispose
    @font_size_command_window.dispose
    @bgm_command_window.dispose
    @sfx_command_window.dispose
    @windowskin_command_window.dispose
    @battle_bgm_command_window.dispose
    @bar_style_command_window.dispose if $tons_version && $game_system.BARS
    @bar_opacity_command_window.dispose if $tons_version && $game_system.BARS
    @option_help_window.dispose
    @option_help_window2.dispose
    @spriteset.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    # Update windows
    @command_window.update
    @font_command_window.update   
    @font_size_command_window.update
    @windowskin_command_window.update
    @bgm_command_window.update
    @sfx_command_window.update   
    @battle_bgm_command_window.update
    @bar_style_command_window.update if $tons_version && $game_system.BARS
    @bar_opacity_command_window.update if $tons_version && $game_system.BARS
    @option_help_window2.update
    @spriteset.update   
    command_window_check
    option_update
  end
  #--------------------------------------------------------------------------
  # * Command Window Check
  #     checks which command window is active
  #--------------------------------------------------------------------------
  def command_window_check
    # If command window is active: call update_command
    if @command_window.active
      update_command
    # If font command window is active: call update_font_command
    elsif @font_command_window.active
      update_font_command
    # If font size command is active: call update_font_size
    elsif @font_size_command_window.active
      update_font_size_command     
    # If windowskin command window is active: call update_windowskin_command
    elsif @windowskin_command_window.active
      update_windowskin_command
    # If bgm command window is active: call update_bgm_command
    elsif @bgm_command_window.active
      update_bgm_command
    # If sfx command window is active: call update_sfx_command
    elsif @sfx_command_window.active
      update_sfx_command
    # If battle bgm is active: call update_battle_bgm_command     
    elsif @battle_bgm_command_window.active
      update_battle_bgm_command   
    # If bar style command window is active: call update_bar_style_command   
    elsif @bar_style_command_window.active
      update_bar_style_command
    # If bar opacity command window is active: call update_bar_opacity_command
    elsif @bar_opacity_command_window.active
      update_bar_opacity_command
    end
  end
  #--------------------------------------------------------------------------
  # * Option Window Frame Update
  #--------------------------------------------------------------------------
  def option_update
    # Branch by command window name
    case @command_window.get_command
      when 'Font'
        @option_help_window.update('Change the font.')
      when 'Windowskin'
        @option_help_window.update('Change the game\'s menu apperence.')   
      when 'Bgm Volume'
        @option_help_window.update('Change the bgm volume')     
      when 'Sfx Volume'
        @option_help_window.update('Change the sfx volume') 
      when 'Battle Bgm'
        @option_help_window.update('Change the battle music.')
      when 'Bar Style'
        @option_help_window.update('Change the bars visual apperence')
      when 'Bar Opacity'
        @option_help_window.update('Change the bar visibility.')
      when 'Change Screen Size'
        @option_help_window.update('Change the window size.')
      else
        @option_help_window.update('Unknown option.')
    end   
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when command window is active)
  #--------------------------------------------------------------------------
  def update_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to menu screen
      $scene = Scene_Menu.new(4)
    # If C button was pressed
    elsif Input.trigger?(Input::C)
      # Branch by command window cursor position
      case @command_window.get_command
      when 'Font'
        # Make font command window active
        @font_command_window.active = true
        @font_command_window.visible = true
        @command_window.active = false
        @command_window.index = -1
      when 'Font Size'
        # Make font size window active
        @font_size_command_window.active = true
        @font_size_command_window.visible = true
        @command_window.active = false
        @command_window.index = -1       
      when 'Windowskin'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make windowskin command window active
        @command_window.active = false
        @command_window.index = -1         
        @windowskin_command_window.active = true
        @windowskin_command_window.visible = true
        #@windowskin_command_window.index = 0
      when 'Bgm Volume'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        # Make bgm command window active
        @command_window.active = false
        @command_window.index = -1         
        @bgm_command_window.active = true
        @bgm_command_window.visible = true
      when 'Sfx Volume'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        # Make sfx command window active
        @command_window.active = false
        @command_window.index = -1         
        @sfx_command_window.active = true
        @sfx_command_window.visible = true
      when 'Battle Bgm'
        # If battle bgm is forbidden
        if $game_switches[Juan_Configuration::Bgm_Lock] || Juan_Configuration::Battle_Bgms.size <= 1
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end       
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        # Make battle bgm command window active
        @command_window.active = false
        @command_window.index = -1         
        @battle_bgm_command_window.active = true
        @battle_bgm_command_window.visible = true
      when 'Bar Style'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        # Make bar style command window active
        @command_window.active = false
        @command_window.index = -1         
        @bar_style_command_window.active = true
        @bar_style_command_window.visible = true
      when 'Bar Opacity'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        # Make bar opacity command window active
        @command_window.active = false
        @command_window.index = -1         
        @bar_opacity_command_window.active = true
        @bar_opacity_command_window.visible = true   
      when 'Change Screen Size'
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        keybd = Win32API.new 'user32.dll', 'keybd_event', ['i', 'i', 'l', 'l'], 'v'
        keybd.call(0xA4, 0, 0, 0)
        keybd.call(13, 0, 0, 0)
        keybd.call(13, 0, 2, 0)
        keybd.call(0xA4, 0, 2, 0)         
      end     
    end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when font command window is active)
  #--------------------------------------------------------------------------
  def update_font_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @font_command_window.active = false
      @font_command_window.visible = false
      elsif Input.repeat?(Input::RIGHT)
        $game_system.se_play($data_system.decision_se)
        @font_command_window.current_font += 1
        @font_command_window.current_font %= Juan_Configuration::Fonts.size
        @font_command_window.refresh
      elsif Input.repeat?(Input::LEFT)
        $game_system.se_play($data_system.decision_se)
        @font_command_window.current_font += Juan_Configuration::Fonts.size - 1
        @font_command_window.current_font %= Juan_Configuration::Fonts.size
        @font_command_window.refresh
      elsif Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
        Font.default_name = @font_command_window.font_name
        $scene = Scene_New_Options.new
    end   
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when font size command window is active)
  #--------------------------------------------------------------------------
  def update_font_size_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @font_size_command_window.active = false
      @font_size_command_window.visible = false
      elsif Input.repeat?(Input::RIGHT)
        $game_system.se_play($data_system.decision_se)
       Font.default_size += 1
       if Font.default_size > 35
         Font.default_size = 35
       end       
        @font_size_command_window.refresh
      elsif Input.repeat?(Input::LEFT)
       Font.default_size -= 1
       if Font.default_size < 15
         Font.default_size = 15
       end
        @font_size_command_window.refresh
    end   
  end   
  #--------------------------------------------------------------------------
  # * Frame Update (when font command window is active)
  #--------------------------------------------------------------------------
  def update_windowskin_command   
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @windowskin_command_window.active = false
      @windowskin_command_window.visible = false
    elsif Input.repeat?(Input::RIGHT)
        $game_system.se_play($data_system.decision_se)
        @windowskin_command_window.current_skin += 1
        @windowskin_command_window.current_skin %= Juan_Configuration::Windowskins.size       
        @windowskin_command_window.refresh
        $game_system.windowskin_name = @windowskin_command_window.skin_name
    elsif Input.repeat?(Input::LEFT)
        $game_system.se_play($data_system.decision_se)
        @windowskin_command_window.current_skin += Juan_Configuration::Windowskins.size - 1
        @windowskin_command_window.current_skin %= Juan_Configuration::Windowskins.size       
        @windowskin_command_window.refresh
        $game_system.windowskin_name = @windowskin_command_window.skin_name
    elsif Input.repeat?(Input::C)
        $game_system.se_play($data_system.decision_se)
        $game_system.windowskin_name = @windowskin_command_window.skin_name
    end   
  end   
  #--------------------------------------------------------------------------
  # * Frame Update (when font command window is active)
  #--------------------------------------------------------------------------
  def update_bgm_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @bgm_command_window.active = false
      @bgm_command_window.visible = false
    elsif Input.repeat?(Input::LEFT)
      $game_system.bgm_volume -= 1
      if $game_system.bgm_volume < 0
        $game_system.bgm_volume = 0
      end
      $game_system.bgm_play($game_system.playing_bgm)
      @bgm_command_window.refresh
    elsif Input.repeat?(Input::RIGHT)
      $game_system.bgm_volume += 1
      if $game_system.bgm_volume > 100
        $game_system.bgm_volume = 100
      end
      $game_system.bgm_play($game_system.playing_bgm)
      @bgm_command_window.refresh     
     end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when font command window is active)
  #--------------------------------------------------------------------------
  def update_sfx_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @sfx_command_window.active = false
      @sfx_command_window.visible = false
    elsif Input.repeat?(Input::LEFT)
      $game_system.sfx_volume -= 1
      if $game_system.sfx_volume < 0
        $game_system.sfx_volume = 0
      end
      $game_system.se_play($data_system.cursor_se)
      @sfx_command_window.refresh
    elsif Input.repeat?(Input::RIGHT)
      $game_system.sfx_volume += 1
      if $game_system.sfx_volume > 100
        $game_system.sfx_volume = 100
      end
      $game_system.se_play($data_system.cursor_se)
      @sfx_command_window.refresh     
     end
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when battle bgm command window is active)
  #--------------------------------------------------------------------------
  def update_battle_bgm_command 
    ind = $game_variables[Juan_Configuration::Bgm_Variable]
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @battle_bgm_command_window.active = false
      @battle_bgm_command_window.visible = false
    elsif Input.repeat?(Input::LEFT)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)       
        ind = (ind+Juan_Configuration::Battle_Bgms.size-1) % Juan_Configuration::Battle_Bgms.size
        @battle_bgm_command_window.refresh
    elsif Input.repeat?(Input::RIGHT) || Input.repeat?(Input::C)
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        ind = (ind+1) % Juan_Configuration::Battle_Bgms.size
      end
       $game_variables[Juan_Configuration::Bgm_Variable] = ind
       $game_system.reset_battle_bgm
       @battle_bgm_command_window.refresh
  end
  #--------------------------------------------------------------------------
  # * Frame Update (when bar style command window is active)
  #--------------------------------------------------------------------------
  def update_bar_style_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @bar_style_command_window.active = false
      @bar_style_command_window.visible = false
    elsif Input.repeat?(Input::LEFT)
      $game_system.bar_style = ($game_system.bar_style + 6) % 7
      @bar_style_command_window.refresh
    elsif Input.repeat?(Input::RIGHT)
       $game_system.bar_style = ($game_system.bar_style + 1) % 7
       $game_system.se_play($data_system.decision_se)     
      @bar_style_command_window.refresh     
     end
  end   
  #--------------------------------------------------------------------------
  # * Frame Update (when bar style command window is active)
  #--------------------------------------------------------------------------
  def update_bar_opacity_command
    # If B button was pressed
    if Input.trigger?(Input::B)
      # Play cancel SE
      $game_system.se_play($data_system.cancel_se)
      # Switch to map screen
      @command_window.active = true
      @command_window.index = 0
      @bar_opacity_command_window.active = false
      @bar_opacity_command_window.visible = false
    elsif Input.repeat?(Input::LEFT)
      $game_system.bar_opacity -= 1
      @bar_opacity_command_window.refresh
    elsif Input.repeat?(Input::RIGHT)
      $game_system.bar_opacity += 1
       $game_system.se_play($data_system.decision_se)     
      @bar_opacity_command_window.refresh     
    end
  end
 
end



Instructions

Configure everything in Juan_Configuration module To call the option menu use $scene = Scene_Option.new


Compatibility

This script creates windows in other words it doesn't modify anything.


Credits and Thanks


  • Juan
  • Wcw
  • Susys
  • Blizzard



Author's Notes

Credit me and enjoy.

Any bugs report them here or email me at Juanito119@yahoo.com
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

fugibo

March 16, 2008, 07:35:38 pm #1 Last Edit: March 16, 2008, 07:36:46 pm by WcW
*cough* Link's broken, let me see if I can fix that for you...

EDIT:

Fix'd.

Juan

March 16, 2008, 07:46:42 pm #2 Last Edit: March 16, 2008, 09:42:53 pm by Juan
I through I fixed it.  Thanks
Edit Updated
Fixed a bug
Added Bgm changer.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Blizzard

I was just going to tell you that you can see how I made it work in my CMS, but you added the BGM changer already. :) *powers up*
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.

Flermza

Great script, Juan.
Blizz's right, you have the Battle BGM changer twice.

Juan

March 17, 2008, 04:27:21 pm #5 Last Edit: March 17, 2008, 07:54:34 pm by Juan
Thanks. Thats weird I looked through it twice. Althrough I was tired. I'll remove it in a few mins.
Edit Fixed battle bgm bug.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Fantasist

Suggestions:

1. You might want to add a preview of Bar Style too.
2. Preview of font, if it's not already there.
3. Font size change might not go well universally, I'd personally never keep that option.
4. What about BGM and SE volumes :)

Other than that, nicely done :)
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Juan

Yea I might try adding se and bgm volume but I might need help with it.  and the preview features I'll look through blizzards script to how he did it. @Fantasist   side note this is my first script that isn't based off scene_menu althrough a scene menu add on. I'm still learning to create windows.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Fantasist

Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Juan

I tried extracting the bgm and sfx volume change. I don't know if works or not althrough I'll try in a few minutes. Btw thanks for the suggestions. 
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Fantasist

hint: refer to Game_System's methods se_play, bgm_play, etc.
Do you like ambient/electronic music? Then you should promote a talented artist! Help out here. (I'm serious. Just listen to his work at least!)


The best of freeware reviews: Gizmo's Freeware Reviews




Juan

March 20, 2008, 11:49:17 pm #11 Last Edit: March 21, 2008, 12:47:54 am by Juan
Alright.  thanks edit works
Edit 2
*Puts new version*
I added bgm and sfx volume changer.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Ryex

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 />

Juan

Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

Reno-s--Joker

Sweet! I'll probably find a use for this in my game. ^^
I'll be waiting for you to update the link. :P

Calintz

So this is basically a limited Options menu...??

Juan

January 26, 2009, 05:04:36 pm #16 Last Edit: January 26, 2009, 05:18:55 pm by Juan
@Reno-s--Joker I'll be updated soon. I'm just making a new layout and one extra feature just a simple full screen options.

@Calintz16438 I guess. If you use tons it has two extra options. If you have any ideas let me know so I can inplant them.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617

G_G

Hey when you update this could you put the script in a spoiler that way the link wont be down.

Calintz


Juan

I'll try today. Since I more free time then I did yesterday.
Dropbox Who need luck when you can make your own.
3ds Friend code: ShowHide
 4468 1422  6617