Jump to content

Announcing our new website

To find out the latest about our new website, visit Game Dev Unlimited

- - - - -

Personal Save Files


  • You cannot reply to this topic
13 replies to this topic

#1 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 08 July 2008 - 03:39 PM

Features:
This script allows you to have a name for your save files
Replaces Scene_Title

Instructions:
Place directly above main

Demo:
None unless requested

Script:
Attached File  Personal_Save_Files.txt   31.73K   71 downloads
RMXP Version
#---------------------
# Personal Save Files
# By: Polraudio
# Credits: Polraudio, RPG Advocate, Cybersam
# Version: 1.0
#---------------------
=begin
#----------------------------------------------------
Features:
- Allows you to have up to Unlimited save files
- You can have a name for your save files

Instructions:
Place above main

Contact:
If you have any questions or comments you can find me
at www.rmxpunlimited.net(Best Method)

Or email me polraudio@gmail.com
=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}." + $savename
    @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 = "Record #{@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
  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
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}." + $savename
  end
end
class Scene_Save < Scene_File
  def initialize
    super("Which file would you like to save to?")
  end
  def on_decision(filename)
    $game_system.se_play($data_system.save_se)
    file = File.open(filename, "wb")
    write_save_data(file)
    file.close
    if $game_temp.save_calling
      $game_temp.save_calling = false
      $scene = Scene_Map.new
      return
    end
    $scene = Scene_Menu.new(4)
  end
  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    if $game_temp.save_calling
      $game_temp.save_calling = false
      $scene = Scene_Map.new
      return
    end
    $scene = Scene_Menu.new(4)
  end
  def write_save_data(file)
    characters = []
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      characters.push([actor.character_name, actor.character_hue])
    end
    Marshal.dump(characters, file)
    Marshal.dump(Graphics.frame_count, file)
    $game_system.save_count += 1
    $game_system.magic_number = $data_system.magic_number
    Marshal.dump($game_system, file)
    Marshal.dump($game_switches, file)
    Marshal.dump($game_variables, file)
    Marshal.dump($game_self_switches, file)
    Marshal.dump($game_screen, file)
    Marshal.dump($game_actors, file)
    Marshal.dump($game_party, file)
    Marshal.dump($game_troop, file)
    Marshal.dump($game_map, file)
    Marshal.dump($game_player, file)
  end
end
class Scene_Load < Scene_File
  def initialize
    $game_temp = Game_Temp.new
    $game_temp.last_file_index = 0
    latest_time = Time.at(0)
    for i in 0..3
      filename = make_filename(i)
      if FileTest.exist?(filename)
        file = File.open(filename, "r")
        if file.mtime > latest_time
          latest_time = file.mtime
          $game_temp.last_file_index = i
        end
        file.close
      end
    end
    super("Which file would you like to load?")
  end
  def on_decision(filename)
    unless FileTest.exist?(filename)
      $game_system.se_play($data_system.buzzer_se)
      return
    end
    $game_system.se_play($data_system.load_se)
    file = File.open(filename, "rb")
    read_save_data(file)
    file.close
    $game_system.bgm_play($game_system.playing_bgm)
    $game_system.bgs_play($game_system.playing_bgs)
    $game_map.update
    $scene = Scene_Map.new
  end
  def on_cancel
    $game_system.se_play($data_system.cancel_se)
    $scene = Scene_Title.new
  end
  def read_save_data(file)
    characters = Marshal.load(file)
    Graphics.frame_count = Marshal.load(file)
    $game_system        = Marshal.load(file)
    $game_switches      = Marshal.load(file)
    $game_variables     = Marshal.load(file)
    $game_self_switches = Marshal.load(file)
    $game_screen        = Marshal.load(file)
    $game_actors        = Marshal.load(file)
    $game_party         = Marshal.load(file)
    $game_troop         = Marshal.load(file)
    $game_map           = Marshal.load(file)
    $game_player        = Marshal.load(file)
    if $game_system.magic_number != $data_system.magic_number
      $game_map.setup($game_map.map_id)
      $game_player.center($game_player.x, $game_player.y)
    end
    $game_party.refresh
  end
end
class Scene_Title
  def main
    if $BTEST
      battle_test
      return
    end
    $data_actors        = load_data("Data/Actors.rxdata")
    $data_classes       = load_data("Data/Classes.rxdata")
    $data_skills        = load_data("Data/Skills.rxdata")
    $data_items         = load_data("Data/Items.rxdata")
    $data_weapons       = load_data("Data/Weapons.rxdata")
    $data_armors        = load_data("Data/Armors.rxdata")
    $data_enemies       = load_data("Data/Enemies.rxdata")
    $data_troops        = load_data("Data/Troops.rxdata")
    $data_states        = load_data("Data/States.rxdata")
    $data_animations    = load_data("Data/Animations.rxdata")
    $data_tilesets      = load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system        = load_data("Data/System.rxdata")
    $game_system = Game_System.new
    @sprite = Sprite.new
    @sprite.bitmap = RPG::Cache.title($data_system.title_name)
    s1 = "New Game"
    s2 = "Continue"
    s3 = "Shutdown"
    @command_window = Window_Command.new(192, [s1, s2, s3])
    @command_window.back_opacity = 160
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 288
    $game_system.bgm_play($data_system.title_bgm)
    Audio.me_stop
    Audio.bgs_stop
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @sprite.bitmap.dispose
    @sprite.dispose
  end
  #--------------------------------------------------------------------------
  # * Frame Update
  #--------------------------------------------------------------------------
  def update
    @command_window.update
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        command_new_game
      when 1
        command_continue
      when 2
        command_shutdown
      end
    end
  end
  def command_new_game
    $game_system.se_play($data_system.decision_se)
    data = []
    top_text = "Please create a name for your saves"
    text = ""
    font = "Arial"
    max = 9
    size = 24
    $savename = Text_input.new(top_text, text, font, max, size).text
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_stop
    Graphics.frame_count = 0
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_party.setup_starting_members
    $game_map.setup($data_system.start_map_id)
    $game_player.moveto($data_system.start_x, $data_system.start_y)
    $game_player.refresh
    $game_map.autoplay
    $game_map.update
    $scene = Scene_Map.new
  end
  def command_continue
    $game_system.se_play($data_system.decision_se)
    data = []
    top_text = "Please type your save name"
    text = ""
    font = "Arial"
    max = 9
    size = 24
    $savename = Text_input.new(top_text, text, font, max, size).text
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Load.new
  end
  def command_shutdown
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = nil
  end
  def battle_test
    $data_actors        = load_data("Data/BT_Actors.rxdata")
    $data_classes       = load_data("Data/BT_Classes.rxdata")
    $data_skills        = load_data("Data/BT_Skills.rxdata")
    $data_items         = load_data("Data/BT_Items.rxdata")
    $data_weapons       = load_data("Data/BT_Weapons.rxdata")
    $data_armors        = load_data("Data/BT_Armors.rxdata")
    $data_enemies       = load_data("Data/BT_Enemies.rxdata")
    $data_troops        = load_data("Data/BT_Troops.rxdata")
    $data_states        = load_data("Data/BT_States.rxdata")
    $data_animations    = load_data("Data/BT_Animations.rxdata")
    $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
    $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
    $data_system        = load_data("Data/BT_System.rxdata")
    Graphics.frame_count = 0
    $game_temp          = Game_Temp.new
    $game_system        = Game_System.new
    $game_switches      = Game_Switches.new
    $game_variables     = Game_Variables.new
    $game_self_switches = Game_SelfSwitches.new
    $game_screen        = Game_Screen.new
    $game_actors        = Game_Actors.new
    $game_party         = Game_Party.new
    $game_troop         = Game_Troop.new
    $game_map           = Game_Map.new
    $game_player        = Game_Player.new
    $game_party.setup_battle_test_members
    $game_temp.battle_troop_id = $data_system.test_troop_id
    $game_temp.battle_can_escape = true
    $game_map.battleback_name = $data_system.battleback_name
    $game_system.se_play($data_system.battle_start_se)
    $game_system.bgm_play($game_system.battle_bgm)
    $scene = Scene_Battle.new
  end
