RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
EOFError?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 87
~Be Cool~
 :tpg:

Can't save nor load.

keeps saying their is an EOFError.

Can any help me please?





******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009

***
Rep:
Level 87
~Be Cool~
Oh yeah, sorry was in a rush.

When I load...

????? 'Window_SaveFile' ? 30 ??? EOFError ????????

End of file reached


Code: [Select]
#==============================================================================
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_reader   :filename                 # ?????
  attr_reader   :selected                 # ????
  #--------------------------------------------------------------------------
  # ? ?????????
  #     file_index : ?????????????? (0?3)
  #     filename   : ?????
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 64 + file_index % 4 * 104, 640, 104)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype  # "File" (File #) window font
    self.contents.font.size = $defaultfontsize
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.sav"
    @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
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    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 / 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
      # ????????
      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
  #--------------------------------------------------------------------------
  # ? ???????
  #     selected : ??????? (true=?? false=???)
  #--------------------------------------------------------------------------
  def selected=(selected)
    @selected = selected
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @selected
      self.cursor_rect.set(0, 0, @name_width + 8, 32)
    else
      self.cursor_rect.empty
    end
  end
end


When i attempt to save...

????? 'Window_SaveFile' ? 30 ??? EOFError ????????

End of file reached


Code: [Select]
#==============================================================================
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================

class Window_SaveFile < Window_Base
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  attr_reader   :filename                 # ?????
  attr_reader   :selected                 # ????
  #--------------------------------------------------------------------------
  # ? ?????????
  #     file_index : ?????????????? (0?3)
  #     filename   : ?????
  #--------------------------------------------------------------------------
  def initialize(file_index, filename)
    super(0, 64 + file_index % 4 * 104, 640, 104)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = $defaultfonttype  # "File" (File #) window font
    self.contents.font.size = $defaultfontsize
    @file_index = file_index
    @filename = "Save#{@file_index + 1}.sav"
    @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
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  def refresh
    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 / 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
      # ????????
      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
  #--------------------------------------------------------------------------
  # ? ???????
  #     selected : ??????? (true=?? false=???)
  #--------------------------------------------------------------------------
  def selected=(selected)
    @selected = selected
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # ? ?????????
  #--------------------------------------------------------------------------
  def update_cursor_rect
    if @selected
      self.cursor_rect.set(0, 0, @name_width + 8, 32)
    else
      self.cursor_rect.empty
    end
  end
end



pokeball WcWOfflineMale
***
Rep:
Level 87
2 + 2 is a math problem, NOT 4.
And your custom scripts....?
If you are reading this, the government of the U.S.A. is currently planting a chip in your brain.
People like decreasing my Rep. In fact, people like decreasing most others people's rep.

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
Usually an EOFError occurs during loading when you are attempting to load data that is not stored in that particular save file. I.E $game_card = Marshal.load(file) when there is no $game_card data saved in a save file.

As for the EOFError when you're trying to save...I'm guessing the game is trying to save data that doesn't exist?

Code: [Select]
@characters = Marshal.load(file)
That's the line causing an error when you try to load OR save??? Strange...that snippet of code is used in an unaltered Window_Savefile and the Window_Savefile you posted IS unaltered. That makes this even stranger.

Like WcW asked, what custom scripts are you using? Also, what version of RMXP are you using?

Side Note:I know my siggy says I'm not scripting anything but I do have enough time here and there to troubleshoot some script problems. Also, isn't this supposed to be in the Script Help section???

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
Shinami's right, though I believe he left out the error can occur when the data is not loaded in order.

It's definatly a custom script issue, tell use what scripts you're using and it should be easy to sort out.

Also, Shinami, it's not strange, another script is probably just overwriting or aliasing the load or save file methods. ;)

***
Rep:
Level 90
Skilled Scripter, Shitty Mapper, Decent Writer.
It's definatly a custom script issue, tell use what scripts you're using and it should be easy to sort out.
Aye. Working with limited information isn't fun. If possible, POST the scripts too?

***
Rep:
Level 87
~Be Cool~
No seriously, no other scripts were added.

But I found a save file in the game folder, so i deleted it which funnily enough made the game work again.

Thank you for your help guys.  :)



*
A Random Custom Title
Rep:
Level 96
wah
Lol wut? Maybe you removed some scripts or you made some drastic changes to the game to make that happen?

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
No, it makes perfect sense, a save file that was corrupted or had too much data then it's loading would screw up the game. It's why a bunch of people say their script will corrupt old save files.

Ask questions like this in the script help forum from now on.

***
Rep:
Level 87
~Be Cool~
Ok I will, sorry about that ;)

I decided I prefer this forum to RMRP.org  :lol:
Those guys are strict on like... everything and they arn't as cool. :blizj:



pokeball WcWOfflineMale
***
Rep:
Level 87
2 + 2 is a math problem, NOT 4.
I accidentally corrupted two of my script testing game's save files by misusing Marshal when I was developing a New Game + script, so quite possibly an error in PK using Marshal wrong.
If you are reading this, the government of the U.S.A. is currently planting a chip in your brain.
People like decreasing my Rep. In fact, people like decreasing most others people's rep.

**
Rep: +0/-0Level 86
Hmm
No seriously, no other scripts were added.

But I found a save file in the game folder, so i deleted it which funnily enough made the game work again.

Thank you for your help guys.  :)
what's funny is that I have the same problem except that I have several custom scripts, so I wonder if it has nothing to do with custom scripts.
I used to be bored...until I got RPG Maker!

******
Revolution is not a bed of roses.
Rep:
Level 91
Project of the Month winner for July 2009
It has to do with non default scripts, end of story.