The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: crunkbanker on April 09, 2007, 06:40:33 PM

Title: [Resolved] Syntax error when using "unlimited save files" script
Post by: crunkbanker on April 09, 2007, 06:40:33 PM
I am trying to use the script for unlimited save files by Rpg Advocate found here:
http://www.phylomortis.com/resource/script/scr039.html
But I keep getting this error:

(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi165.photobucket.com%2Falbums%2Fu43%2Fcrunkbanker%2Fsyntaxerror.png&hash=16869e046a01057f6ce56b166b312a4e5809212c)

I have included a download of a game file so you can see what I did. I understand that the error tells me where the problem is found but I don't know how to fix it. can anyone help please?
Download of game file:

http://www.box.net/shared/2kims9emg5
Title: Re: Syntax error when using "unlimited save files" script
Post by: Rune on April 10, 2007, 07:30:21 PM
There is no line 94 in the new Window_SaveFile that the site gives you O_o
Title: Re: Syntax error when using "unlimited save files" script
Post by: Kokowam on April 10, 2007, 07:32:46 PM
Line 94 is "          f = i - 1 + @file_index"
Title: Re: Syntax error when using "unlimited save files" script
Post by: Rune on April 10, 2007, 07:37:33 PM
Not in the one that i've got...
This is the one that i've got...
#==============================================================================
# ? Window_SaveFile
#------------------------------------------------------------------------------
# ????????????????????????????????????
#==============================================================================

class Window_SaveFile < Window_Base
# -------------------
def initialize(file_index, filename, position)
  y = 64 + position * 104
  super(0, y, 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
  #--------------------------------------------------------------------------
  # ? ??????
  #--------------------------------------------------------------------------
  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

It only has 84 lines O_o
Title: Re: Syntax error when using "unlimited save files" script
Post by: Kokowam on April 10, 2007, 07:47:20 PM
Oh, lol. I was looking at the first script. >_> Maybe the guy added the second script to the end of Window_SaveFile instead of replacing?
Title: Re: Syntax error when using "unlimited save files" script
Post by: Rune on April 10, 2007, 08:05:40 PM
That would have probably came up with a stack error or something like that...
Title: Re: Syntax error when using "unlimited save files" script
Post by: Kokowam on April 10, 2007, 08:09:22 PM
So that's what a stack error is... Anyways, crunkbaker, why not try to use the script posted by Rune?
Title: Re: Syntax error when using "unlimited save files" script
Post by: crunkbanker on April 11, 2007, 12:07:48 PM
Thanks Rune! I tried your script you posted and it worked great! BTW, who should I credit? is it your script? thanks!
Title: Re: [Resolved] Syntax error when using "unlimited save files" script
Post by: Rune on April 11, 2007, 12:45:59 PM
It's the script you find on phylomortis... credit RPG Advocate... and you're welcome ;)