end
#======================================
# ■ Keyboard Script
#---------------------------------------------------------------------------
#  By: Cybersam
#   Date: 25/05/05
#   Version 4
#======================================
# How to use
# if Kboard.keyboard($R_Key_A)
#
module Kboard
 #--------------------------------------------------------------------------
 $RMouse_BUTTON_L = 0x01        # left mouse button
 $RMouse_BUTTON_R = 0x02        # right mouse button
 $RMouse_BUTTON_M = 0x04        # middle mouse button
 $RMouse_BUTTON_4 = 0x05        # 4th mouse button 
 $RMouse_BUTTON_5 = 0x06        # 5th mouse button
 #--------------------------------------------------------------------------
 $R_Key_BACK      = 0x08        # BACKSPACE key
 $R_Key_TAB       = 0x09        # TAB key
 $R_Key_RETURN    = 0x0D        # ENTER key
 $R_Key_SHIFT     = 0x10        # SHIFT key
 $R_Key_CTLR      = 0x11        # CTLR key
 $R_Key_ALT       = 0x12        # ALT key
 $R_Key_PAUSE     = 0x13        # PAUSE key
 $R_Key_CAPITAL   = 0x14        # CAPS LOCK key
 $R_Key_ESCAPE    = 0x1B        # ESC key
 $R_Key_SPACE     = 0x20        # SPACEBAR
 $R_Key_PRIOR     = 0x21        # PAGE UP key
 $R_Key_NEXT      = 0x22        # PAGE DOWN key
 $R_Key_END       = 0x23        # END key
 $R_Key_HOME      = 0x24        # HOME key
 $R_Key_LEFT      = 0x25        # LEFT ARROW key
 $R_Key_UP        = 0x26        # UP ARROW key
 $R_Key_RIGHT     = 0x27        # RIGHT ARROW key
 $R_Key_DOWN      = 0x28        # DOWN ARROW key
 $R_Key_SELECT    = 0x29        # SELECT key
 $R_Key_PRINT     = 0x2A        # PRINT key
 $R_Key_SNAPSHOT  = 0x2C        # PRINT SCREEN key
 $R_Key_INSERT    = 0x2D        # INS key
 $R_Key_DELETE    = 0x2E        # DEL key
 #--------------------------------------------------------------------------
 $R_Key_0         = 0x30        # 0 key
 $R_Key_1         = 0x31        # 1 key
 $R_Key_2         = 0x32        # 2 key
 $R_Key_3         = 0x33        # 3 key
 $R_Key_4         = 0x34        # 4 key
 $R_Key_5         = 0x35        # 5 key
 $R_Key_6         = 0x36        # 6 key
 $R_Key_7         = 0x37        # 7 key


 $R_Key_8         = 0x38        # 8 key
 $R_Key_9         = 0x39        # 9 key
 #--------------------------------------------------------------------------
 $R_Key_A         = 0x41        # A key
 $R_Key_B         = 0x42        # B key
 $R_Key_C         = 0x43        # C key
 $R_Key_D         = 0x44        # D key
 $R_Key_E         = 0x45        # E key
 $R_Key_F         = 0x46        # F key
 $R_Key_G         = 0x47        # G key
 $R_Key_H         = 0x48        # H key
 $R_Key_I         = 0x49        # I key
 $R_Key_J         = 0x4A        # J key
 $R_Key_K         = 0x4B        # K key
 $R_Key_L         = 0x4C        # L key
 $R_Key_M         = 0x4D        # M key
 $R_Key_N         = 0x4E        # N key
 $R_Key_O         = 0x4F        # O key
 $R_Key_P         = 0x50        # P key
 $R_Key_Q         = 0x51        # Q key
 $R_Key_R         = 0x52        # R key
 $R_Key_S         = 0x53        # S key
 $R_Key_T         = 0x54        # T key
 $R_Key_U         = 0x55        # U key
 $R_Key_V         = 0x56        # V key
 $R_Key_W         = 0x57        # W key
 $R_Key_X         = 0x58        # X key
 $R_Key_Y         = 0x59        # Y key
 $R_Key_Z         = 0x5A        # Z key
 #--------------------------------------------------------------------------
 $R_Key_LWIN      = 0x5B        # Left Windows key (Microsoft Natural keyboard) 
 $R_Key_RWIN      = 0x5C        # Right Windows key (Natural keyboard)
 $R_Key_APPS      = 0x5D        # Applications key (Natural keyboard)
 #--------------------------------------------------------------------------
 $R_Key_NUMPAD0   = 0x60        # Numeric keypad 0 key
 $R_Key_NUMPAD1   = 0x61        # Numeric keypad 1 key
 $R_Key_NUMPAD2   = 0x62        # Numeric keypad 2 key
 $R_Key_NUMPAD3   = 0x63        # Numeric keypad 3 key
 $R_Key_NUMPAD4   = 0x64        # Numeric keypad 4 key
 $R_Key_NUMPAD5   = 0x65        # Numeric keypad 5 key
 $R_Key_NUMPAD6   = 0x66        # Numeric keypad 6 key
 $R_Key_NUMPAD7   = 0x67        # Numeric keypad 7 key
 $R_Key_NUMPAD8   = 0x68        # Numeric keypad 8 key
 $R_Key_NUMPAD9   = 0x69        # Numeric keypad 9 key
 $R_Key_MULTIPLY  = 0x6A        # Multiply key (*)
 $R_Key_ADD       = 0x6B        # Add key (+)
 $R_Key_SEPARATOR = 0x6C        # Separator key
 $R_Key_SUBTRACT  = 0x6D        # Subtract key (-)
 $R_Key_DECIMAL   = 0x6E        # Decimal key
 $R_Key_DIVIDE    = 0x6F        # Divide key (/)
 #--------------------------------------------------------------------------
 $R_Key_F1        = 0x70        # F1 key
 $R_Key_F2        = 0x71        # F2 key
 $R_Key_F3        = 0x72        # F3 key
 $R_Key_F4        = 0x73        # F4 key
 $R_Key_F5        = 0x74        # F5 key
 $R_Key_F6        = 0x75        # F6 key
 $R_Key_F7        = 0x76        # F7 key
 $R_Key_F8        = 0x77        # F8 key
 $R_Key_F9        = 0x78        # F9 key
 $R_Key_F10       = 0x79        # F10 key
 $R_Key_F11       = 0x7A        # F11 key
 $R_Key_F12       = 0x7B        # F12 key
 #--------------------------------------------------------------------------
 $R_Key_NUMLOCK   = 0x90        # NUM LOCK key
 $R_Key_SCROLL    = 0x91        # SCROLL LOCK key
 #--------------------------------------------------------------------------
 $R_Key_LSHIFT    = 0xA0        # Left SHIFT key
 $R_Key_RSHIFT    = 0xA1        # Right SHIFT key
 $R_Key_LCONTROL  = 0xA2        # Left CONTROL key
 $R_Key_RCONTROL  = 0xA3        # Right CONTROL key
 $R_Key_L_ALT     = 0xA4        # Left ALT key
 $R_Key_R_ALT     = 0xA5        # Right ALT key
 #--------------------------------------------------------------------------
 $R_Key_SEP       = 0xBC        # , key
 $R_Key_DASH      = 0xBD        # - key
 $R_Key_DOTT      = 0xBE        # . key
 #--------------------------------------------------------------------------
 GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
 GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
 GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
 #--------------------------------------------------------------------------
 module_function
 #--------------------------------------------------------------------------
 def keyb(rkey)
    if GetKeyState.call(rkey) != 0
      return 1
    end
    return 0
 end
  #--------------------------------------------------------------------------
 def keyboard(rkey)
   GetKeyState.call(rkey) & 0x01 == 1  #
 end
 #--------------------------------------------------------------------------
 def key(rkey, key = 0)
   GetKeyboardState.call(rkey) & 0x01 == key #
 end
