Minor Quick-Save script Upgrade

Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
I'm posting the script here, since other threaders have custom-modified the original for me in the past and you won't find this version anywhere else on the net. Basically I just want to rename the save file that this script uses (the second) into "Quick-Save", so that the player can instantly recognise it from the main menu. That's it. Your name will be added to the credits of my Broken Reality game. (https://gamejolt.com/games/Brokenreality14/326168)

Code:
=begin
====================================================================
  GENERAL INFORMATION
--------------------------------------------------------------------
  Title: Quick Save/Load System
  Author: Adiktuzmiko
  Version: 1.01 - Khas' Fix
  Requirements: None

  This script allows you to set a button in the game for quick save and load.
  If you press the quicksave button, the game will automatically save
  your progress in the designated slot without going thru the save screen.
  The same goes for quickload.

====================================================================

====================================================================
  FEATURES
--------------------------------------------------------------------

  Quick Save/Load Anytime
  - Save/Load your progress with the press of a button

  Customizable
  - Modify which file index is used as the quick slot
  - Modify which buttons
  - Determine if quick system is usable in battle and during show text
    event commands
   
  Works with Khas' Awesome Light Effects

====================================================================

====================================================================
  INSTRUCTIONS
--------------------------------------------------------------------

  After importing this script to your project, go to the config part
  below (after TERMS AND CONDITIONS) and edit to suit your needs.

====================================================================

====================================================================
  TERMS AND CONDITIONS
--------------------------------------------------------------------

  View it here: http://lescripts.wordpress.com/terms-and-conditions/

====================================================================

=end

module ADIK
  module QUICK
   
    #Is the system enabled?
    ENABLED = true
   
    #Save file index to be used by Quick save/load
    #Note that by default the first file is index 0
    INDEX = 1
   
    #SaveLoad Keybindings
    #Default are L and R keys (Q/W at the keyboard by default)
    SAVE_KEY = :L
    LOAD_KEY = :L
   
    #Set these if you want to use a button "combo" to activate the system
    #Example if SAVE_KEY is set as :L and SAVE_KEY_2 is set as :A
    #then you need to press both to activate the quick save
    SAVE_KEY_2 = nil
    LOAD_KEY_2 = :A
   
    #Is the system allowed in battle scene?
    #I suggest keeping this as false
    ALLOW_AT_BATTLE = false
   
    #Is the system allowed during the Show Text event command?
    ALLOW_AT_TEXT = false
   
  end
end

# DO NOT EDIT BELOW THIS LINE

