11-05-2008, 01:00 PM
Personal Save Files V1
polraudio
Nov 5 2008
polraudio
Nov 5 2008
This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.
No support is given. If you are the owner of the thread, please contact administration.
Features:
This script allows you to have a name for your save files
Replaces Scene_Title
Instructions:
Place directly above main
Screens
None Needed
Demo:
None unless requested
RMXP Version
Code:
#---------------------
# 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_script_var, file)
Marshal.dump($game_script_swi, 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_script_var = Marshal.load(file)
$game_script_swi = 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