Please help me out, Im using this Quest Log Screen script by Sthrattoff and everything is working fine. Though when I want to load or save anything I get this error:
Script "Window_SaveFile" line 28: EOFError occured.
End of file reached
And this is what the line says:
@characters = Marshal.load(file)
The whole Window_SaveFile script:
Spoiler for :
#============================================================================== # ** Window_SaveFile #------------------------------------------------------------------------------ # This window displays save files on the save and load screens. #============================================================================== class Window_SaveFile < Window_Base #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :filename # file name attr_reader :selected # selected #-------------------------------------------------------------------------- # * Object Initialization # file_index : save file index (0-3) # filename : file name #-------------------------------------------------------------------------- def initialize(file_index, filename) super(0, 64 + file_index % 4 * 104, 640, 104) self.contents = Bitmap.new(width - 32, height - 32) @file_index = file_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 refresh @selected = false end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear # Draw file number 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 save file exists if @file_exist # Draw character for i in 0...@characters.size bitmap = RPG::Cache.character(@characters[0], @characters[1]) cw = bitmap.rect.width / 4 ch = bitmap.rect.height / 4 src_rect = Rect.new(0, 0, cw, ch) x = 300 - @characters.size * 32 + i * 64 - cw / 2 self.contents.blt(x, 68 - ch, bitmap, src_rect) end # Draw play time 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) # Draw timestamp 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 #-------------------------------------------------------------------------- # * Set Selected # selected : new selected (true = selected, false = unselected) #-------------------------------------------------------------------------- def selected=(selected) @selected = selected update_cursor_rect end #-------------------------------------------------------------------------- # * Cursor Rectangle Update #-------------------------------------------------------------------------- def update_cursor_rect if @selected self.cursor_rect.set(0, 0, @name_width + 8, 32) else self.cursor_rect.empty end end end
Please tell me what I need to change.
Btw. I know that it is because of the Quest Log script, cause I dont get it when I dont use the script.
This is the script I use:
#============================================================================= # Quest Log Screen #----------------------------------------------------------------------------- # ** Version 2.3 # ** Original by Sthrattoff #============================================================================= # Description : # This script enables the ability to show current active quest. # Features : # EXTREMELY SIMPLIFIED! Now the script is just about 150 lines length including comments. # Unlimited amount of quest can be added. # Use variable to mark quest's progress. # Limitation : # Only can store up to 12 progresses per quest. # History : # Version 1.0 : Initial release. # Version 1.2 : Add "Types" features. # Version 2.0 : Changes in programming style and infinite quest support. # Version 2.2 : Cut the script length to about 150 lines. # Version 2.3 : Add "Quest Progress" bar in exchange of "Types" removal. # Instruction # Just put this script above main. # Configuration : # To add a quest, fill these information by using .push # $names.push "Name" # $types.push "Type" # $description.push (["line1", "line2", ..., "Line5"]) # $objectives.push (["onjective1", ..., "objective12"]) # $var_ID.push ID_NUMBER # $end_val.push END_VALUE # Credits # See the header + Blizzard and Enterbrain #============================================================================= class Scene_Quest # Defines array variables $names = [] $description = [] $objectives = [] $var_ID = [] $end_val = [] # The main process def main @quest_list = Window_Command.new(160, $names) @quest_window = Window_Quest.new @quest_window.x = 160 Graphics.transition loop do Graphics.update Input.update update break if $scene != self end Graphics.freeze @quest_list.dispose @quest_window.dispose end def update @quest_list.update @quest_window.update if @quest_list.active update_quest return end end def update_quest if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end $id = @quest_list.index return end end class Window_Quest < Window_Base def initialize super(0, 0, 480, 480) self.contents = Bitmap.new(width - 32, height - 32) refresh end def refresh self.contents.clear self.contents.font.color = system_color self.contents.draw_text(0, 0, self.width - 32, 32, $names[$id.to_i].to_s, 1) self.contents.draw_text(0, 192, self.width - 32, 32, "Objectives", 1) self.contents.draw_text(0, 416, self.width - 32, 32, "Quest Progress") self.contents.font.color = normal_color for i in 0..4 self.contents.draw_text(0, i * 32 + 32, self.width - 32, 32, $description[$id.to_i][i].to_s) end a = b = $game_variables[$var_ID[$id.to_i]] if a > 5 self.contents.draw_text(240, (a - 6) * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][a].to_s) else self.contents.draw_text(0, a * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][a].to_s) end self.contents.font.color = disabled_color if b > 0 for j in 0..(b - 1) if j > 5 self.contents.draw_text(240, (j - 6) * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][j].to_s) else self.contents.draw_text(0, j * 32 + 224, 240, 32, "• " + $objectives[$id.to_i][j].to_s) end end end draw_quest_progress(96, 428, self.width - 128) end def update refresh end end class Window_Base < Window def draw_quest_progress(x, y, w = 200) current = $game_variables[$var_ID[$id.to_i]] ending = $end_val[$id.to_i] bordercolor = system_color outercolor = Color.new(180, 210, 120, 255) midcolor = Color.new(180, 210, 140, 255) innercolor = Color.new(180, 210, 160, 255) emptycolor = Color.new(0, 0, 0, 255) linewidth = (((current * 1.0) / ending) * (w - 2)) emptywidth = ((w - 1) - linewidth) emptyx = ((x + 1) + linewidth) border = Rect.new(x, y, w, 8) emptyline = Rect.new(x + 1, y + 1, w - 2, 6) outerline = Rect.new(x + 1, y + 1, linewidth, 6) midline = Rect.new(x + 2, y + 2, linewidth - 2, 4) innerline = Rect.new(x + 3, y + 3, linewidth - 4, 2) self.contents.fill_rect(border, bordercolor) self.contents.fill_rect(emptyline, emptycolor) self.contents.fill_rect(outerline, outercolor) self.contents.fill_rect(midline, midcolor) self.contents.fill_rect(innerline, innercolor) end end class Scene_Save < Scene_File alias old_save_data write_save_data def write_save_data(file) old_save_data Marshal.dump($names, file) Marshal.dump($description, file) Marshal.dump($objectives, file) Marshal.dump($var_ID, file) Marshal.dump($end_val, file) end end class Scene_Load < Scene_File alias old_load_data read_save_data def read_save_data(file) old_load_data $names = Marshal.load(file) $description = Marshal.load(file) $objectives = Marshal.load(file) $var_ID = Marshal.load(file) $end_val = Marshal.load(file) end end class Scene_Title alias old_new_game command_new_game def command_new_game old_new_game $names.clear $description.clear $objectives.clear $var_ID.clear $end_val.clear end end class Scene_Menu def initialize(menu_index = 0) @menu_index = menu_index size = $names.size for i in 0..size var = $var_ID[i] ending = $end_val[i] if $game_variables[var.to_i] >= ending.to_i $names.delete_at i $description.delete_at i $objectives.delete_at i $var_ID.delete_at i $end_val.delete_at i end end end end