reaper72004
Member
Ok firstly I edited this script from the original and took out the
Font Color, Sound test, Music test, Music Volume, Sound Volume, Bars
and added a minimap option to change which corner the minimap shows at:
@corner = [["Top Left", 1], ["Top Right", 2], ["Bottom Left", 3], ["Bottom Right", 4]]
But when i ran the script.. i got disappointed after hours of just fixing the script to show those options
on screen. For some reason when selecting either top left..etc it wouldn't change the position of the minimap.
So to see if the right number was being selected when i choose the command i inserted a print command here:
And to my disappointment when i ran the script to see if the number would show "1,2,3, or 4" it showed up as nil.. here's a screenie to show you
here's the full code:
Any help would be greatly appreciated :blank: if you need anymore info just ask
hmm... amazing what 10 min of a break can do.. I fixed the problem.
changed this:
To this:
Font Color, Sound test, Music test, Music Volume, Sound Volume, Bars
and added a minimap option to change which corner the minimap shows at:
@corner = [["Top Left", 1], ["Top Right", 2], ["Bottom Left", 3], ["Bottom Right", 4]]
But when i ran the script.. i got disappointed after hours of just fixing the script to show those options
on screen. For some reason when selecting either top left..etc it wouldn't change the position of the minimap.
So to see if the right number was being selected when i choose the command i inserted a print command here:
Code:
 def update_optionz
  case @option_window.index
  when 0
   @help_window.update("Select a corner")
   @optionz_window.refresh(@option_window.index)
   if Input.trigger?(Input::C)
    corner = @option_window.options2
       Â
    print corner <--- line 469
   Â
    $scene = Scene_Option.new(0)
    $game_system.se_play($data_system.decision_se)
   end
  end
And to my disappointment when i ran the script to see if the number would show "1,2,3, or 4" it showed up as nil.. here's a screenie to show you
here's the full code:
Code:
#===================================
# Â Leon's Option Menu v2.0
#===================================
=begin
DESCRIPTION:
This is an option menu script that gives the user 8 options:
Font
Windowskin
Font Color
Sound test
Music test
Music Volume
Sound Volume
Bars
Â
CREDITS: Â
I credit SephirothSpawn for the draw_bars. Â I learned from his tutoral, so every time I
use the bar designs, I credit him. Â Also, thanks to Jabicho and italianstal1ion for feature ideas.
Â
Features:
8 options (listed above)
Â
INSTRUCTIONS:
You can make them so they have to be unlocked through events. Â To add
these through events, use:
For Fonts:
$game_party.font_name.push(["Then name as it will appear in the game", "The font's real name"])
Â
Windowskins:
$game_party.window_skin.push(["As it appears in the game", "True Name"])
Â
Sound Test
$game_party.sound_effect.push(["Name as it appears", "true name", pitch])
Â
Music Test:
$game_party.music.push(["Name as it appears in the game", "True_Name", pitch])
Â
=end
Â
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Â Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_System
Â
 alias leon_gamesystem_optionmenu_initialize initialize
Â
Â
 def update Â
  if Kboard.keyboard($R_Key_1)
   $scene = Scene_Option.new
   return
  end
 end
Â
Â
Â
 def initialize
  leon_gamesystem_optionmenu_initialize
 Â
 end
Â
Â
Â
Â
end
Â
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Â Game_Party
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Game_Party
Â
 attr_accessor   :font_name
 attr_accessor   :window_skin
 attr_accessor   :corner
 attr_accessor   :minimap
Â
 alias leon_gp_option_initialize initialize
Â
 def initialize
  leon_gp_option_initialize
 Â
  #[Printed Name, real name], etc
  @font_name = [["Tahoma", "Tahoma"], ["Arial", "Arial"], ["Monotype Corsiva", "Monotype Corsiva"]
  ]
  @window_skin = [
  ["ffx 2", "ffx 2"], ["plainpearl_blue", "plainpearl_blue"],
  ["window_gris-cursor", "window_gris-cursor"], ["Windowskin-003-handcursor_bw", "Windowskin-003-handcursor_bw"]
  ]
  @minimap = [["Display", corner]]
  @corner = [["Top Left", 1], ["Top Right", 2], ["Bottom Left", 3], ["Bottom Right", 4]]
 Â
 Â
 Â
 end
end
Â
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Â Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Â
#----------------------------------------------------------------------
# Â Window_Optionhelp
#----------------------------------------------------------------------
class Window_Optionhelp < Window_Base
 def initialize
  super(0, 0, 640, 64)
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype
  self.contents.font.size = $defaultfontsize
 end
Â
 def update(option_help)
  self.contents.clear
  self.contents.draw_text(0, 0, 618, 32, option_help)
 end
end
Â
#----------------------------------------------------------------------
# Â Window_Optionmenu
#----------------------------------------------------------------------
class Window_Optionmenu < Window_Selectable
 def initialize
  super(0, 64, 180, 320)
  @commands = [ "MiniMap", "Font", "Window Skin"]
 Â
  @item_max = @commands.size
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype
  self.contents.font.size = $defaultfontsize
  self.index = 0
  refresh
 end