if ADIK::QUICK::ENABLED

  class Scene_Quick < Scene_File
   
    attr_accessor :quick_save
    attr_accessor :quick_load
   
    def create_help_window
    end
    def help_window_text
    end
    def create_savefile_viewport
      @savefile_viewport = Viewport.new
      @savefile_viewport.rect.y = 0
      @savefile_viewport.rect.height = 0
    end
    def create_savefile_windows
      @savefile_windows = Array.new(item_max) do |i|
        Window_SaveFile.new(savefile_height, i)
      end
      @savefile_windows.each {|window| window.viewport = @savefile_viewport; window.hide }
    end
    def init_selection
    end
   
    def update
      if @quick_save
        if DataManager.save_game(ADIK::QUICK::INDEX)
          Sound.play_save
        else
          Sound.play_buzzer
        end
        @quick_save = false
        SceneManager.return
      end
      if @quick_load
        if DataManager.load_game(ADIK::QUICK::INDEX)
          Sound.play_load
          $game_system.on_after_load
          @quick_load = false
          SceneManager.goto(Scene_Map)
        else
          Sound.play_buzzer
          @quick_load = false
          SceneManager.return
        end
      end
    end
   
    def quicksave
      @quick_save = true
    end
   
    def quickload
      @quick_load = true
    end
   
  end

  class Scene_Base
   
    def quicksave
      SceneManager.call(Scene_Quick)
      SceneManager.scene.quicksave
    end
   
    def quickload
      SceneManager.call(Scene_Quick)
      SceneManager.scene.quickload
    end
   
    def is_quicksave
      if ADIK::QUICK::SAVE_KEY_2 != nil
        return (Input.trigger?(ADIK::QUICK::SAVE_KEY) and Input.press?(ADIK::QUICK::SAVE_KEY_2))
      else
        if ADIK::QUICK::LOAD_KEY_2 != nil
          return false if Input.press?(ADIK::QUICK::LOAD_KEY_2)
        end
        return Input.trigger?(ADIK::QUICK::SAVE_KEY)
      end
    end
   
    def is_quickload
      if ADIK::QUICK::LOAD_KEY_2 != nil
        return (Input.trigger?(ADIK::QUICK::LOAD_KEY) and Input.press?(ADIK::QUICK::LOAD_KEY_2))
      else
        if ADIK::QUICK::SAVE_KEY_2 != nil
          return false if Input.press?(ADIK::QUICK::SAVE_KEY_2)
        end
        return Input.trigger?(ADIK::QUICK::LOAD_KEY)
      end
    end

   
    def quicksystem
      if is_quicksave and not SceneManager.scene_is?(Scene_Save)
        if SceneManager.scene_is?(Scene_Battle) then
          if ADIK::QUICK::ALLOW_AT_BATTLE
            quicksave
          end
        else
          quicksave
        end
        return
      end
      if is_quickload and not SceneManager.scene_is?(Scene_Load)
        if SceneManager.scene_is?(Scene_Battle) then
          if ADIK::QUICK::ALLOW_AT_BATTLE
            quickload
          end
        else
          quickload
        end
        return
      end
    end
   
    alias update_quicksystem update
    def update
      update_quicksystem
      quicksystem
    end
   
  end

  class Game_Interpreter

    def wait_for_message
      while $game_message.busy?
        SceneManager.scene.quicksystem
        Fiber.yield 
      end
    end
    
  end

end
 
Last edited:

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I will help you but only if you wrap that code between proper code tags. :p

