In an attempt to better learn RGSS and in order to make my game look the way I want it to, I've been working on some custom window and scene scripts. This evening while trying to test them out, I got the "wrong number of arguments" error for one of lines in main. Since I didn't change anything in main, and I'm pretty sure nothing in main is defective, I don't know where the actual error is. Is there any chance someone with RGSS knowledge could take a look at the code and see what glaring errors there are?
Window Scripts
#=================================================================
#
# Custom Window System
#
# created by Phionabrie
#
#=================================================================
class Window_Menu < Window_Selectable
def initialize # Object Initialization
super(0, 0, 160, 288)
self.index = 0
@item.max = 8
@row.max = 8
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh # Refresh
self.contents.clear
end
end
#=================================================================
#
# Notification Window
#
#=================================================================
class Window_Notification < Window_Base
def initialize
super(100, 0, 480, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Location Window
#
#=================================================================
class Window_Location
def initialize
super(0, 352, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contets.font.color = system_color
self.contents.font.size = 18
self.contents.draw_text(0, 0, 120, 32, "Location")
self.contents.font.color = normal_color
text = $game_map.map_id
self.contents.draw_text (0, 0, 120, 32, text, 2)
end
end
#=================================================================
#
# Character Select Window
#
#=================================================================
class Window_Charselect < Window_Selectable
def initialize
super(100, 0, 480, 416)
self.index = 0
@item.max = 6
@row.max = 6
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#===============================================================
#
# Inventory Type Selection Window
#
#===============================================================
class Window_InvType < Window_Selectable
def initialize
super(0, 64, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 3
@column.max = 3
@commands = ["Consumables", "Objects", "Keys"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#================================================================
#
# Equipment Type Selection Window
#
#================================================================
class Window_EqpType < Window_Selectable
def initialize
super(0, 96, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 3
@column.max = 3
@commands = ["All Usable", "Upgrades", "Special"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
end
#================================================================
#
# Skill Type Selection Window
#
#================================================================
class Window_SklType < Window_Selectable
def initialize
super(0, 128, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 2
@column.max = 2
@commands = ["Combat", "Global"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# Status Type Selection Window
#
#================================================================
class Window_StatType < Window_Selectable
def initialize
super(0, 192, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 2
@column.max = 2
@commands = ["Status", "Biography"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# Log Type Selection Window
#
#================================================================
class Window_LogType < Window_Selectable
def initialize
super(0, 160, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 3
@column.max = 3
@commands = ["Quests", "Charts", "Factions"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# Party Type Selection Window
#
#================================================================
class Window_PtyType < Window_Selectable
def initialize
super(0, 224, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 2
@column.max = 2
@commands = ["Party", "Company"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# Record Type Selection Window
#
#================================================================
class Window_RcdType < Window_Selectable
def initialize
super(160, 256, 160, 64)
self.contents = Bitmap.new(width - 32, height - 32)
@item.max = 2
@column.max = 2
@commands = ["Save", "Load"]
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# End Game confirmation Window
#
#================================================================
class Window_QtConfirm < Window_Selectable
def initialize
super (272, 192, 96, 96)
self.index = 0
@items.max = 2
@column.max = 2
@commands = ["Yes", "No"]
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.draw_text(0, 0, 32, 32, "Are you sure you wish to quit?")
for i in 0...@item.max
draw_item(i)
end
end
end
#================================================================
#
# Key Items Window
#
#================================================================
class Window_KeyItem < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Object Items Window
#
#================================================================
class Window_ObjtItem < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Consumable Items Window
#
#================================================================
class Window_CsmItem < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 9999
@column.max = 2
@row.max = 90
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# All Usable Equipment Window
#
#================================================================
class Window_EqpUseable < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Equipment Upgrades Window
#
#================================================================
class Window_EqpUpgrade < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Special Equipment Window
#
#================================================================
class Window_EqpSpecial < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Combat Skills Window
#
#================================================================
class Window_SklCombat < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#================================================================
#
# Global Skills Window
#
#================================================================
class Window_SklGlobal < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 99
@column.max = 2
@row.max = 50
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Status Window
#
#=================================================================
class Window_Status < Window_Base
def initialize
super(0, 0, 480, 640)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Biography Window
#
#=================================================================
class Window_Biography < Window_Base
def initialize
super(0, 0, 480, 640)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Quest Window
#
#=================================================================
class Window_Quest < Window_Selectable
def initialize
super(0, 0, width, height)
self.index = 0
@item.max = 99
@column.max = 3
@row.max = 40
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Maps Window
#
#=================================================================
class Window_Charts < Window_Selectable
def initialize
super(0, 0, width, height)
self.index = 0
@item.max = 12
@column.max = 3
@row.max = 4
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Faction Window
#
#=================================================================
class Window_Faction < Window_Base
def initialize
super(0, 0, width, height)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Party Window
#
#=================================================================
class Window_Party < Window_Selectable
def initialize
super(0, 0, 320, 640)
self.index = 0
@item.max = 20
@row.max = 20
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# Guest Window
#
#=================================================================
class Window_Guest < Window_Selectable
def initialize
super(0, 0, 416, 640)
self.index = 0
@item.max = 20
@row.max = 20
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
end
end
#=================================================================
#
# SaveFile Window
#
#=================================================================
class Window_SaveFile < Window_Selectable
attr_reader :filename
def initialize
super(0, 0, 480, 640)
self.index = 0
@item.max = 16
@row.max = 16
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
for i in 0...@item.max
@file_index = self.index
@filename = "Save#{@file_index +1}.rxdata"
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
update
end
end
def update
self.contents.clear
self.contents.font.color = normal color
name = "File#{@file_index + 1}"
self.contents.draw_text(4, 0, 600, 32, name)
@name_width = contents.text_size(name).width
if @file_exist
for i in 0...@characters.size
bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1])
cw = bitmap.rect.width / 16
ch = bitmap.rect.height / 16
src_rect = Rect.new(0, 0, cw, ch)
x = 300 - @character.size * 32 + i * 64 - cw / 2
self.contents.blt(x, 68 - ch, bitmap, src_rect)
end
hour = @total_sec / 60 / 60
min = @total_sec / 60 % 60
sec = @total_sec % 60
time_string = sprintf("%02d:%02d:%02d", hour, min, sec)
self.contents.font.color = normal_color
self.contents.draw_text(4, 8, 600, 32, time_string, 2)
self.contents.font.color = normal_color
time_string = @time_stamp.strftime("%Y/%m/%d %H:%M")
self.contents.draw_text(4, 40, 600, 32, time_string, 2)
end
end
end
Menu Script
#=================================================================
#
# Scene Menu
#
#=================================================================
class Scene_Menu
def initialise
@menu = Window_Menu.new
end
def main
s1 = "Inventory"
s2 = "Equipment"
s3 = "Skills"
s4 = "Journal"
s5 = "Persona"
s6 = "Entourage"
s7 = "Record"
s8 = "Egress"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8])
@command_window.index = @menu.index
if $game_party.actors.size == 0 #if no actors in party
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
@command_window.disable_item(4)
@command_window.disable_item(5)
end
@playtime_window = Window_PlayTime.new
@playtime_window.x = 0
@playtime_window.y = 288
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 416
@location_window = Window_Location.new
@notification_window = Window_Notification.new
@charselect_window = Window_Charselect.new
Graphics.transition #excecute transition
loop do #main loop
Graphics.update #update game screen
Input.update #update input information
update #frame update
if $scene != self #end loop if new screen
break
end
end
Graphics.freeze #prepare for transition
@command_window.dispose
@playtime_window.dispose
@gold_window.dispose
@location_window.dispose
@notification_window.dispose
@charselect_window.dispose
end
#================================================================
#
# Frame Update
#
#================================================================
def update #update windows
@command_window.update
@playtime_window.update
@gold_window.update
@location_window.update
@notification_window.update
@charselect_window.update
if @command_window.active #call update_command if command window is active
update_command
return
end
if @charselect_window.active
update_charselect
return
end
end
#================================================================
#
# Frame Update (command window active)
#
#================================================================
def update_command
if Input.trigger?(Input::B) #cancel menu
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new #exit to map
return
end
if Input.trigger?(Input::C) #make selection
if $game_party.actors.size == 0 and @command_window < 6
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0 #inventory
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@opti_window = Window_InvType.new
@opti_window.active = true
when 1 #equipment
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optg_window = window_EqpType.new
@optg_window.active = true
when 2 #skills
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optk_window = Window_SklType.new
@optk_window.active = true
when 3 #journal
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optl_window = Window_LogType.new
@optl_window.active = true
when 4 #persona
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optc_window = Window_StatType.new
@optc_window.active = true
when 5 #entourage
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optp_window = Window_PtyType.new
@optp_window.active = true
when 6 #record
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@opts_window = Window_RcdType.new
@opts_window.active = true
when 7 #egress
$game_system.se_play($data_system.decision_se)
@command_window.active = false
@optq_window = Window_QtConfirm.new
@optq_window.active = true
end
return
end
if @opti_window.active
update_opti
return
end
if @optg_window.active
update_optg
return
end
if @optk_window.active
update_optk
return
end
if @optl_window.active
update_optl
return
end
if @optc_window.active
update_optc
return
end
if @optp_window.active
update_optp
return
end
if @opts_window.active
update_opts
return
end
if @optq_window.active
update_optq
return
end
end
#=================================================================
#
# Frame Update (item options active)
#
#=================================================================
def update_opti
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@opti_window.active = false
@opti_window.visible = false
@command_window.active = true
return
end
if Input.trigger?(Input::C) #make selection
case @opti_window.index
when 0 #consumables
$game_system.se_play($data_system.decision_se)
$scene = Scene_CsmItem.new
when 1 #objects
$game_system.se_play($data_system.decision_se)
$scene = Scene_ObjtItem.new
when 2 #keys
$game_system.se_play($data_system.decision_se)
$scene = Scene_KeyItem.new
end
return
end
end
#=================================================================
#
# Frame Update (equip options active)
#
#=================================================================
def update_optg
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@optg_window.active = false
@optg_window.visible = false
@command_window.active = true
end
if Input.trigger?(Input::C) #make selection
$game_system.se_play($data_system.decision_se)
@optg_window.active = false
@charselect_window.active = true
end
end
#=================================================================
#
# Frame Update (skill options active)
#
#=================================================================
def update_optk
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@optk_window.active = false
@optk_window.visible = false
@command_window.active = true
end
if Input.trigger?(Input::C) #make selection
$game_system.se_play($data_system.decision_se)
@optk_window.active = false
@charselect_window.active = true
end
end
#=================================================================
#
# Frame Update (journal options active)
#
#=================================================================
def update_optl
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@optl_window.active = false
@optl_window.visible = false
@notification_window.visible = true
@command_window.active = true
return
end
if Input.trigger?(Input::C)
case @optl_window.index
when 0 #quest
$game_system.se_play($data_system.decision_se)
$scene = Scene_Quest.new
when 1 #maps
$game_system.se_play($data_system.decision_se)
$scene = Scene_Charts.new
when 2 #factions
$game_system.se_play($data_system.decision_se)
$scene = Scene_Faction.new
end
return
end
end
#=================================================================
#
# Frame Update (persona options active)
#
#=================================================================
def update_optc
if Input.trigger?(Input::B) #cancel
$game_system.se_play($data_system.cancel_se)
@optc_window.active = false
@optc_window.visible = false
@command_window.active = true
end
if Input.trigger?(Input::C) #make selection
$game_system.se_play($data_system.decision_se)
@optc_window.active = false
@charselect_window.active = true
end
end
#=================================================================
#
# Frame Update (entourage options active)
#
#=================================================================
def update_optp
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@optp_window.active = false
@optp_window.visible = false
return
end
if Input.trigger?(Input::C)
case @optp_window.index
when 0 #party
$game_system.se_play($data_system.decision_se)
$scene = Scene_Party_Change
when 1 #company
$game_system.se_play($data_system.decision_se)
$scene = Scene_Guest
end
return
end
end
#=================================================================
#
# Frame Update (record options active)
#
#=================================================================
def update_opts
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@opts_window.active = false
@opts_window.visible = false
return
end
if Input.trigger?(Input::C)
case @opts_window.index
when 0 #save
if $game_system.save_disabled
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$scene = Scene_Save
when 1 #load
$game_system.se_play($data_system.decision_se)
@command_window.visible = true
$scene = Scene_Load
end
return
end
end
#=================================================================
#
# Frame Update (quit confimation)
#
#=================================================================
def update_optq
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@optq_window.active = false
@optq_window.visible = false
@command_window.active = true
return
end
if Input.trigger?(Input::C)
case @optq_window.index
when 0 #yes
$game_system.se_play($data_system.decision_se)
$scene = Scene_Exit
when 1 #no
$game_system.se_play($data_system.cancel_se)
@optq_window.active = false
@optq_window.visible = false
@command_window.active = true
end
return
end
end
#=================================================================
#
# Frame Update (charselect active)
#
#=================================================================
def update_charselect
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
@command_window.active = true
@charselect_window.active = false
@charselect_widow.index = -1
return
end
if Input.trigger?(Input::C)
case @optg_window.index
when 0 #all usable
$game_system.se_play($data_system.decision_se)
$scene = Scene_EqpUsable.new
when 1 #upgrades
$game_system.se_play($data_system.decision_se)
$scene = Scene_EqpUpgrade.new
when 2 #special
$game_system.se_play($data_system.decision_se)
$scene = Scene_EqpSpecial.new
end
case @optk_window.index
when 0 #
$game_system.se_play($data_system.decision_se)
$scene = Scene_CSkill.new
when 1 #
$game_system.se_play($data_system.decision_se)
$scene = Scene_GSkill.new
end
case @optc_window.index
when 0 #status
$game_system.se_play($data_system.decision_se)
$scene = Scene_Status.new
when 1 #biography
$game_system.se_play($data_system.decision_se)
$scene = Scene_Biography.new
end
return
end
end
end
Custom Scenes Script
#=================================================================
#
# Scene Character Select
#
#=================================================================
class Scene_Charselect
def initialize(actor_index = 0, equip_index = 0)
@actor_index = actor_index
end
def main
@actor = $game_party.actors[@actor_index]
@charselect_window = Window_Charselect.new(@actor)
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
end
#=================================================================
# Frame Update
#=================================================================
def update
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new
return
end
if Input.trigger?(Input::R)
$game_system.se_play($data_system.cursor_se)
@actor_index += 1
@actor_index%= $game_party.actors.size
$scene = Scene_Charselect.new(@actor_index)
return
end
if Input.trigger?(Input::L)
$game_system.se_play($data_system.cursor_se)
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
$scene = Scene_Charselect.new(@actor_index)
return
end
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene File
#
#=================================================================
def initialize(help_text)
@help_text = help_text
end
def main
@help_window = Window_Help.new
@help_window.set_text(@help_text)
@savefile_windows = []
for i in 0...16
@savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
end
@file_index = $game_temp.last_file_index
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@help_window.dispose
for i in @savefile_windows
i.dispose
end
#=================================================================
# Frame Update
#=================================================================
def update
@help_window.update
for i in @savefile_windows
i.update
end
if Input.trigger?(Input::B)
on_cancel
return
end
if Input.trigger?(Input::C)
on_decision(make_filename(@file_index))
$game_temp.last_file_index = @file_index
return
end
end
#=================================================================
# Make File Name
#=================================================================
def make_filename
return "Save#{self.index + 1}.rxdata"
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Save
#
#=================================================================
class Scene_Save < Scene_File
def initialize
super("Which file would you like to save to?")
end
#=================================================================
# Decision Processing
#=================================================================
def on_decision(filename)
$game_system.se_play($data_system.save_se)
file = File.open(filename, "wb")
write_save_data(file)
file.close
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Menu.new
end
#=================================================================
# Cancel Processing
#=================================================================
def on_cancel
$game_system.se_play($data_system.cancel_se)
if $game_temp.save_calling
$game_temp.save_calling = false
$scene = Scene_Map.new
return
end
$scene = Scene_Map.new
end
#=================================================================
# Write Save Data
#=================================================================
def write_save_data(file)
characters = []
for i in 0...$game_party.actors.size
actor = $game_party.actors[i]
characters.push([actor.character_name, actor.character_hue])
end
Marshal.dump(characters, file)
Marshal.dump(Graphics.frame_count, file)
$game_system.save_count += 1
$game_system.magic_number = $data_system.magic_number
Marshal.dump($game_system, file)
Marshal.dump($game_switches, file)
Marshal.dump($game_variables, file)
Marshal.dump($game_self_switches, file)
Marshal.dump($game_screen, file)
Marshal.dump($game_actors, file)
Marshal.dump($game_party, file)
Marshal.dump($game_troop, file)
Marshal.dump($game_map, file)
Marshal.dump($game_player, file)
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Load
#
#=================================================================
class Scene_Load < Scene_File
def initialize
$game_temp = Game_Temp.new
$game_temp.last_file_index = 0
latest_time = Time.at(0)
for i in 0...16
filename = make_filename(i)
if FileTest.exist?(filename)
file = File.open(filename, "r")
if file.mtime > latest_time
latest_time = file.mtime
end
file.close
end
end
super("Which file would you like to load?")
end
#=================================================================
# Decision Processing
#=================================================================
def on_decision(filename)
unless FileTest.exist?(filename)
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.load_se)
file = File.open(filename, "rb")
read_save_data(file)
file.close
$game_system.bgm_play($game_system.playing_bgm)
$game_system.bgs_play($game_system.playing_bgs)
$game_map.update
$scene = Scene_Map.new
end
#=================================================================
# Cancel Processing
#=================================================================
def on_cancel
$game_system.se_play($data_system.cancel_se)
if @opts_window.load_calling
$scene = Scene_Map.new
else
$scene = Scene_Map.new
end
return
end
#=================================================================
# Read Save Data
#=================================================================
def read_save_data(file)
characters = Marshal.load(file)
Graphics.frame_count = Marshal.load(file)
$game_system = Marshal.load(file)
$game_switches = Marshal.load(file)
$game_variables = Marshal.load(file)
$game_self_switches = Marshal.load(file)
$game_screen = Marshal.load(file)
$game_actors = Marshal.load(file)
$game_party = Marshal.load(file)
$game_troop = Marshal.load(file)
$game_map = Marshal.load(file)
$game_player = Marshal.load(file)
if $game_system.magic_number != $data_system.magic_number
$game_map.setup($game_map.map_id)
$game_player.center($game_player.x, $game_player.y)
end
$game_party.refresh
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Biography
#
#=================================================================
class Scene_Biography
def initialize
end
def main
@biography_window = Window_Biography.new
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Guest
#
#=================================================================
class Scene_Guest
def initialize
end
def main
@guest_window = Window_Guest.new
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Faction
#
#=================================================================
class Scene_Faction
def initialize
end
def main
@faction_window = Window_Faction.new
end
end
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#=================================================================
#
# Scene Charts
#
#=================================================================
class Scene_Charts
def initialize
end
def main
@charts_window = Window_Charts.new
end
end
In an attempt to better learn RGSS and in order to make my game look the way I want it to, I've been working on some custom window and scene scripts. This evening while trying to test them out, I got the "wrong number of arguments" error for one of lines in main. Since I didn't change anything in main, and I'm pretty sure nothing in main is defective, I don't know where the actual error is. Is there any chance someone with RGSS knowledge could take a look at the code and see what glaring errors there are?
Window Scripts
#================================================================= # # Custom Window System # # created by Phionabrie # #================================================================= class Window_Menu < Window_Selectable def initialize # Object Initialization super(0, 0, 160, 288) self.index = 0 @item.max = 8 @row.max = 8 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh # Refresh self.contents.clear end end #================================================================= # # Notification Window # #================================================================= class Window_Notification < Window_Base def initialize super(100, 0, 480, 64) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Location Window # #================================================================= class Window_Location def initialize super(0, 352, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear self.contets.font.color = system_color self.contents.font.size = 18 self.contents.draw_text(0, 0, 120, 32, "Location") self.contents.font.color = normal_color text = $game_map.map_id self.contents.draw_text (0, 0, 120, 32, text, 2) end end #================================================================= # # Character Select Window # #================================================================= class Window_Charselect < Window_Selectable def initialize super(100, 0, 480, 416) self.index = 0 @item.max = 6 @row.max = 6 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #=============================================================== # # Inventory Type Selection Window # #=============================================================== class Window_InvType < Window_Selectable def initialize super(0, 64, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 3 @column.max = 3 @commands = ["Consumables", "Objects", "Keys"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end end #================================================================ # # Equipment Type Selection Window # #================================================================ class Window_EqpType < Window_Selectable def initialize super(0, 96, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 3 @column.max = 3 @commands = ["All Usable", "Upgrades", "Special"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item_max draw_item(i) end end end #================================================================ # # Skill Type Selection Window # #================================================================ class Window_SklType < Window_Selectable def initialize super(0, 128, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 2 @column.max = 2 @commands = ["Combat", "Global"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item.max draw_item(i) end end end #================================================================ # # Status Type Selection Window # #================================================================ class Window_StatType < Window_Selectable def initialize super(0, 192, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 2 @column.max = 2 @commands = ["Status", "Biography"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item.max draw_item(i) end end end #================================================================ # # Log Type Selection Window # #================================================================ class Window_LogType < Window_Selectable def initialize super(0, 160, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 3 @column.max = 3 @commands = ["Quests", "Charts", "Factions"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item.max draw_item(i) end end end #================================================================ # # Party Type Selection Window # #================================================================ class Window_PtyType < Window_Selectable def initialize super(0, 224, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 2 @column.max = 2 @commands = ["Party", "Company"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item.max draw_item(i) end end end #================================================================ # # Record Type Selection Window # #================================================================ class Window_RcdType < Window_Selectable def initialize super(160, 256, 160, 64) self.contents = Bitmap.new(width - 32, height - 32) @item.max = 2 @column.max = 2 @commands = ["Save", "Load"] refresh self.index = 0 end def refresh self.contents.clear for i in 0...@item.max draw_item(i) end end end #================================================================ # # End Game confirmation Window # #================================================================ class Window_QtConfirm < Window_Selectable def initialize super (272, 192, 96, 96) self.index = 0 @items.max = 2 @column.max = 2 @commands = ["Yes", "No"] self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear self.contents.draw_text(0, 0, 32, 32, "Are you sure you wish to quit?") for i in 0...@item.max draw_item(i) end end end #================================================================ # # Key Items Window # #================================================================ class Window_KeyItem < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Object Items Window # #================================================================ class Window_ObjtItem < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Consumable Items Window # #================================================================ class Window_CsmItem < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 9999 @column.max = 2 @row.max = 90 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # All Usable Equipment Window # #================================================================ class Window_EqpUseable < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Equipment Upgrades Window # #================================================================ class Window_EqpUpgrade < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Special Equipment Window # #================================================================ class Window_EqpSpecial < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Combat Skills Window # #================================================================ class Window_SklCombat < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================ # # Global Skills Window # #================================================================ class Window_SklGlobal < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 99 @column.max = 2 @row.max = 50 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Status Window # #================================================================= class Window_Status < Window_Base def initialize super(0, 0, 480, 640) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Biography Window # #================================================================= class Window_Biography < Window_Base def initialize super(0, 0, 480, 640) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Quest Window # #================================================================= class Window_Quest < Window_Selectable def initialize super(0, 0, width, height) self.index = 0 @item.max = 99 @column.max = 3 @row.max = 40 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Maps Window # #================================================================= class Window_Charts < Window_Selectable def initialize super(0, 0, width, height) self.index = 0 @item.max = 12 @column.max = 3 @row.max = 4 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Faction Window # #================================================================= class Window_Faction < Window_Base def initialize super(0, 0, width, height) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Party Window # #================================================================= class Window_Party < Window_Selectable def initialize super(0, 0, 320, 640) self.index = 0 @item.max = 20 @row.max = 20 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # Guest Window # #================================================================= class Window_Guest < Window_Selectable def initialize super(0, 0, 416, 640) self.index = 0 @item.max = 20 @row.max = 20 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear end end #================================================================= # # SaveFile Window # #================================================================= class Window_SaveFile < Window_Selectable attr_reader :filename def initialize super(0, 0, 480, 640) self.index = 0 @item.max = 16 @row.max = 16 self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh for i in 0...@item.max @file_index = self.index @filename = "Save#{@file_index +1}.rxdata" @time_stamp = Time.at(0) @file_exist = FileTest.exist?(@filename) if @file_exist file = File.open(@filename, "r") @time_stamp = file.mtime @characters = Marshal.load(file) @frame_count = Marshal.load(file) @game_system = Marshal.load(file) @game_switches = Marshal.load(file) @game_variables = Marshal.load(file) @total_sec = @frame_count / Graphics.frame_rate file.close end update end end def update self.contents.clear self.contents.font.color = normal color name = "File#{@file_index + 1}" self.contents.draw_text(4, 0, 600, 32, name) @name_width = contents.text_size(name).width if @file_exist for i in 0...@characters.size bitmap = RPG::Cache.character(@characters[i][0], @characters[i][1]) cw = bitmap.rect.width / 16 ch = bitmap.rect.height / 16 src_rect = Rect.new(0, 0, cw, ch) x = 300 - @character.size * 32 + i * 64 - cw / 2 self.contents.blt(x, 68 - ch, bitmap, src_rect) end hour = @total_sec / 60 / 60 min = @total_sec / 60 % 60 sec = @total_sec % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) self.contents.font.color = normal_color self.contents.draw_text(4, 8, 600, 32, time_string, 2) self.contents.font.color = normal_color time_string = @time_stamp.strftime("%Y/%m/%d %H:%M") self.contents.draw_text(4, 40, 600, 32, time_string, 2) end end end#================================================================= # # Scene Menu # #================================================================= class Scene_Menu def initialise @menu = Window_Menu.new end def main s1 = "Inventory" s2 = "Equipment" s3 = "Skills" s4 = "Journal" s5 = "Persona" s6 = "Entourage" s7 = "Record" s8 = "Egress" @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7, s8]) @command_window.index = @menu.index if $game_party.actors.size == 0 #if no actors in party @command_window.disable_item(0) @command_window.disable_item(1) @command_window.disable_item(2) @command_window.disable_item(3) @command_window.disable_item(4) @command_window.disable_item(5) end @playtime_window = Window_PlayTime.new @playtime_window.x = 0 @playtime_window.y = 288 @gold_window = Window_Gold.new @gold_window.x = 0 @gold_window.y = 416 @location_window = Window_Location.new @notification_window = Window_Notification.new @charselect_window = Window_Charselect.new Graphics.transition #excecute transition loop do #main loop Graphics.update #update game screen Input.update #update input information update #frame update if $scene != self #end loop if new screen break end end Graphics.freeze #prepare for transition @command_window.dispose @playtime_window.dispose @gold_window.dispose @location_window.dispose @notification_window.dispose @charselect_window.dispose end #================================================================ # # Frame Update # #================================================================ def update #update windows @command_window.update @playtime_window.update @gold_window.update @location_window.update @notification_window.update @charselect_window.update if @command_window.active #call update_command if command window is active update_command return end if @charselect_window.active update_charselect return end end #================================================================ # # Frame Update (command window active) # #================================================================ def update_command if Input.trigger?(Input::B) #cancel menu $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new #exit to map return end if Input.trigger?(Input::C) #make selection if $game_party.actors.size == 0 and @command_window < 6 $game_system.se_play($data_system.buzzer_se) return end case @command_window.index when 0 #inventory $game_system.se_play($data_system.decision_se) @command_window.active = false @opti_window = Window_InvType.new @opti_window.active = true when 1 #equipment $game_system.se_play($data_system.decision_se) @command_window.active = false @optg_window = window_EqpType.new @optg_window.active = true when 2 #skills $game_system.se_play($data_system.decision_se) @command_window.active = false @optk_window = Window_SklType.new @optk_window.active = true when 3 #journal $game_system.se_play($data_system.decision_se) @command_window.active = false @optl_window = Window_LogType.new @optl_window.active = true when 4 #persona $game_system.se_play($data_system.decision_se) @command_window.active = false @optc_window = Window_StatType.new @optc_window.active = true when 5 #entourage $game_system.se_play($data_system.decision_se) @command_window.active = false @optp_window = Window_PtyType.new @optp_window.active = true when 6 #record $game_system.se_play($data_system.decision_se) @command_window.active = false @opts_window = Window_RcdType.new @opts_window.active = true when 7 #egress $game_system.se_play($data_system.decision_se) @command_window.active = false @optq_window = Window_QtConfirm.new @optq_window.active = true end return end if @opti_window.active update_opti return end if @optg_window.active update_optg return end if @optk_window.active update_optk return end if @optl_window.active update_optl return end if @optc_window.active update_optc return end if @optp_window.active update_optp return end if @opts_window.active update_opts return end if @optq_window.active update_optq return end end #================================================================= # # Frame Update (item options active) # #================================================================= def update_opti if Input.trigger?(Input::B) #cancel $game_system.se_play($data_system.cancel_se) @opti_window.active = false @opti_window.visible = false @command_window.active = true return end if Input.trigger?(Input::C) #make selection case @opti_window.index when 0 #consumables $game_system.se_play($data_system.decision_se) $scene = Scene_CsmItem.new when 1 #objects $game_system.se_play($data_system.decision_se) $scene = Scene_ObjtItem.new when 2 #keys $game_system.se_play($data_system.decision_se) $scene = Scene_KeyItem.new end return end end #================================================================= # # Frame Update (equip options active) # #================================================================= def update_optg if Input.trigger?(Input::B) #cancel $game_system.se_play($data_system.cancel_se) @optg_window.active = false @optg_window.visible = false @command_window.active = true end if Input.trigger?(Input::C) #make selection $game_system.se_play($data_system.decision_se) @optg_window.active = false @charselect_window.active = true end end #================================================================= # # Frame Update (skill options active) # #================================================================= def update_optk if Input.trigger?(Input::B) #cancel $game_system.se_play($data_system.cancel_se) @optk_window.active = false @optk_window.visible = false @command_window.active = true end if Input.trigger?(Input::C) #make selection $game_system.se_play($data_system.decision_se) @optk_window.active = false @charselect_window.active = true end end #================================================================= # # Frame Update (journal options active) # #================================================================= def update_optl if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @optl_window.active = false @optl_window.visible = false @notification_window.visible = true @command_window.active = true return end if Input.trigger?(Input::C) case @optl_window.index when 0 #quest $game_system.se_play($data_system.decision_se) $scene = Scene_Quest.new when 1 #maps $game_system.se_play($data_system.decision_se) $scene = Scene_Charts.new when 2 #factions $game_system.se_play($data_system.decision_se) $scene = Scene_Faction.new end return end end #================================================================= # # Frame Update (persona options active) # #================================================================= def update_optc if Input.trigger?(Input::B) #cancel $game_system.se_play($data_system.cancel_se) @optc_window.active = false @optc_window.visible = false @command_window.active = true end if Input.trigger?(Input::C) #make selection $game_system.se_play($data_system.decision_se) @optc_window.active = false @charselect_window.active = true end end #================================================================= # # Frame Update (entourage options active) # #================================================================= def update_optp if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @optp_window.active = false @optp_window.visible = false return end if Input.trigger?(Input::C) case @optp_window.index when 0 #party $game_system.se_play($data_system.decision_se) $scene = Scene_Party_Change when 1 #company $game_system.se_play($data_system.decision_se) $scene = Scene_Guest end return end end #================================================================= # # Frame Update (record options active) # #================================================================= def update_opts if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @opts_window.active = false @opts_window.visible = false return end if Input.trigger?(Input::C) case @opts_window.index when 0 #save if $game_system.save_disabled $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.decision_se) $scene = Scene_Save when 1 #load $game_system.se_play($data_system.decision_se) @command_window.visible = true $scene = Scene_Load end return end end #================================================================= # # Frame Update (quit confimation) # #================================================================= def update_optq if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @optq_window.active = false @optq_window.visible = false @command_window.active = true return end if Input.trigger?(Input::C) case @optq_window.index when 0 #yes $game_system.se_play($data_system.decision_se) $scene = Scene_Exit when 1 #no $game_system.se_play($data_system.cancel_se) @optq_window.active = false @optq_window.visible = false @command_window.active = true end return end end #================================================================= # # Frame Update (charselect active) # #================================================================= def update_charselect if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @charselect_window.active = false @charselect_widow.index = -1 return end if Input.trigger?(Input::C) case @optg_window.index when 0 #all usable $game_system.se_play($data_system.decision_se) $scene = Scene_EqpUsable.new when 1 #upgrades $game_system.se_play($data_system.decision_se) $scene = Scene_EqpUpgrade.new when 2 #special $game_system.se_play($data_system.decision_se) $scene = Scene_EqpSpecial.new end case @optk_window.index when 0 # $game_system.se_play($data_system.decision_se) $scene = Scene_CSkill.new when 1 # $game_system.se_play($data_system.decision_se) $scene = Scene_GSkill.new end case @optc_window.index when 0 #status $game_system.se_play($data_system.decision_se) $scene = Scene_Status.new when 1 #biography $game_system.se_play($data_system.decision_se) $scene = Scene_Biography.new end return end end endCustom Scenes Script
#================================================================= # # Scene Character Select # #================================================================= class Scene_Charselect def initialize(actor_index = 0, equip_index = 0) @actor_index = actor_index end def main @actor = $game_party.actors[@actor_index] @charselect_window = Window_Charselect.new(@actor) Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze end #================================================================= # Frame Update #================================================================= def update if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Menu.new return end if Input.trigger?(Input::R) $game_system.se_play($data_system.cursor_se) @actor_index += 1 @actor_index%= $game_party.actors.size $scene = Scene_Charselect.new(@actor_index) return end if Input.trigger?(Input::L) $game_system.se_play($data_system.cursor_se) @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size $scene = Scene_Charselect.new(@actor_index) return end end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene File # #================================================================= def initialize(help_text) @help_text = help_text end def main @help_window = Window_Help.new @help_window.set_text(@help_text) @savefile_windows = [] for i in 0...16 @savefile_windows.push(Window_SaveFile.new(i, make_filename(i))) end @file_index = $game_temp.last_file_index Graphics.transition loop do Graphics.update Input.update update if $scene != self break end end Graphics.freeze @help_window.dispose for i in @savefile_windows i.dispose end #================================================================= # Frame Update #================================================================= def update @help_window.update for i in @savefile_windows i.update end if Input.trigger?(Input::B) on_cancel return end if Input.trigger?(Input::C) on_decision(make_filename(@file_index)) $game_temp.last_file_index = @file_index return end end #================================================================= # Make File Name #================================================================= def make_filename return "Save#{self.index + 1}.rxdata" end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Save # #================================================================= class Scene_Save < Scene_File def initialize super("Which file would you like to save to?") end #================================================================= # Decision Processing #================================================================= def on_decision(filename) $game_system.se_play($data_system.save_se) file = File.open(filename, "wb") write_save_data(file) file.close if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new return end $scene = Scene_Menu.new end #================================================================= # Cancel Processing #================================================================= def on_cancel $game_system.se_play($data_system.cancel_se) if $game_temp.save_calling $game_temp.save_calling = false $scene = Scene_Map.new return end $scene = Scene_Map.new end #================================================================= # Write Save Data #================================================================= def write_save_data(file) characters = [] for i in 0...$game_party.actors.size actor = $game_party.actors[i] characters.push([actor.character_name, actor.character_hue]) end Marshal.dump(characters, file) Marshal.dump(Graphics.frame_count, file) $game_system.save_count += 1 $game_system.magic_number = $data_system.magic_number Marshal.dump($game_system, file) Marshal.dump($game_switches, file) Marshal.dump($game_variables, file) Marshal.dump($game_self_switches, file) Marshal.dump($game_screen, file) Marshal.dump($game_actors, file) Marshal.dump($game_party, file) Marshal.dump($game_troop, file) Marshal.dump($game_map, file) Marshal.dump($game_player, file) end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Load # #================================================================= class Scene_Load < Scene_File def initialize $game_temp = Game_Temp.new $game_temp.last_file_index = 0 latest_time = Time.at(0) for i in 0...16 filename = make_filename(i) if FileTest.exist?(filename) file = File.open(filename, "r") if file.mtime > latest_time latest_time = file.mtime end file.close end end super("Which file would you like to load?") end #================================================================= # Decision Processing #================================================================= def on_decision(filename) unless FileTest.exist?(filename) $game_system.se_play($data_system.buzzer_se) return end $game_system.se_play($data_system.load_se) file = File.open(filename, "rb") read_save_data(file) file.close $game_system.bgm_play($game_system.playing_bgm) $game_system.bgs_play($game_system.playing_bgs) $game_map.update $scene = Scene_Map.new end #================================================================= # Cancel Processing #================================================================= def on_cancel $game_system.se_play($data_system.cancel_se) if @opts_window.load_calling $scene = Scene_Map.new else $scene = Scene_Map.new end return end #================================================================= # Read Save Data #================================================================= def read_save_data(file) characters = Marshal.load(file) Graphics.frame_count = Marshal.load(file) $game_system = Marshal.load(file) $game_switches = Marshal.load(file) $game_variables = Marshal.load(file) $game_self_switches = Marshal.load(file) $game_screen = Marshal.load(file) $game_actors = Marshal.load(file) $game_party = Marshal.load(file) $game_troop = Marshal.load(file) $game_map = Marshal.load(file) $game_player = Marshal.load(file) if $game_system.magic_number != $data_system.magic_number $game_map.setup($game_map.map_id) $game_player.center($game_player.x, $game_player.y) end $game_party.refresh end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Biography # #================================================================= class Scene_Biography def initialize end def main @biography_window = Window_Biography.new end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Guest # #================================================================= class Scene_Guest def initialize end def main @guest_window = Window_Guest.new end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Faction # #================================================================= class Scene_Faction def initialize end def main @faction_window = Window_Faction.new end end #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #================================================================= # # Scene Charts # #================================================================= class Scene_Charts def initialize end def main @charts_window = Window_Charts.new end endNext time use a code box
Share this post
Link to post
Share on other sites