end
#===============================================================================
#
# Text-Input Script v1                                     created by: cybersam
#
# hi boys and ladys.... and whatever else ^-^
#
# here comes the script that allows you to insert text with the keyboard
# in your game... ^-^
#
# i didnt make it work with the default name edit/input script
# but with this it should be easier for you guys to do it...
# the reason ?!.. i said it already in other scripts... ^-^
#
# "i dont wana do a complete script that you can post in your games and it works
# without a single modification"...
#
# since there are people here that just dont even wont try to learn ruby...
# this script works perfect of its own....
# but it wont let you edit the character name without modification...
# so go on and try it out...
#
# if you need help to edit something just ask...
# i would gladly help but i wont do all the work for you...
#
# thats it from my side...
# as for now... this will be the last update
# for this script (keyboard/mouse script) from my side...
# if you find any bugs please contact me... you should already now how... ^-^
# and dont tell me "there is a bug in you script!"
# that alone is not enough... ^-^
#
# cya all ^-^
# sam
#
#===============================================================================

class Text_input < Window_Base

  def initialize(top_text = "Here comes the new Version of the keyboard script", text = "Keyboad - Script v3", font = "Arial", max = 20, size = 16, free = "_")
    @toptext = top_text
    @text =  text
    @font = font
    @max = max
    @size = size
    @free = free
    super(320 - (@max*@size+@size)/2, 240-@size*2-32, @max * @size + 32, 128)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = @font
    self.contents.font.size = @size
    self.z = 256
    @twidth = @max*@size
    refresh
    update
  end
  def refresh
    self.contents.clear
    self.contents.font.color = system_color
    self.contents.draw_text(0, 0, @twidth, @size, @toptext, 1)
    for i in 0...@max
      text = @text[i]
      if text == nil
        text = @free
      else
        text = text.chr
      end
      self.contents.font.color = normal_color
      self.contents.draw_text(@size * i, @size + 24, @size, @size, text, 1)
    end
  end
    def update
      loop do
        Graphics.update
        refresh
        if Kboard.keyboard($R_Key_BACK) # delete (with backspace)
          text = ""
          if @text.size != 0
            for i in 0...@text.size - 1
              text  += @text[i].chr
            end
          @text = text
          else
          end
        end
        if Kboard.keyboard($R_Key_RETURN) # Enter key... to end...
          #$game_variables[1]=@text
          return
        end

        if @text.size < @max

# putting Key's to the text


          if Kboard.keyboard($R_Key_SPACE) # space key (to insert space between the chars... ^-^)
            @text += " " # space.. you can set anything else if you want ^-^'
          end
          if Kboard.key($R_Key_CAPITAL, 1) # if caps lock is active then write the chars in higher case
            if Kboard.keyboard($R_Key_A)
              @text += "A"
            end
            if Kboard.keyboard($R_Key_B)
              @text += "B"
            end
            if Kboard.keyboard($R_Key_C)
            @text += "C"
            end
            if Kboard.keyboard($R_Key_D)
              @text += "D"
            end          
            if Kboard.keyboard($R_Key_E)
              @text += "E"
            end
            if Kboard.keyboard($R_Key_F)
              @text += "F"
            end
            if Kboard.keyboard($R_Key_G)
              @text += "G"
            end
            if Kboard.keyboard($R_Key_H)
              @text += "H"
            end
            if Kboard.keyboard($R_Key_I)
              @text += "I"
            end
            if Kboard.keyboard($R_Key_J)
              @text += "J"
            end
            if Kboard.keyboard($R_Key_K)
              @text += "K"
            end
            if Kboard.keyboard($R_Key_L)
              @text += "L"
            end
            if Kboard.keyboard($R_Key_M)
              @text += "M"
            end
            if Kboard.keyboard($R_Key_N)
              @text += "N"
            end
            if Kboard.keyboard($R_Key_O)
              @text += "O"
            end
            if Kboard.keyboard($R_Key_P)
              @text += "P"
            end
            if Kboard.keyboard($R_Key_Q)
              @text += "Q"
            end
            if Kboard.keyboard($R_Key_R)
              @text += "R"
            end
            if Kboard.keyboard($R_Key_S)
              @text += "S"
            end
            if Kboard.keyboard($R_Key_T)
              @text += "T"
            end
            if Kboard.keyboard($R_Key_U)
              @text += "U"
            end
            if Kboard.keyboard($R_Key_V)
              @text += "V"
            end
            if Kboard.keyboard($R_Key_W)
              @text += "W"
            end
            if Kboard.keyboard($R_Key_X)
              @text += "X"
            end
            if Kboard.keyboard($R_Key_Y)
              @text += "Y"
            end
            if Kboard.keyboard($R_Key_Z)
              @text += "Z"
            end

          elsif Kboard.key($R_Key_CAPITAL) # if caps lock is deactivated then write in lower case

            if Kboard.keyboard($R_Key_A)
              @text += "a"
            end
            if Kboard.keyboard($R_Key_B)
              @text += "b"
            end
            if Kboard.keyboard($R_Key_C)
            @text += "c"
            end
            if Kboard.keyboard($R_Key_D)
              @text += "d"
            end          
            if Kboard.keyboard($R_Key_E)
              @text += "e"
            end
            if Kboard.keyboard($R_Key_F)
              @text += "f"
            end
            if Kboard.keyboard($R_Key_G)
              @text += "g"
            end
            if Kboard.keyboard($R_Key_H)
              @text += "h"
            end
            if Kboard.keyboard($R_Key_I)
              @text += "i"
            end
            if Kboard.keyboard($R_Key_J)
              @text += "j"
            end
            if Kboard.keyboard($R_Key_K)
              @text += "k"
            end
            if Kboard.keyboard($R_Key_L)
              @text += "l"
            end
            if Kboard.keyboard($R_Key_M)
              @text += "m"
            end
            if Kboard.keyboard($R_Key_N)
              @text += "n"
            end
            if Kboard.keyboard($R_Key_O)
              @text += "o"
            end
            if Kboard.keyboard($R_Key_P)
              @text += "p"
            end
            if Kboard.keyboard($R_Key_Q)
              @text += "q"
            end
            if Kboard.keyboard($R_Key_R)
              @text += "r"
            end
            if Kboard.keyboard($R_Key_S)
              @text += "s"
            end
            if Kboard.keyboard($R_Key_T)
              @text += "t"
            end
            if Kboard.keyboard($R_Key_U)
              @text += "u"
            end
            if Kboard.keyboard($R_Key_V)
              @text += "v"
            end
            if Kboard.keyboard($R_Key_W)
              @text += "w"
            end
            if Kboard.keyboard($R_Key_X)
              @text += "x"
            end
            if Kboard.keyboard($R_Key_Y)
              @text += "y"
            end
            if Kboard.keyboard($R_Key_Z)
              @text += "z"
            end
          end
   