Â
 def refresh
  self.contents.clear
  for i in [email=0...@commands.size]0...@commands.size[/email]
   x = 4
   y = i * 32
   self.contents.draw_text(x, y, 148, 32, @commands[i])
  end
 end
Â
 def update_cursor_rect
  y = index * 32
  self.cursor_rect.set(0, y, self.width - 32, 32)
 end
Â
end
Â
#----------------------------------------------------------------------
# Â Window_Optionextend
#----------------------------------------------------------------------
class Window_Optionextend < Window_Selectable
 def initialize(option_index)
  super(180, 64, 150, 64)
  @option_index = option_index
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype
  self.contents.font.size = $defaultfontsize
  self.active = false
  self.visible = false
  self.index = -1
 end
Â
 def options
  if @data != nil
   return @data[index]
  end
 end
Â
 def options2
  if @data1 != nil
   return @data1[index]
  end
 end
Â
 def options3
  if @data2 != nil
   return @data2[index]
  end
 end
Â
 def refresh(option_index)
  if self.contents != nil
   self.contents.dispose
   self.contents = nil
  end
  @data = []
  @data1 = []
  @data2 = []
  case option_index
  when 0
   self.width = 180
   self.height = $game_party.minimap.size * 32 + 32
   @column_max = 1
   for i in 0...$game_party.minimap.size
    @data.push($game_party.minimap[i][0])
    @data1.push($game_party.minimap[i][1])
   end
  when 1
   self.width = 180
   self.height = $game_party.font_name.size * 32 + 32
   @column_max = 1
   for i in 0...$game_party.font_name.size
    @data.push($game_party.font_name[i][0])
    @data1.push($game_party.font_name[i][1])
   end
  when 2
   self.width = 180
   self.height = $game_party.window_skin.size * 32 + 32
   @column_max = 1
   for i in 0...$game_party.window_skin.size
    @data.push($game_party.window_skin[i][0])
    @data1.push($game_party.window_skin[i][1])
   end
 Â
  Â
  end
  @item_max = @data.size
  if @item_max > 0
   self.contents = Bitmap.new(width - 32, row_max * 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   for i in 0...@item_max
    draw_item(i, option_index)
   end
  end
 end
Â
 def draw_item(index, option_index)
  option = @data[index]
  case option_index
  when 0
   x = 4
   y = index * 32
  when 1
   x = 4
   y = index * 32
  when 2
   x = 4 + (index % 2) * (self.width /  2)
   y = index / 2 * 32
  when 3
   x = 4 + (index % 2) * (self.width /  2)
   y = index / 2 * 32
  end
  self.contents.draw_text(x, y, 140, 32, option)
 end
end
Â
#----------------------------------------------------------------------
# Â Window_Optionextendd
#----------------------------------------------------------------------
class Window_Optionextendd < Window_Selectable
 def initialize(option_index)
  super(360, 64, 150, 64)
  @option_index = option_index
  self.contents = Bitmap.new(width - 32, height - 32)
  self.contents.font.name = $defaultfonttype
  self.contents.font.size = $defaultfontsize
  self.active = false
  self.visible = false
  self.index = -1
 end
Â
 def options
  if @data != nil
   return @data[index]
  end
 end
Â
 def options2
  if @data1 != nil
   return @data1[index]
  end
 end
Â
 def options3
  if @data2 != nil
   return @data2[index]
  end
 end
Â
 def refresh(option_index)
  if self.contents != nil
   self.contents.dispose
   self.contents = nil
  end
  @data = []
  @data1 = []
  @data2 = []
  case option_index
  when 0
   self.width = 180
   self.height = $game_party.corner.size * 32 + 32
   @column_max = 1
   for i in 0...$game_party.corner.size
    @data.push($game_party.corner[i][0])
    @data1.push($game_party.corner[i][1])
    @data2.push($game_party.corner[i][2])
   end
  end
  @item_max = @data.size
  if @item_max > 0
   self.contents = Bitmap.new(width - 32, row_max * 32)
   self.contents.font.name = $defaultfonttype
   self.contents.font.size = $defaultfontsize
   for i in 0...@item_max
    draw_item(i, option_index)
   end
  end
 end
Â
 def draw_item(index, option_index)
  option = @data[index]
  case option_index
  when 0
   x = 4
   y = index * 32
  when 1
   x = 4
   y = index * 32
  when 2
   x = 4 + (index % 2) * (self.width /  2)
   y = index / 2 * 32
  when 3
   x = 4 + (index % 2) * (self.width /  2)
   y = index / 2 * 32
  end
  self.contents.draw_text(x, y, 140, 32, option)
 end
end
Â
Â
Â
#----------------------------------------------------------------------
# Â Scene_Option
#----------------------------------------------------------------------
class Scene_Option
 def initialize(menu_index = 0)
  @menu_index = menu_index
 end
Â
 def main
  @help_window = Window_Optionhelp.new
  @menu_window = Window_Optionmenu.new
  @option_window = Window_Optionextend.new(@menu_window.index)
  @optionz_window = Window_Optionextendd.new(@option_window.index)
 Â
  @menu_window.index = @menu_index
 Â
  Graphics.transition
  loop do
   Graphics.update
   Input.update
   update
   if $scene != self
    break
   end
  end
  Graphics.freeze
 Â
  @help_window.dispose
  @menu_window.dispose
  @option_window.dispose
  @optionz_window.dispose
 Â
 end
Â
 def update
  @help_window.update("Select an option")
  @menu_window.update
  @option_window.update
  @optionz_window.update
 Â
  if @menu_window.active
   update_menu
   return
  end
 Â
  if @option_window.active
   update_option
   return
  end
 Â
  if @optionz_window.active
   update_optionz
   return
  end
 Â
 end
Â
 def update_menu
  @help_window.update("Select an option")
  if @menu_window.index < 4
   if Input.trigger?(Input::C)
    $game_system.se_play($data_system.decision_se)
    @option_window.refresh(@menu_window.index)
    @menu_window.active = false
    @option_window.visible = true
    @option_window.active = true
    @optionz_window.visible = false
    @optionz_window.active = false
    @option_window.index = 0
    @optionz_window.index = 0
   Â
   end
 Â
  end
 Â
 Â
  if Input.trigger?(Input::B)
   $game_system.se_play($data_system.cancel_se)
   $scene = Scene_Map.new
  end
 end
Â
 def update_option
  case @menu_window.index
  when 0
   @help_window.update("MiniMap.")
   if Input.trigger?(Input::C)
    $game_system.se_play($data_system.decision_se)
    @option_window.refresh(@menu_window.index)
    @menu_window.active = false
    @option_window.visible = true
    @option_window.active = false
    @optionz_window.visible = true
    @optionz_window.active = true
    @option_window.index = 0
    @optionz_window.index = 0
   end
  when 1
   @help_window.update("Select a font.")
   if Input.trigger?(Input::C)
    $defaultfonttype = @option_window.options2
    $scene = Scene_Option.new(0)
    $game_system.se_play($data_system.decision_se)
   end
  when 2
   @help_window.update("Select a window skin.")
   if Input.trigger?(Input::C)
    $game_system.windowskin_name = @option_window.options2
    $scene = Scene_Option.new(1)
    $game_system.se_play($data_system.decision_se)
   end
 Â
  end
Â
  if Input.trigger?(Input::B)
   $game_system.bgm_play($game_system.bgm_memorize)
   @menu_window.active = true
   @option_window.active = false
   @option_window.visible = false
   @optionz_window.active = false
   @optionz_window.visible = false
   @option_window.index = -1
   @optionz_window.index = 0
  end
 end
Â
 def update_optionz
  case @option_window.index
  when 0
   @help_window.update("Select a corner")
   @optionz_window.refresh(@option_window.index)
   if Input.trigger?(Input::C)
    corner = @option_window.options2
       Â
    print corner
   Â
    $scene = Scene_Option.new(0)
    $game_system.se_play($data_system.decision_se)
   end
  end
 Â
Â
  if Input.trigger?(Input::B)
   $game_system.bgm_play($game_system.bgm_memorize)
   @menu_window.active = false
   @option_window.active = true
   @option_window.visible = true
   @optionz_window.visible = false
   @optionz_window.active = false
   @option_window.index = 0
   @optionz_window.index = -1
  end
 end
end
class Scene_Save < Scene_File
 alias write_save_data_leon_font write_save_data
 def write_save_data(file)
  write_save_data_leon_font(file)
  Marshal.dump([$defaultfonttype, $defaultfontsize], file)
 end
end
class Scene_Load < Scene_File
 alias read_save_data_leon_font read_save_data
 def read_save_data(file)
  read_save_data_leon_font(file)
  font_array = Marshal.load(file)
  $defaultfonttype, $defaultfontsize = font_array[0], font_array[1]
 end
end
Any help would be greatly appreciated :blank: if you need anymore info just ask
hmm... amazing what 10 min of a break can do.. I fixed the problem.
changed this:
Code:
def update_optionz
case @option_window.index
when 0
@help_window.update("Select a corner")
@optionz_window.refresh(@option_window.index)
if Input.trigger?(Input::C)
corner = @option_window.options2
print corner <--- line 469
$scene = Scene_Option.new(0)
$game_system.se_play($data_system.decision_se)
end
end
To this:
Code:
def update_optionz
case @option_window.index
when 0
@help_window.update("Select a corner")
@optionz_window.refresh(@option_window.index)
if Input.trigger?(Input::C)
if @optionz_window.index == 0
$game_party.corner = 1
$game_system.se_play($data_system.decision_se)
elsif @optionz_window.index == 1
$game_party.corner = 2
$game_system.se_play($data_system.decision_se)
elsif @optionz_window.index == 2
$game_party.corner = 3
$game_system.se_play($data_system.decision_se)
elsif @optionz_window.index == 3
$game_party.corner = 4
$game_system.se_play($data_system.decision_se)
end
print $game_party.corner
$scene = Scene_Option.new(0)
end
end