Click on the "Insert..." button, select Code, copy/paste the original script (and by that I mean NOT the one from your opening post, because that one lost it's proper format already) into the box, and hit the "Insert" button on the bottom.
Remember to do this for all script and code bits in the future.

See? Code should always look like this:
Code:
class Window_SaveFile < Window_Base

  def refresh
    contents.clear
    change_color(normal_color)
    if @file_index == ADIK::QUICK::INDEX
      name = "Quick-Save"
    else
      name = Vocab::File + " #{@file_index + 1}"
    end
    draw_text(4, 0, 200, line_height, name)
    @name_width = text_size(name).width
    draw_party_characters(152, 58)
    draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
  end
 
end
Place this right below all of the default scripts in your project.
 
Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
I will help you but only if you wrap that code between proper code tags. :p

Click on the "Insert..." button, select Code, copy/paste the original script (and by that I mean NOT the one from your opening post, because that one lost it's proper format already) into the box, and hit the "Insert" button on the bottom.
Remember to do this for all script and code bits in the future.

See? Code should always look like this:
Code:
class Window_SaveFile < Window_Base

  def refresh
    contents.clear
    change_color(normal_color)
    if @file_index == ADIK::QUICK::INDEX
      name = "Quick-Save"
    else
      name = Vocab::File + " #{@file_index + 1}"
    end
    draw_text(4, 0, 200, line_height, name)
    @name_width = text_size(name).width
    draw_party_characters(152, 58)
    draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
  end
 
end
Place this right below all of the default scripts in your project.
Done.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Much better! :D

Did you use that code snippet I posted? I haven't tested it, but it should work.
 
Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
Much better! :D

Did you use that code snippet I posted? I haven't tested it, but it should work.
Having a minor compatibility problem with another save script I use, which changes depending on where I put your script.
I use this:

Code:
#Basic Autosave v1.1
#----------#
#Features: Autosaves to the first slot every time the map changes. Can't
#           get any simpler then that!
#          Comes with option to rename first slot to whatever you want.
#
#Usage:    Plug and play.
#
#----------#
#-- Script by: V.M of D.T
#
#- Questions or comments can be:
#    given by email: sumptuaryspade@live.ca
#    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
#   All my other scripts and projects can be found here: http://daimonioustails.weebly.com/
#
#- Free to use in any project with credit given, donations always welcome!
 
#Sets whether to rename first file to denote Autosaveness and what to name it
NAME_AUTOSAVE_FILE = true
AUTOSAVE_FILE_NAME = "Autosave"
AUTOSAVE_ON_MAP = true
AUTOSAVE_AFTER_BATTLE = false
 
$auto_save = true
 
class Scene_Map
  alias auto_post_transfer post_transfer
  def post_transfer
    auto_post_transfer
    return unless AUTOSAVE_ON_MAP
    if Module.const_defined?(:Game_Options)
      DataManager.save_game(0) if $game_options.auto_save
    else
      DataManager.save_game(0) if $auto_save
    end
  end
end
 
module BattleManager
  def self.battle_end(result)
    @phase = nil
    @event_proc.call(result) if @event_proc
    $game_party.on_battle_end
    $game_troop.on_battle_end
    SceneManager.exit if $BTEST
    return unless AUTOSAVE_AFTER_BATTLE
    if Module.const_defined?(:Game_Options)
      DataManager.save_game(0) if $game_options.auto_save
    else
      DataManager.save_game(0) if $auto_save
    end
  end
end
 
class Window_SaveFile
  alias auto_refresh refresh
  def refresh
    if NAME_AUTOSAVE_FILE
      contents.clear
      change_color(normal_color)
      if @file_index == 0
        name = AUTOSAVE_FILE_NAME
      else
        name = Vocab::File + " #{@file_index}"
      end
      draw_text(4, 0, 200, line_height, name)
      @name_width = text_size(name).width
      draw_party_characters(152, 58)
      draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
    else
      auto_refresh
    end
  end
end

which also renames its save file (I have put quick-save in slot 0 and autosave in slot 1). Depending on the position I put them in, either quick-save slot won't be named properly, or the autosave one. It doesn't crash the game or anything, but it's a bit frustrating. Can you change either of the two to fix it?

Thanks for your time.
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
I somehow suspected that you use something else there, since it would be weird to put the quick-save slot for index 1 otherwise. :D

In that autosave script, you see these lines:
Code:
      if @file_index == 0
        name = AUTOSAVE_FILE_NAME
      else
        name = Vocab::File + " #{@file_index}"
      end
Replace all of those lines with these lines:
Code:
      case @file_index
      when 0
        name = AUTOSAVE_FILE_NAME
      when ADIK::QUICK::INDEX
        name = "Quick-Save"
      else
        name = Vocab::File + " #{@file_index}"
      end
And remove the previous snippet I posted from your script list.
This should work for both slots, but I haven't tested it, so who knows... :D
 
Joined
Apr 17, 2013
Messages
93
Reaction score
6
First Language
English
Primarily Uses
N/A
I somehow suspected that you use something else there, since it would be weird to put the quick-save slot for index 1 otherwise. :D

In that autosave script, you see these lines:
Code:
      if @file_index == 0
        name = AUTOSAVE_FILE_NAME
      else
        name = Vocab::File + " #{@file_index}"
      end
Replace all of those lines with these lines:
Code:
      case @file_index
      when 0
        name = AUTOSAVE_FILE_NAME
      when ADIK::QUICK::INDEX
        name = "Quick-Save"
      else
        name = Vocab::File + " #{@file_index}"
      end
And remove the previous snippet I posted from your script list.
This should work for both slots, but I haven't tested it, so who knows... :D
Yep. Works great now. Want your name as "Sixth" in the credits or do you prefer another name?
 

Sixth

Veteran
Veteran
Joined
Jul 4, 2014
Messages
2,162
Reaction score
822
First Language
Hungarian
Primarily Uses
RMVXA
Ohh, sorry, forgot to reply.
Sixth is fine, thank you!
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD
How many parameters is 'too many'??

Forum statistics

Threads
105,865
Messages
1,017,059
Members
137,575
Latest member
akekaphol101
Top