# numbers

          if Kboard.keyboard($R_Key_0)
            @text += "0"
          end
          if Kboard.keyboard($R_Key_1)
            @text += "1"
          end
          if Kboard.keyboard($R_Key_2)
            @text += "2"
          end
          if Kboard.keyboard($R_Key_3)
            @text += "3"
          end
          if Kboard.keyboard($R_Key_4)
            @text += "4"
          end
          if Kboard.keyboard($R_Key_5)
            @text += "5"
          end
          if Kboard.keyboard($R_Key_6)
            @text += "6"
          end
          if Kboard.keyboard($R_Key_7)
            @text += "7"
          end
          if Kboard.keyboard($R_Key_8)
            @text += "8"
          end
          if Kboard.keyboard($R_Key_9)
            @text += "9"
          end
          
     
          
# numpad
          if Kboard.keyboard($R_Key_NUMPAD0)
            @text += "0"
          end
          if Kboard.keyboard($R_Key_NUMPAD1)
            @text += "1"
          end
          if Kboard.keyboard($R_Key_NUMPAD2)
            @text += "2"
          end
          if Kboard.keyboard($R_Key_NUMPAD3)
            @text += "3"
          end
          if Kboard.keyboard($R_Key_NUMPAD4)
            @text += "4"
          end
          if Kboard.keyboard($R_Key_NUMPAD5)
            @text += "5"
          end
          if Kboard.keyboard($R_Key_NUMPAD6)
            @text += "6"
          end
          if Kboard.keyboard($R_Key_NUMPAD7)
            @text += "7"
          end
          if Kboard.keyboard($R_Key_NUMPAD8)
            @text += "8"
          end
          if Kboard.keyboard($R_Key_NUMPAD9)
            @text += "9"
          end

          if Kboard.keyboard($R_Key_ADD) # + (numpad)
            @text += "+"
          end
          if Kboard.keyboard($R_Key_SUBTRACT) # - (numpad)
            @text += "-"
          end
          if Kboard.keyboard($R_Key_DIVIDE) # / (numpad)
            @text += "/"
          end
          if Kboard.keyboard($R_Key_MULTIPLY) # * (numpad)
            @text += "*"
          end
          
          if Kboard.key($R_Key_CAPITAL) # since i dont want to change my keyboard layout you need to test it for you'r self...
            if Kboard.keyboard($R_Key_SEP) # , (key) (tested german keyboard layout)
              @text += ","
            end
            if Kboard.keyboard($R_Key_DASH) # - (key) (tested german keyboard layout)
              @text += "-"
            end
            if Kboard.keyboard($R_Key_DOTT) # . (key) (tested german keyboard layout)
              @text += "."
            end
          elsif Kboard.key($R_Key_CAPITAL, 1)
            if Kboard.keyboard($R_Key_SEP) # , (key) (tested german keyboard layout)
              @text += ";"
            end
            if Kboard.keyboard($R_Key_DASH) # - (key) (tested german keyboard layout)
              @text += "_"
            end
            if Kboard.keyboard($R_Key_DOTT) # . (key) (tested german keyboard layout)
              @text += ":"
            end
          end

        else
        end
      refresh
    end
  end
  def text()
    self.contents.dispose
    self.dispose
    return @text
  end
end

Attached File  Personal_Save_Files_VX.txt   28.72K   9 downloads
RMVX Version
#---------------------
# Personal Save Files
# By: Polraudio
# Credits: Polraudio, RPG Advocate, Cybersam
# Version: 1.0
#---------------------
=begin
#----------------------------------------------------
Features:
- Allows you to have up to Unlimited save files
- You can have a name for your save files

Instructions:
Place above main

Contact:
If you have any questions or comments you can find me
at www.rmxpunlimited.net(Best Method)

Or email me polraudio@gmail.com
=end
class Scene_File < Scene_Base
  def initialize(saving, from_title, from_event)
	@saving = saving
	@from_title = from_title
	@from_event = from_event
  end
  def start
	super
	create_menu_background
	@help_window = Window_Help.new
	create_savefile_windows
	if @saving
	  @index = $game_temp.last_file_index
	  @help_window.set_text(Vocab::SaveMessage)
	else
	  @index = self.latest_file_index
	  @help_window.set_text(Vocab::LoadMessage)
	end
	@savefile_windows[@index].selected = true
  end
  def terminate
	super
	dispose_menu_background
	@help_window.dispose
	dispose_item_windows
  end
  def return_scene
	if @from_title
	  $scene = Scene_Title.new
	elsif @from_event
	  $scene = Scene_Map.new
	else
	  $scene = Scene_Menu.new(4)
	end
  end
  def update
	super
	update_menu_background
	@help_window.update
	update_savefile_windows
	update_savefile_selection
  end
  def create_savefile_windows
	@savefile_windows = []
	for i in 0..3
	  @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
	end
	@item_max = 4
  end
  def dispose_item_windows
	for window in @savefile_windows
	  window.dispose
	end
  end
  def update_savefile_windows
	for window in @savefile_windows
	  window.update
	end
  end
  def update_savefile_selection
	if Input.trigger?(Input::C)
	  determine_savefile
	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
  def determine_savefile
	if @saving
	  Sound.play_save
	  do_save
	else
	  if @savefile_windows[@index].file_exist
		Sound.play_load
		do_load
	  else
		Sound.play_buzzer
		return
	  end
	end
	$game_temp.last_file_index = @index
  end
  def cursor_down(wrap)
	if @index < @item_max - 1 or wrap
	  @index = (@index + 1) % @item_max
	end
  end
  def cursor_up(wrap)
	if @index > 0 or wrap
	  @index = (@index - 1 + @item_max) % @item_max
	end
  end
  def make_filename(file_index)
	return "Save#{file_index + 1}." + $savename
  end
  def latest_file_index
	index = 0
	latest_time = Time.at(0)
	for i in 0...@savefile_windows.size
	  if @savefile_windows[i].time_stamp > latest_time
		latest_time = @savefile_windows[i].time_stamp
		index = i
	  end
	end
	return index
  end
  def do_save
	file = File.open(@savefile_windows[@index].filename, "wb")
	write_save_data(file)
	file.close
	return_scene
  end
  def do_load
	file = File.open(@savefile_windows[@index].filename, "rb")
	read_save_data(file)
	file.close
	$scene = Scene_Map.new
	RPG::BGM.fade(1500)
	Graphics.fadeout(60)
	Graphics.wait(40)
	@last_bgm.play
	@last_bgs.play
  end
  def write_save_data(file)
	characters = []
	for actor in $game_party.members
	  characters.push([actor.character_name, actor.character_index])
	end
	$game_system.save_count += 1
	$game_system.version_id = $data_system.version_id
	@last_bgm = RPG::BGM::last
	@last_bgs = RPG::BGS::last
	Marshal.dump(characters,		   file)
	Marshal.dump(Graphics.frame_count, file)
	Marshal.dump(@last_bgm,			file)
	Marshal.dump(@last_bgs,			file)
	Marshal.dump($game_system,		 file)
	Marshal.dump($game_message,		file)
	Marshal.dump($game_switches,	   file)
	Marshal.dump($game_variables,	  file)
	Marshal.dump($game_self_switches,  file)
	Marshal.dump($game_actors,		 file)
	Marshal.dump($game_party,		  file)
	Marshal.dump($game_troop,		  file)
	Marshal.dump($game_map,			file)
	Marshal.dump($game_player,		 file)
  end
  def read_save_data(file)
	characters		   = Marshal.load(file)
	Graphics.frame_count = Marshal.load(file)
	@last_bgm			= Marshal.load(file)
	@last_bgs			= Marshal.load(file)
	$game_system		 = Marshal.load(file)
	$game_message		= Marshal.load(file)
	$game_switches	   = Marshal.load(file)
	$game_variables	  = Marshal.load(file)
	$game_self_switches  = Marshal.load(file)
	$game_actors		 = Marshal.load(file)
	$game_party		  = Marshal.load(file)
	$game_troop		  = Marshal.load(file)
	$game_map			= Marshal.load(file)
	$game_player		 = Marshal.load(file)
	if $game_system.version_id != $data_system.version_id
	  $game_map.setup($game_map.map_id)
	  $game_player.center($game_player.x, $game_player.y)
	end
  end
