Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] Save Confirmation Window

Save Confirmation Window
Version 1.0
by Woratana
Release Date: 15/02/2008

http://i26.tinypic.com/2vb3kt5.jpg[/img]

Introduction
This script will make player has to confirm before save on save slot that already has save file in it.


Features
Version 1.0
- Confirm to save when overwriting on old save file


Script
Place it above main.
Code:
#==============================================================================
# [VX] Save File Confirmation
#------------------------------------------------------------------------------
# by Woratana
# Released on: 15/02/2008
#
# Make a Confirmation Window before save file...
#==============================================================================

module Worale
  SFC_Text_Confirm = 'Confirm to save...' # Text to confirm to save file
  SFC_Text_Cancel = 'Cancel saving process' # Text to cancel to save

  SFC_Window_Width = 200 # Width of Confirmation Window
  SFC_Window_X_Offset = 0 # Move Confirmation Window horizontally
  SFC_Window_Y_Offset = 0 # Move Confirmation Window vertically
end


class Scene_File < Scene_Base
  def update
    super
    if !@confirm_window.nil?
      @confirm_window.update
      if Input.trigger?(Input::C)
        if @confirm_window.index == 0
          determine_savefile
          @confirm_window.dispose
          @confirm_window = nil
        else
          Sound.play_cancel
          @confirm_window.dispose
          @confirm_window = nil
        end
      elsif Input.trigger?(Input::B)
      Sound.play_cancel
      @confirm_window.dispose
      @confirm_window = nil
      end
    else
    update_menu_background
    @help_window.update
    update_savefile_windows
    update_savefile_selection
    end
  end
  
  def update_savefile_selection
    if Input.trigger?(Input::C)
      if @saving and @savefile_windows[@index].file_exist
      Sound.play_decision
      text1 = Worale::SFC_Text_Confirm
      text2 = Worale::SFC_Text_Cancel
      @confirm_window = Window_Command.new(Worale::SFC_Window_Width,[text1,text2])
      @confirm_window.x = ((544 - @confirm_window.width) / 2) + Worale::SFC_Window_X_Offset
      @confirm_window.y = ((416 - @confirm_window.height) / 2) + Worale::SFC_Window_Y_Offset
      else
      determine_savefile
      end
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    else
      last_index = @index
      if Input.repeat?(Input::DOWN)
        cursor_down(Input.trigger?(Input::DOWN))
      end
      if Input.repeat?(Input::UP)
        cursor_up(Input.trigger?(Input::UP))
      end
      if @index != last_index
        Sound.play_cursor
        @savefile_windows[last_index].selected = false
        @savefile_windows[@index].selected = true
      end
    end
  end
end

Instruction
Just put script above main  :smile:


Author's Notes
Free for use in your non-commercial work if credit included. If your project is commercial, please contact me.

Please do not redistribute this script without permission. If you want to post it on any forum, please link to this topic.
 
Simple, but absolutely vital if your going to have saves in your game imo. It would suck to accidentally overwrite a game file you've invested however many hours into. Tyvm definitely going to include this in my project.
 

Akin

Member

Hey I'm new to scripting and wanted to add text to the screen, in addition to the confirmation window, that appears before you save over an existing save file. This is what I did your script. Would you mind giving it a quick look over to see if there's any mistakes I'm not noticing or better/cleaner way to code it?

Script

#==============================================================================
# [VX] Save File Confirmation
#------------------------------------------------------------------------------
# by Woratana
# Released on: 15/02/2008
# minor edit by Akin
#
# Make a Confirmation Window before save file...
#==============================================================================

module Worale
  SFC_Text_Overhead = 'Overwrite currently saved data?' #Text that appears at the top of the screen
  SFC_Text_Confirm = 'Save and Overwrite' # Text to confirm to save file
  SFC_Text_Cancel = 'Cancel' # Text to cancel to save

  SFC_Window_Width = 250 # Width of Confirmation Window
  SFC_Window_X_Offset = 0 # Move Confirmation Window horizontally
  SFC_Window_Y_Offset = 0 # Move Confirmation Window vertically
end


class Scene_File < Scene_Base
  def update
    super
    if !@confirm_window.nil?
      @confirm_window.update
  @help_window.update
      if Input.trigger?(Input::C)
        if @confirm_window.index == 0
          determine_savefile
          @confirm_window.dispose
          @confirm_window = nil
  @help_window.set_text(Vocab::SaveMessage)
        else
          Sound.play_cancel
          @confirm_window.dispose
          @confirm_window = nil
  @help_window.set_text(Vocab::SaveMessage)
        end
      elsif Input.trigger?(Input::B)
      Sound.play_cancel
      @confirm_window.dispose
      @confirm_window = nil
  @help_window.set_text(Vocab::SaveMessage)
      end
    else
    update_menu_background
    @help_window.update
    update_savefile_windows
    update_savefile_selection
    end
  end
 
  def update_savefile_selection
    if Input.trigger?(Input::C)
      if @saving and @savefile_windows[@index].file_exist
      Sound.play_decision
      text1 = Worale::SFC_Text_Confirm
      text2 = Worale::SFC_Text_Cancel
      @confirm_window = Window_Command.new(Worale::SFC_Window_Width,[text1,text2])
      @confirm_window.x = ((544 - @confirm_window.width) / 2) + Worale::SFC_Window_X_Offset
      @confirm_window.y = ((416 - @confirm_window.height) / 2) + Worale::SFC_Window_Y_Offset
  @help_window.set_text(Worale::SFC_Text_Overhead)
      else
      determine_savefile
      end
    elsif Input.trigger?(Input::B)
      Sound.play_cancel
      return_scene
    else
      last_index = @index
      if Input.repeat?(Input::DOWN)
        cursor_down(Input.trigger?(Input::DOWN))
      end
      if Input.repeat?(Input::UP)
        cursor_up(Input.trigger?(Input::UP))
      end
      if @index != last_index
        Sound.play_cursor
        @savefile_windows[last_index].selected = false
        @savefile_windows[@index].selected = true
      end
    end
  end
end
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top