The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Scripting => Topic started by: Kagome on December 06, 2006, 10:07:40 AM

Title: Save and Load
Post by: Kagome on December 06, 2006, 10:07:40 AM
Please i need other script to Save and Load window.
Please post your script.  :lol: ;)
Title: Re: Save and Load
Post by: Falcon on December 06, 2006, 10:44:42 AM
Just make a new project and get it yourself.
Title: Re: Save and Load
Post by: Kagome on December 06, 2006, 11:12:38 AM
I hawe only idea for Save and Load Screen and i don't know create it.
My idea:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fwww.rpglive.tym.sk%2Fimages%2Fsave.PNG&hash=665e403b805be65bdb355154857295fbcc43e118)
Title: Re: Save and Load
Post by: Kagome on December 06, 2006, 11:48:43 AM
And i need a save to more them 4 file save.
Title: Re: Save and Load
Post by: Morris Lawry on December 07, 2006, 06:18:05 AM
Kagome, its possible to do what your asking but, you'd need blizard of some one highly trained in kara-scripting-tay
Title: Re: Save and Load
Post by: nevfx on December 07, 2006, 01:07:27 PM
Morrie is right, you would need to be really good with scripting to manipulate that.
Title: Re: Save and Load
Post by: &&&&&&&&&&&&& on December 07, 2006, 02:57:14 PM
Quote(https://rmrk.net/proxy.php?request=http%3A%2F%2Fi109.photobucket.com%2Falbums%2Fn52%2Fdreamslayer7%2Fhelp.jpg&hash=cf28078f6770da0703f27c57efc5c8018d59dae1) This script allows you to have unlimited save files. Only four files are shown at once, but the list can be scrolled. To use this script, replace the class Scene_File with the one shown, and replace the initialize method in Window_SaveFile with the one shown. To choose the maximum number of save files for your game, change the value of the constant SAVEFILE_MAX (shown in red below).

This script can be used with my overwrite confirmation script, but it is your responsibility to combine this script with that one.

class Scene_File
  SAVEFILE_MAX = 99
# -------------------
def initialize(help_text)
  @help_text = help_text
end
# -------------------
def main
  @help_window = Window_Help.new
  @help_window.set_text(@help_text)
  @savefile_windows = []
  @cursor_displace = 0
  for i in 0..3
    @savefile_windows.push(Window_SaveFile.new(i, make_filename(i), i))
  end
  @file_index = 0
  @savefile_windows[@file_index].selected = true
  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
end
# -------------------
def update
  @help_window.update
  for i in @savefile_windows
    i.update
  end
  if Input.trigger?(Input::C)
    on_decision(make_filename(@file_index))
    $game_temp.last_file_index = @file_index
    return
  end
  if Input.trigger?(Input::B)
    on_cancel
    return
  end
  if Input.repeat?(Input::DOWN)
    if Input.trigger?(Input::DOWN) or @file_index < SAVEFILE_MAX - 1
      if @file_index == SAVEFILE_MAX - 1
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      @cursor_displace += 1
      if @cursor_displace == 4
        @cursor_displace = 3
        for i in @savefile_windows
          i.dispose
        end
        @savefile_windows = []
        for i in 0..3
          f = i - 2 + @file_index
          name = make_filename(f)
          @savefile_windows.push(Window_SaveFile.new(f, name, i))
          @savefile_windows[i].selected = false
        end
      end
      $game_system.se_play($data_system.cursor_se)
      @file_index = (@file_index + 1)
      if @file_index == SAVEFILE_MAX
        @file_index = SAVEFILE_MAX - 1
      end
      for i in 0..3
        @savefile_windows[i].selected = false
      end
      @savefile_windows[@cursor_displace].selected = true
      return
    end
  end
  if Input.repeat?(Input::UP)
    if Input.trigger?(Input::UP) or @file_index > 0
      if @file_index == 0
        $game_system.se_play($data_system.buzzer_se)
        return
      end
      @cursor_displace -= 1
      if @cursor_displace == -1
        @cursor_displace = 0
        for i in @savefile_windows
          i.dispose
        end
        @savefile_windows = []
        for i in 0..3
          f = i - 1 + @file_index
          name = make_filename(f)
          @savefile_windows.push(Window_SaveFile.new(f, name, i))
          @savefile_windows[i].selected = false
        end
      end
      $game_system.se_play($data_system.cursor_se)
      @file_index = (@file_index - 1)
      if @file_index == -1
        @file_index = 0
      end
      for i in 0..3
        @savefile_windows[i].selected = false
      end
      @savefile_windows[@cursor_displace].selected = true
      return
    end
  end
end
# -------------------
def make_filename(file_index)
  return "Save#{file_index + 1}.rxdata"
end
# -------------------
end


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

Title: Re: Save and Load
Post by: Kagome on December 07, 2006, 03:47:08 PM
"Script 'save_file' on line 23 syntax error"