end
class Scene_Title < Scene_Base
  def main
	if $BTEST
	  battle_test
	else
	  super
	end
  end
  def start
	super
	load_database
	create_game_objects
	check_continue
	create_title_graphic
	create_command_window
	play_title_music
  end
  def perform_transition
	Graphics.transition(20)
  end
  def post_start
	super
	open_command_window
  end
  def pre_terminate
	super
	close_command_window
  end
  def terminate
	super
	dispose_command_window
	snapshot_for_background
	dispose_title_graphic
  end
  def update
	super
	@command_window.update
	if Input.trigger?(Input::C)
	  case @command_window.index
	  when 0	#New game
		command_new_game
	  when 1	# Continue
		command_continue
	  when 2	# Shutdown
		command_shutdown
	  end
	end
  end
  def load_database
	$data_actors		= load_data("Data/Actors.rvdata")
	$data_classes	   = load_data("Data/Classes.rvdata")
	$data_skills		= load_data("Data/Skills.rvdata")
	$data_items		 = load_data("Data/Items.rvdata")
	$data_weapons	   = load_data("Data/Weapons.rvdata")
	$data_armors		= load_data("Data/Armors.rvdata")
	$data_enemies	   = load_data("Data/Enemies.rvdata")
	$data_troops		= load_data("Data/Troops.rvdata")
	$data_states		= load_data("Data/States.rvdata")
	$data_animations	= load_data("Data/Animations.rvdata")
	$data_common_events = load_data("Data/CommonEvents.rvdata")
	$data_system		= load_data("Data/System.rvdata")
	$data_areas		 = load_data("Data/Areas.rvdata")
  end
  def load_bt_database
	$data_actors		= load_data("Data/BT_Actors.rvdata")
	$data_classes	   = load_data("Data/BT_Classes.rvdata")
	$data_skills		= load_data("Data/BT_Skills.rvdata")
	$data_items		 = load_data("Data/BT_Items.rvdata")
	$data_weapons	   = load_data("Data/BT_Weapons.rvdata")
	$data_armors		= load_data("Data/BT_Armors.rvdata")
	$data_enemies	   = load_data("Data/BT_Enemies.rvdata")
	$data_troops		= load_data("Data/BT_Troops.rvdata")
	$data_states		= load_data("Data/BT_States.rvdata")
	$data_animations	= load_data("Data/BT_Animations.rvdata")
	$data_common_events = load_data("Data/BT_CommonEvents.rvdata")
	$data_system		= load_data("Data/BT_System.rvdata")
  end
  def create_game_objects
	$game_temp		  = Game_Temp.new
	$game_message	   = Game_Message.new
	$game_system		= Game_System.new
	$game_switches	  = Game_Switches.new
	$game_variables	 = Game_Variables.new
	$game_self_switches = Game_SelfSwitches.new
	$game_actors		= Game_Actors.new
	$game_party		 = Game_Party.new
	$game_troop		 = Game_Troop.new
	$game_map		   = Game_Map.new
	$game_player		= Game_Player.new
  end
  def check_continue
	@continue_enabled = (Dir.glob('Save*.rvdata').size > 0)
  end
  def create_title_graphic
	@sprite = Sprite.new
	@sprite.bitmap = Cache.system("Title")
  end
  def dispose_title_graphic
	@sprite.bitmap.dispose
	@sprite.dispose
  end
  def create_command_window
	s1 = Vocab::new_game
	s2 = Vocab::continue
	s3 = Vocab::shutdown
	@command_window = Window_Command.new(172, [s1, s2, s3])
	@command_window.x = (544 - @command_window.width) / 2
	@command_window.y = 288
	@command_window.openness = 0
	@command_window.open
  end
  def dispose_command_window
	@command_window.dispose
  end
  def open_command_window
	@command_window.open
	begin
	  @command_window.update
	  Graphics.update
	end until @command_window.openness == 255
  end
  def close_command_window
	@command_window.close
	begin
	  @command_window.update
	  Graphics.update
	end until @command_window.openness == 0
  end
  def play_title_music
	$data_system.title_bgm.play
	RPG::BGS.stop
	RPG::ME.stop
  end
  def confirm_player_location
	if $data_system.start_map_id == 0
	  print "Player start location not set."
	  exit
	end
  end
  def command_new_game
	data = []
	top_text = "Please make a save name"
	text = ""
	font = "Arial"
	max = 9
	size = 24
	$savename = Text_input.new(top_text, text, font, max, size).text
	confirm_player_location
	Sound.play_decision
	$game_party.setup_starting_members
	$game_map.setup($data_system.start_map_id)
	$game_player.moveto($data_system.start_x, $data_system.start_y)
	$game_player.refresh
	$scene = Scene_Map.new
	RPG::BGM.fade(1500)
	close_command_window
	Graphics.fadeout(60)
	Graphics.wait(40)
	Graphics.frame_count = 0
	RPG::BGM.stop
	$game_map.autoplay
  end
  def command_continue
	data = []
	top_text = "Please type your save name"
	text = ""
	font = "Arial"
	max = 9
	size = 24
	$savename = Text_input.new(top_text, text, font, max, size).text
	Sound.play_decision
	$scene = Scene_File.new(false, true, false)
  end
  def command_shutdown
	Sound.play_decision
	RPG::BGM.fade(800)
	RPG::BGS.fade(800)
	RPG::ME.fade(800)
	$scene = nil
  end
  def battle_test
	load_bt_database
	create_game_objects
	Graphics.frame_count = 0
	$game_party.setup_battle_test_members
	$game_troop.setup($data_system.test_troop_id)
	$game_troop.can_escape = true
	$game_system.battle_bgm.play
	snapshot_for_background
	$scene = Scene_Battle.new
  end
end
#======================================
# ■ Keyboard Script
#---------------------------------------------------------------------------
#  By: Cybersam
#   Date: 25/05/05
#   Version 4
#======================================
# How to use
# if Kboard.keyboard($R_Key_A)
#
module Kboard
 #--------------------------------------------------------------------------
 $RMouse_BUTTON_L = 0x01		# left mouse button
 $RMouse_BUTTON_R = 0x02		# right mouse button
 $RMouse_BUTTON_M = 0x04		# middle mouse button
 $RMouse_BUTTON_4 = 0x05		# 4th mouse button 
 $RMouse_BUTTON_5 = 0x06		# 5th mouse button
 #--------------------------------------------------------------------------
 $R_Key_BACK	  = 0x08		# BACKSPACE key
 $R_Key_TAB	   = 0x09		# TAB key
 $R_Key_RETURN	= 0x0D		# ENTER key
 $R_Key_SHIFT	 = 0x10		# SHIFT key
 $R_Key_CTLR	  = 0x11		# CTLR key
 $R_Key_ALT	   = 0x12		# ALT key
 $R_Key_PAUSE	 = 0x13		# PAUSE key
 $R_Key_CAPITAL   = 0x14		# CAPS LOCK key
 $R_Key_ESCAPE	= 0x1B		# ESC key
 $R_Key_SPACE	 = 0x20		# SPACEBAR
 $R_Key_PRIOR	 = 0x21		# PAGE UP key
 $R_Key_NEXT	  = 0x22		# PAGE DOWN key
 $R_Key_END	   = 0x23		# END key
 $R_Key_HOME	  = 0x24		# HOME key
 $R_Key_LEFT	  = 0x25		# LEFT ARROW key
 $R_Key_UP		= 0x26		# UP ARROW key
 $R_Key_RIGHT	 = 0x27		# RIGHT ARROW key
 $R_Key_DOWN	  = 0x28		# DOWN ARROW key
 $R_Key_SELECT	= 0x29		# SELECT key
 $R_Key_PRINT	 = 0x2A		# PRINT key
 $R_Key_SNAPSHOT  = 0x2C		# PRINT SCREEN key
 $R_Key_INSERT	= 0x2D		# INS key
 $R_Key_DELETE	= 0x2E		# DEL key
 #--------------------------------------------------------------------------
 $R_Key_0		 = 0x30		# 0 key
 $R_Key_1		 = 0x31		# 1 key
 $R_Key_2		 = 0x32		# 2 key
 $R_Key_3		 = 0x33		# 3 key
 $R_Key_4		 = 0x34		# 4 key
 $R_Key_5		 = 0x35		# 5 key
 $R_Key_6		 = 0x36		# 6 key
 $R_Key_7		 = 0x37		# 7 key
 $R_Key_8		 = 0x38		# 8 key
 $R_Key_9		 = 0x39		# 9 key
 #--------------------------------------------------------------------------
 $R_Key_A		 = 0x41		# A key
 $R_Key_B		 = 0x42		# B key
 $R_Key_C		 = 0x43		# C key
 $R_Key_D		 = 0x44		# D key
 $R_Key_E		 = 0x45		# E key
 $R_Key_F		 = 0x46		# F key
 $R_Key_G		 = 0x47		# G key
 $R_Key_H		 = 0x48		# H key
 $R_Key_I		 = 0x49		# I key
 $R_Key_J		 = 0x4A		# J key
 $R_Key_K		 = 0x4B		# K key
 $R_Key_L		 = 0x4C		# L key
 $R_Key_M		 = 0x4D		# M key
 $R_Key_N		 = 0x4E		# N key
 $R_Key_O		 = 0x4F		# O key
 $R_Key_P		 = 0x50		# P key
 $R_Key_Q		 = 0x51		# Q key
 $R_Key_R		 = 0x52		# R key
 $R_Key_S		 = 0x53		# S key
 $R_Key_T		 = 0x54		# T key
 $R_Key_U		 = 0x55		# U key
 $R_Key_V		 = 0x56		# V key
 $R_Key_W		 = 0x57		# W key
 $R_Key_X		 = 0x58		# X key
 $R_Key_Y		 = 0x59		# Y key
 $R_Key_Z		 = 0x5A		# Z key
 #--------------------------------------------------------------------------
 $R_Key_LWIN	  = 0x5B		# Left Windows key (Microsoft Natural keyboard) 
 $R_Key_RWIN	  = 0x5C		# Right Windows key (Natural keyboard)
 $R_Key_APPS	  = 0x5D		# Applications key (Natural keyboard)
 #--------------------------------------------------------------------------
 $R_Key_NUMPAD0   = 0x60		# Numeric keypad 0 key
 $R_Key_NUMPAD1   = 0x61		# Numeric keypad 1 key
 $R_Key_NUMPAD2   = 0x62		# Numeric keypad 2 key
 $R_Key_NUMPAD3   = 0x63		# Numeric keypad 3 key
 $R_Key_NUMPAD4   = 0x64		# Numeric keypad 4 key
 $R_Key_NUMPAD5   = 0x65		# Numeric keypad 5 key
 $R_Key_NUMPAD6   = 0x66		# Numeric keypad 6 key
 $R_Key_NUMPAD7   = 0x67		# Numeric keypad 7 key
 $R_Key_NUMPAD8   = 0x68		# Numeric keypad 8 key
 $R_Key_NUMPAD9   = 0x69		# Numeric keypad 9 key
 $R_Key_MULTIPLY  = 0x6A		# Multiply key (*)
 $R_Key_ADD	   = 0x6B		# Add key (+)
 $R_Key_SEPARATOR = 0x6C		# Separator key
 $R_Key_SUBTRACT  = 0x6D		# Subtract key (-)
 $R_Key_DECIMAL   = 0x6E		# Decimal key
 $R_Key_DIVIDE	= 0x6F		# Divide key (/)
 #--------------------------------------------------------------------------
 $R_Key_F1		= 0x70		# F1 key
 $R_Key_F2		= 0x71		# F2 key
 $R_Key_F3		= 0x72		# F3 key
 $R_Key_F4		= 0x73		# F4 key
 $R_Key_F5		= 0x74		# F5 key
 $R_Key_F6		= 0x75		# F6 key
 $R_Key_F7		= 0x76		# F7 key
 $R_Key_F8		= 0x77		# F8 key
 $R_Key_F9		= 0x78		# F9 key
 $R_Key_F10	   = 0x79		# F10 key
 $R_Key_F11	   = 0x7A		# F11 key
 $R_Key_F12	   = 0x7B		# F12 key
 #--------------------------------------------------------------------------
 $R_Key_NUMLOCK   = 0x90		# NUM LOCK key
 $R_Key_SCROLL	= 0x91		# SCROLL LOCK key
 #--------------------------------------------------------------------------
 $R_Key_LSHIFT	= 0xA0		# Left SHIFT key
 $R_Key_RSHIFT	= 0xA1		# Right SHIFT key
 $R_Key_LCONTROL  = 0xA2		# Left CONTROL key
 $R_Key_RCONTROL  = 0xA3		# Right CONTROL key
 $R_Key_L_ALT	 = 0xA4		# Left ALT key
 $R_Key_R_ALT	 = 0xA5		# Right ALT key
 #--------------------------------------------------------------------------
 $R_Key_SEP	   = 0xBC		# , key
 $R_Key_DASH	  = 0xBD		# - key
 $R_Key_DOTT	  = 0xBE		# . key
 #--------------------------------------------------------------------------
 GetKeyState = Win32API.new("user32","GetAsyncKeyState",['i'],'i')
 GetKeyboardState = Win32API.new("user32","GetKeyState",['i'],'i')
 GetSetKeyState = Win32API.new("user32","SetKeyboardState",['i'],'i')
 #--------------------------------------------------------------------------
 module_function
 #--------------------------------------------------------------------------
 def keyb(rkey)
	if GetKeyState.call(rkey) != 0
	  return 1
	end
	return 0
 end
  #--------------------------------------------------------------------------
 def keyboard(rkey)
   GetKeyState.call(rkey) & 0x01 == 1  #
 end
 #--------------------------------------------------------------------------
 def key(rkey, key = 0)
   GetKeyboardState.call(rkey) & 0x01 == key #
 end
end
#===============================================================================
#
# Text-Input Script v1									 created by: cybersam
#
# hi boys and ladys.... and whatever else ^-^
#
# here comes the script that allows you to insert text with the keyboard
# in your game... ^-^
#
# i didnt make it work with the default name edit/input script
# but with this it should be easier for you guys to do it...
# the reason ?!.. i said it already in other scripts... ^-^
#
# "i dont wana do a complete script that you can post in your games and it works
# without a single modification"...
#
# since there are people here that just dont even wont try to learn ruby...
# this script works perfect of its own....
# but it wont let you edit the character name without modification...
# so go on and try it out...
#
# if you need help to edit something just ask...
# i would gladly help but i wont do all the work for you...
#
# thats it from my side...
# as for now... this will be the last update
# for this script (keyboard/mouse script) from my side...
# if you find any bugs please contact me... you should already now how... ^-^
# and dont tell me "there is a bug in you script!"
# that alone is not enough... ^-^
#
# cya all ^-^
# sam
#
#===============================================================================

class Text_input < Window_Base

  def initialize(top_text = "Here comes the new Version of the keyboard script", text = "Keyboad - Script v3", font = "Arial", max = 20, size = 16, free = "_")
	@toptext = top_text
	@text =  text
	@font = font
	@max = max
	@size = size
	@free = free
	super(320 - (@max*@size+@size)/2, 240-@size*2-32, @max * @size + 32, 128)
	self.contents = Bitmap.new(width - 32, height - 32)
	self.contents.font.name = @font
	self.contents.font.size = @size
	self.z = 256
	@twidth = @max*@size
	refresh
	update
  end
  def refresh
	self.contents.clear
	self.contents.font.color = system_color
	self.contents.draw_text(0, 0, @twidth, @size, @toptext, 1)
	for i in 0...@max
	  text = @text[i]
	  if text == nil
		text = @free
	  else
		text = text.chr
	  end
	  self.contents.font.color = normal_color
	  self.contents.draw_text(@size * i, @size + 24, @size, @size, text, 1)
	end
  end
	def update
	  loop do
		Graphics.update
		refresh
		if Kboard.keyboard($R_Key_BACK) # delete (with backspace)
		  text = ""
		  if @text.size != 0
			for i in 0...@text.size - 1
			  text  += @text[i].chr
			end
		  @text = text
		  else
		  end
		end
		if Kboard.keyboard($R_Key_RETURN) # Enter key... to end...
		  #$game_variables[1]=@text
		  return
		end

		if @text.size < @max

# putting Key's to the text


		  if Kboard.keyboard($R_Key_SPACE) # space key (to insert space between the chars... ^-^)
			@text += " " # space.. you can set anything else if you want ^-^'
		  end
		  if Kboard.key($R_Key_CAPITAL, 1) # if caps lock is active then write the chars in higher case
			if Kboard.keyboard($R_Key_A)
			  @text += "A"
			end
			if Kboard.keyboard($R_Key_B)
			  @text += "B"
			end
			if Kboard.keyboard($R_Key_C)
			@text += "C"
			end
			if Kboard.keyboard($R_Key_D)
			  @text += "D"
			end		  
			if Kboard.keyboard($R_Key_E)
			  @text += "E"
			end
			if Kboard.keyboard($R_Key_F)
			  @text += "F"
			end
			if Kboard.keyboard($R_Key_G)
			  @text += "G"
			end
			if Kboard.keyboard($R_Key_H)
			  @text += "H"
			end
			if Kboard.keyboard($R_Key_I)
			  @text += "I"
			end
			if Kboard.keyboard($R_Key_J)
			  @text += "J"
			end
			if Kboard.keyboard($R_Key_K)
			  @text += "K"
			end
			if Kboard.keyboard($R_Key_L)
			  @text += "L"
			end
			if Kboard.keyboard($R_Key_M)
			  @text += "M"
			end
			if Kboard.keyboard($R_Key_N)
			  @text += "N"
			end
			if Kboard.keyboard($R_Key_O)
			  @text += "O"
			end
			if Kboard.keyboard($R_Key_P)
			  @text += "P"
			end
			if Kboard.keyboard($R_Key_Q)
			  @text += "Q"
			end
			if Kboard.keyboard($R_Key_R)
			  @text += "R"
			end
			if Kboard.keyboard($R_Key_S)
			  @text += "S"
			end
			if Kboard.keyboard($R_Key_T)
			  @text += "T"
			end
			if Kboard.keyboard($R_Key_U)
			  @text += "U"
			end
			if Kboard.keyboard($R_Key_V)
			  @text += "V"
			end
			if Kboard.keyboard($R_Key_W)
			  @text += "W"
			end
			if Kboard.keyboard($R_Key_X)
			  @text += "X"
			end
			if Kboard.keyboard($R_Key_Y)
			  @text += "Y"
			end
			if Kboard.keyboard($R_Key_Z)
			  @text += "Z"
			end

		  elsif Kboard.key($R_Key_CAPITAL) # if caps lock is deactivated then write in lower case

			if Kboard.keyboard($R_Key_A)
			  @text += "a"
			end
			if Kboard.keyboard($R_Key_B)
			  @text += "b"
			end
			if Kboard.keyboard($R_Key_C)
			@text += "c"
			end
			if Kboard.keyboard($R_Key_D)
			  @text += "d"
			end		  
			if Kboard.keyboard($R_Key_E)
			  @text += "e"
			end
			if Kboard.keyboard($R_Key_F)
			  @text += "f"
			end
			if Kboard.keyboard($R_Key_G)
			  @text += "g"
			end
			if Kboard.keyboard($R_Key_H)
			  @text += "h"
			end
			if Kboard.keyboard($R_Key_I)
			  @text += "i"
			end
			if Kboard.keyboard($R_Key_J)
			  @text += "j"
			end
			if Kboard.keyboard($R_Key_K)
			  @text += "k"
			end
			if Kboard.keyboard($R_Key_L)
			  @text += "l"
			end
			if Kboard.keyboard($R_Key_M)
			  @text += "m"
			end
			if Kboard.keyboard($R_Key_N)
			  @text += "n"
			end
			if Kboard.keyboard($R_Key_O)
			  @text += "o"
			end
			if Kboard.keyboard($R_Key_P)
			  @text += "p"
			end
			if Kboard.keyboard($R_Key_Q)
			  @text += "q"
			end
			if Kboard.keyboard($R_Key_R)
			  @text += "r"
			end
			if Kboard.keyboard($R_Key_S)
			  @text += "s"
			end
			if Kboard.keyboard($R_Key_T)
			  @text += "t"
			end
			if Kboard.keyboard($R_Key_U)
			  @text += "u"
			end
			if Kboard.keyboard($R_Key_V)
			  @text += "v"
			end
			if Kboard.keyboard($R_Key_W)
			  @text += "w"
			end
			if Kboard.keyboard($R_Key_X)
			  @text += "x"
			end
			if Kboard.keyboard($R_Key_Y)
			  @text += "y"
			end
			if Kboard.keyboard($R_Key_Z)
			  @text += "z"
			end
		  end
   
# numbers

		  if Kboard.keyboard($R_Key_0)
			@text += "0"
		  end
		  if Kboard.keyboard($R_Key_1)
			@text += "1"
		  end
		  if Kboard.keyboard($R_Key_2)
			@text += "2"
		  end
		  if Kboard.keyboard($R_Key_3)
			@text += "3"
		  end
		  if Kboard.keyboard($R_Key_4)
			@text += "4"
		  end
		  if Kboard.keyboard($R_Key_5)
			@text += "5"
		  end
		  if Kboard.keyboard($R_Key_6)
			@text += "6"
		  end
		  if Kboard.keyboard($R_Key_7)
			@text += "7"
		  end
		  if Kboard.keyboard($R_Key_8)
			@text += "8"
		  end
		  if Kboard.keyboard($R_Key_9)
			@text += "9"
		  end
		  
	 
		  
# numpad
		  if Kboard.keyboard($R_Key_NUMPAD0)
			@text += "0"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD1)
			@text += "1"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD2)
			@text += "2"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD3)
			@text += "3"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD4)
			@text += "4"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD5)
			@text += "5"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD6)
			@text += "6"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD7)
			@text += "7"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD8)
			@text += "8"
		  end
		  if Kboard.keyboard($R_Key_NUMPAD9)
			@text += "9"
		  end

		  if Kboard.keyboard($R_Key_ADD) # + (numpad)
			@text += "+"
		  end
		  if Kboard.keyboard($R_Key_SUBTRACT) # - (numpad)
			@text += "-"
		  end
		  if Kboard.keyboard($R_Key_DIVIDE) # / (numpad)
			@text += "/"
		  end
		  if Kboard.keyboard($R_Key_MULTIPLY) # * (numpad)
			@text += "*"
		  end
		  
		  if Kboard.key($R_Key_CAPITAL) # since i dont want to change my keyboard layout you need to test it for you'r self...
			if Kboard.keyboard($R_Key_SEP) # , (key) (tested german keyboard layout)
			  @text += ","
			end
			if Kboard.keyboard($R_Key_DASH) # - (key) (tested german keyboard layout)
			  @text += "-"
			end
			if Kboard.keyboard($R_Key_DOTT) # . (key) (tested german keyboard layout)
			  @text += "."
			end
		  elsif Kboard.key($R_Key_CAPITAL, 1)
			if Kboard.keyboard($R_Key_SEP) # , (key) (tested german keyboard layout)
			  @text += ";"
			end
			if Kboard.keyboard($R_Key_DASH) # - (key) (tested german keyboard layout)
			  @text += "_"
			end
			if Kboard.keyboard($R_Key_DOTT) # . (key) (tested german keyboard layout)
			  @text += ":"
			end
		  end

		else
		end
	  refresh
	end
  end
  def text()
	self.contents.dispose
	self.dispose
	return @text
  end
end
Credits:
Polraudio
RPG Advocate(Unlimited Save Files)
Cybersam(Keyboard and Input Text)

#2 Raxus

    Advanced Member

  • Member
  • 65 posts

Posted 08 July 2008 - 05:36 PM

Umm, could you put the script in a spoiler like fashion. I always have trouble copying script that are placed like that. It only copies them to the first line of the script editor.

Thanks Polraudio,

§ Raxus §

#3 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 08 July 2008 - 10:38 PM

There you go Raxus

This an updated version of the 300mill save files. Its now plug and play and it requires no modification. You can also name your save files now.
If you liked the old one you will like this one and if you didn't like the old one you might like this one.

Let me know what you think

#4 Raxus

    Advanced Member

  • Member
  • 65 posts

Posted 08 July 2008 - 11:57 PM

Nice! I'm so using it in my game! You should put this on the Creation Asylum to build up so heavy Rep. :D

§ Raxus §

#5 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 09 July 2008 - 08:24 PM

Already put it on there. Seems like no one cares about it yet.But once they see what it does they will.

#6 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 10 July 2008 - 04:13 PM

Added a RMVX Version for you VX Users

#7 isaacsol

    Server Manager/Eventing Teacher

  • Admin
  • 627 posts

Posted 11 July 2008 - 09:56 AM

This would be absolutely perfect to prevent that annoying little friend from overwriting your save data. Thanks for both versions.

#8 Raxus

    Advanced Member

  • Member
  • 65 posts

Posted 11 July 2008 - 03:35 PM

If anyone sees this script, they should put in in. I love this script. Two thumbs way up! You're an amazing scipter.

You're my hero,
§ Raxus §

#9 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 12 July 2008 - 05:06 PM

Raxus: Thanks

isaacsol: I'm working on a version that allows you to put a password on your save file.

If you have any ideas let me know

#10 LotusBoss007

    Newbie

  • Member
  • 1 posts

Posted 13 January 2010 - 11:28 PM

This is an awesome script. Im glad that you have put it on for pplz 2 uze

#11 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 14 January 2010 - 03:11 AM

Thank you. Hope you enjoy it as others did.

#12 imapro

    Advanced Member

  • Member
  • 50 posts

Posted 21 December 2010 - 12:55 AM

can i use this in my site NoReson.com??

#13 Gatekeeper101

    Newbie

  • Member
  • 1 posts

Posted 05 August 2011 - 03:02 AM

Noticed the Code needed some error checking for when there is not a save to continue from.
Should be inserted @ line #336
Spoiler


#14 Polraudio

    Master of the Mind

  • Moderator
  • 3,478 posts

Posted 05 August 2011 - 03:40 AM

Theres actually a reason for that. You see the files are not named save.rxdata. its actually save.yoursavename.
I did consider that when i made the script.

Thanks for checking out the script.





0 user(s) are reading this topic

members, guests, anonymous users