[php]if true # << Make true to use this script, false to disable.
#===============================================================================
#
# ☆ $D13x - Key Menu
# -- Author : Dekita
# -- Version : 1.2
# -- Level : Easy / Normal
# -- Requires : $D13x Core v 1.4+
# -- Engine : RPG Maker VX Ace.
#
#===============================================================================
# ☆ Import
#
$D13x={}if$D13x==nil
$D13x[:Key_Menu]=true
#===============================================================================
# ☆ Updates
#
# D /M /Y
# o4/o4/2o13 - Added Switch Restrictions, (all keys)
# 29/o3/2o13 - Compatibility, (Key Menu HUD)
# - Bugfix, (scene re-trigger if long key press)
# 28/o3/2o13 - Finished,
# 27/o3/2o13 - Started
#
#===============================================================================
# ☆ Introduction
#
# This script allows the use of other keys to trigger various scenes,
# Such as 'M' Key triggering the menu, 'S' Key Triggering the Status Screen,
# 'I' key Triggering Items. ect..
# And of course allows easy removal of the default Menu calling key.
#
#===============================================================================
# ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
#===============================================================================
# 1. You MUST give credit to "Dekita" !!
# 2. You are NOT allowed to repost this script.(or modified versions)
# 3. You are NOT allowed to convert this script.
# 4. You are NOT allowed to use this script for Commercial games.
# 5. ENJOY!
#
# "FINE PRINT"
# By using this script you hereby agree to the above terms and conditions,
# if any violation of the above terms occurs "legal action" may be taken.
# Not understanding the above terms and conditions does NOT mean that
# they do not apply to you.
# If you wish to discuss the terms and conditions in further detail you can
# contact me at http://dekitarpg.wordpress.com/
#
#===============================================================================
# ☆ Instructions
#
# Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
#
#===============================================================================
# ☆ HELP
#
# For a list of possible key symbols check the help section of the
# $D13x core script.
#
#===============================================================================
module Key_Menu
#===============================================================================
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# ☆ Key Settings
#
# Make this true to disable the default Vx Ace menu key.
Disable_Menu_Call = true
end #####################
# CUSTOMISATION END #
#####################
#☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
# #
# http://dekitarpg.wordpress.com/ #
# #
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
#===============================================================================#
# ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
# YES?\.\. #
# OMG, REALLY? \| #
# WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
# I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
#===============================================================================#
class Scene_Map < Scene_Base
#===============================================================================
#
# Alias List
#
alias :update_my_KEYz :update_scene
alias :update_menu_key :update_call_menu
#
# Update Scene Transition
#
def update_scene
update_my_KEYz
update_de_keys
end
#
# Update Keys
#
def update_de_keys
return if scene_changing?
update_call_pause unless scene_changing?
update_new_call_menu unless scene_changing?
update__call_items unless scene_changing?
update__call_skills unless scene_changing?
update__call_equips unless scene_changing?
update__call_status unless scene_changing?
update__call_save unless scene_changing?
end
#
# Determine if Pause is being triggered
#
def update_call_pause
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Pause_Key[1] != 0)
return unless $game_switches[Key_Menu::Pause_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Pause_Key[0]])
SceneManager.call(Scene_End)
end
#
# Determine if Menu is Called due to Cancel Button
#
def update_call_menu
return if Key_Menu::Disable_Menu_Call
update_menu_key
end
#
# Determine if Menu is Called due to New Key
#
def update_new_call_menu
return unless Key_Menu::Disable_Menu_Call
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Menu_Key[1] != 0)
return unless $game_switches[Key_Menu::Menu_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Menu_Key[0]])
call_menu
end
#
# Determine if Menu is Called due to New Key
#
def update__call_items
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Items_Key[1] != 0)
return unless $game_switches[Key_Menu::Items_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Items_Key[0]])
SceneManager.call(Scene_Item)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_skills
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Skills_Key[1] != 0)
return unless $game_switches[Key_Menu::Skills_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Skills_Key[0]])
SceneManager.call(Scene_Skill)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_equips
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Equips_Key[1] != 0)
return unless $game_switches[Key_Menu::Equips_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Equips_Key[0]])
SceneManager.call(Scene_Equip)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_status
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Status_Key[1] != 0)
return unless $game_switches[Key_Menu::Status_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Status_Key[0]])
SceneManager.call(Scene_Status)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_save
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Save_Key[1] != 0)
return unless $game_switches[Key_Menu::Save_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Save_Key[0]])
SceneManager.call(Scene_Save)
end
end
#==============================================================================#
# http://dekitarpg.wordpress.com/ #
#==============================================================================#
end [/php]
Dùng cái này :
[php]if Keys.trigger?(:ESC) then SceneManager.return end[/php]
#
# initial module settings - Created by OriginalWij and Yanfly
#
GetKeyState = Win32API.new("user32", "GetAsyncKeyState", "i", "i")
GetCapState = Win32API.new("user32", "GetKeyState", "i", "i")
KeyRepeatCounter = {}
module_function
#
# alias method: update - Created by OriginalWij
#
class <<self; alias input_update_debug update; end
def self.update
input_update_debug
for key in KeyRepeatCounter.keys
if (GetKeyState.call(key).abs & 0x8000 == 0x8000)
KeyRepeatCounter[key] += 1
else
KeyRepeatCounter.delete(key)
end
end
end
#
# alias method: press? - Created by OriginalWij
#
class <<self; alias input_press_debug press?; end
def self.press?(key)
return input_press_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
return true unless KeyRepeatCounter[adjusted_key].nil?
return key_pressed?(adjusted_key)
end
#
# alias method: trigger? - Created by OriginalWij
#
class <<self; alias input_trigger_debug trigger?; end
def self.trigger?(key)
return input_trigger_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
count = KeyRepeatCounter[adjusted_key]
return ((count == 0) || (count.nil? ? key_pressed?(adjusted_key) : false))
end
#
# alias method: repeat? - Created by OriginalWij
#
class <<self; alias input_repeat_debug repeat?; end
def self.repeat?(key)
return input_repeat_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
count = KeyRepeatCounter[adjusted_key]
return true if count == 0
if count.nil?
return key_pressed?(adjusted_key)
else
return (count >= 23 && (count - 23) % 6 == 0)
end
end
#
# new method: default_key? - Created by Yanfly
#
def self.default_key?(key)
return true if key.is_a?(Integer) && key < 30
return DEFAULT.include?(key)
end
#
# new method: adjust_key - Created by OriginalWij
#
def self.adjust_key(key)
key -= 130 if key.between?(130, 158)
return key
end
#
# new method: key_pressed? - Created by OriginalWij
#
def self.key_pressed?(key)
if (GetKeyState.call(key).abs & 0x8000 == 0x8000)
KeyRepeatCounter[key] = 0
return true
end
return false
end
#
# new method: typing? - Created by Yanfly
#
def self.typing?
return true if repeat?(SPACE)
for i in 'A'..'Z'
return true if repeat?(LETTERS)
end
for i in 0...NUMBERS.size
return true if repeat?(NUMBERS)
return true if repeat?(NUMPAD)
end
for key in Extras
return true if repeat?(key)
end
return false
end
#
# new method: key_type - Created by Yanfly
#
def self.key_type
return " " if repeat?(SPACE)
for i in 'A'..'Z'
next unless repeat?(LETTERS)
return upcase? ? i.upcase : i.downcase
end
for i in 0...NUMBERS.size
return i.to_s if repeat?(NUMPAD)
if !press?(SHIFT)
return i.to_s if repeat?(NUMBERS)
elsif repeat?(NUMBERS)
case i
when 1; return "!"
when 2; return "@"
when 3; return "#"
when 4; return "$"
when 5; return "%"
when 6; return "^"
when 7; return "&"
when 8; return "*"
when 9; return "("
when 0; return ")"
end
end
end
for key in Extras
next unless repeat?(key)
case key
when USCORE; return press?(SHIFT) ? "_" : "-"
when EQUALS; return press?(SHIFT) ? "+" : "="
when LBRACE; return press?(SHIFT) ? "{" : "["
when RBRACE; return press?(SHIFT) ? "}" : "]"
when BSLASH; return press?(SHIFT) ? "|" : "\\"
when SCOLON; return press?(SHIFT) ? ":" : ";"
when QUOTE; return press?(SHIFT) ? '"' : "'"
when COMMA; return press?(SHIFT) ? "<" : ","
when PERIOD; return press?(SHIFT) ? ">" : "."
when SLASH; return press?(SHIFT) ? "?" : "/"
when NMUL; return "*"
when NPLUS; return "+"
when NSEP; return ","
when NMINUS; return "-"
when NDECI; return "."
when NDIV; return "/"
end
end
return ""
end
#
# new method: upcase? - Created by Yanfly
#
def self.upcase?
return !press?(SHIFT) if GetCapState.call(CAPS) == 1
return true if press?(SHIFT)
return false
end
end # Input[/php]
Ko được , cái này được 1 thằng chế nhưng lỗi thì phải
Chưa tìm thấy ...
Comments
Ơ ? Nhưng mà variable nó nhận giá trị bằng số cơ mà ? đâu phải true - false nhỉ ?
add_command("Line 2", :Line2, $game_variables[1] == 0)
Thấy một số chỗ nó xài dấu hỏi ở phía trước để đặt điều kiện, có thể nói rõ cú pháp của dấu "?" được ko ?
F1 lên tự tìm hiểu.
Đã thử
[php]
if $game_party.members[1].id == nil
then (...)
[/php]
Nhưng báo lỗi
___
A` ! Thôi được rồi , :D
Dùng lệnh If-else mà thiếu "end" :D
def make_command_list
add_command("Line 1", :Line1)
add_command("Line 2", :Line2)
add_command("Line 3", :Line3)
add_command("---Exit---", :Exit)
end
end
class Scene_Custom < Scene_MenuBase
def start
super
create_background
create_window
draw_pet_info
end
def create_window
@mycad = Window_Command_Custom.new(32,32)
@mycad.set_handler( :Line1 , method(:Action1))
@mycad.set_handler( :Line2 , method(:Action2))
@mycad.set_handler( :Line3 , method(:Action3))
@mycad.set_handler( :Exit , method(:Action_exit))
end
def Action1
# Action here
@mycad.active = false
end
def Action_exit
SceneManager.return
end
end[/php]
Làm sao để ấn phím ESC thì thực hiện method Action_exit ?
***Tìm script nhập keyboard
Có đây rồi :
[php]if true # << Make true to use this script, false to disable.
#===============================================================================
#
# ☆ $D13x - Key Menu
# -- Author : Dekita
# -- Version : 1.2
# -- Level : Easy / Normal
# -- Requires : $D13x Core v 1.4+
# -- Engine : RPG Maker VX Ace.
#
#===============================================================================
# ☆ Import
#
$D13x={}if$D13x==nil
$D13x[:Key_Menu]=true
#===============================================================================
# ☆ Updates
#
# D /M /Y
# o4/o4/2o13 - Added Switch Restrictions, (all keys)
# 29/o3/2o13 - Compatibility, (Key Menu HUD)
# - Bugfix, (scene re-trigger if long key press)
# 28/o3/2o13 - Finished,
# 27/o3/2o13 - Started
#
#===============================================================================
# ☆ Introduction
#
# This script allows the use of other keys to trigger various scenes,
# Such as 'M' Key triggering the menu, 'S' Key Triggering the Status Screen,
# 'I' key Triggering Items. ect..
# And of course allows easy removal of the default Menu calling key.
#
#===============================================================================
# ★☆★☆★☆★☆★☆★☆★☆★ TERMS AND CONDITIONS: ☆★☆★☆★☆★☆★☆★☆★☆★☆
#===============================================================================
# 1. You MUST give credit to "Dekita" !!
# 2. You are NOT allowed to repost this script.(or modified versions)
# 3. You are NOT allowed to convert this script.
# 4. You are NOT allowed to use this script for Commercial games.
# 5. ENJOY!
#
# "FINE PRINT"
# By using this script you hereby agree to the above terms and conditions,
# if any violation of the above terms occurs "legal action" may be taken.
# Not understanding the above terms and conditions does NOT mean that
# they do not apply to you.
# If you wish to discuss the terms and conditions in further detail you can
# contact me at http://dekitarpg.wordpress.com/
#
#===============================================================================
# ☆ Instructions
#
# Place Below " ▼ Materials " and Above " ▼ Main " in your script editor.
#
#===============================================================================
# ☆ HELP
#
# For a list of possible key symbols check the help section of the
# $D13x core script.
#
#===============================================================================
module Key_Menu
#===============================================================================
#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# ☆ Key Settings
#
# Make this true to disable the default Vx Ace menu key.
Disable_Menu_Call = true
# Menu Item = [ :KEY , Switch ]
Menu_Key = [ :H , 0 ] # Triggers Menu :NONE = no trigger
Items_Key = [ :I , 0 ] # Triggers Items
Skills_Key = [ :M , 0 ] # Triggers Skills
Equips_Key = [ :G , 0 ] # Triggers Equip
Status_Key = [ :P , 0 ] # Triggers Status
Save_Key = [ :N , 0 ] # Triggers Save
Pause_Key = [ :O , 0 ] # Triggers Game End
end #####################
# CUSTOMISATION END #
#####################
#☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★#
# #
# http://dekitarpg.wordpress.com/ #
# #
#★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆#
#===============================================================================#
# ARE YOU MODIFYING BEYOND THIS POINT? \.\. #
# YES?\.\. #
# OMG, REALLY? \| #
# WELL SLAP MY FACE AND CALL ME A DRAGONITE.\..\.. #
# I REALLY DIDN'T THINK YOU HAD IT IN YOU.\..\.. #
#===============================================================================#
class Scene_Map < Scene_Base
#===============================================================================
#
# Alias List
#
alias :update_my_KEYz :update_scene
alias :update_menu_key :update_call_menu
#
# Update Scene Transition
#
def update_scene
update_my_KEYz
update_de_keys
end
#
# Update Keys
#
def update_de_keys
return if scene_changing?
update_call_pause unless scene_changing?
update_new_call_menu unless scene_changing?
update__call_items unless scene_changing?
update__call_skills unless scene_changing?
update__call_equips unless scene_changing?
update__call_status unless scene_changing?
update__call_save unless scene_changing?
end
#
# Determine if Pause is being triggered
#
def update_call_pause
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Pause_Key[1] != 0)
return unless $game_switches[Key_Menu::Pause_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Pause_Key[0]])
SceneManager.call(Scene_End)
end
#
# Determine if Menu is Called due to Cancel Button
#
def update_call_menu
return if Key_Menu::Disable_Menu_Call
update_menu_key
end
#
# Determine if Menu is Called due to New Key
#
def update_new_call_menu
return unless Key_Menu::Disable_Menu_Call
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Menu_Key[1] != 0)
return unless $game_switches[Key_Menu::Menu_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Menu_Key[0]])
call_menu
end
#
# Determine if Menu is Called due to New Key
#
def update__call_items
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Items_Key[1] != 0)
return unless $game_switches[Key_Menu::Items_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Items_Key[0]])
SceneManager.call(Scene_Item)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_skills
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Skills_Key[1] != 0)
return unless $game_switches[Key_Menu::Skills_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Skills_Key[0]])
SceneManager.call(Scene_Skill)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_equips
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Equips_Key[1] != 0)
return unless $game_switches[Key_Menu::Equips_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Equips_Key[0]])
SceneManager.call(Scene_Equip)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_status
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Status_Key[1] != 0)
return unless $game_switches[Key_Menu::Status_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Status_Key[0]])
SceneManager.call(Scene_Status)
end
#
# Determine if Menu is Called due to New Key
#
def update__call_save
return unless !$game_map.interpreter.running?
return unless !$game_player.moving?
if (Key_Menu::Save_Key[1] != 0)
return unless $game_switches[Key_Menu::Save_Key[1]]
end
return unless Keys.trigger?(Keys::Key[Key_Menu::Save_Key[0]])
SceneManager.call(Scene_Save)
end
end
#==============================================================================#
# http://dekitarpg.wordpress.com/ #
#==============================================================================#
end [/php]
Dùng cái này :
[php]if Keys.trigger?(:ESC) then SceneManager.return end[/php]
Mà ko có đc
nhưng vị trí đặt như vầy có phù hợp ko ?
[php]class Window_Command_Custom< Window_Command
def make_command_list
add_command("Line 1", :Line1)
add_command("Line 2", :Line2)
add_command("Line 3", :Line3)
add_command("---Exit---", :Exit)
end
end
class Scene_Custom < Scene_MenuBase
def start
super
create_background
create_window
draw_pet_info
end
def create_window
@mycad = Window_Command_Custom.new(32,32)
@mycad.set_handler( :Line1 , method(:Action1))
@mycad.set_handler( :Line2 , method(:Action2))
@mycad.set_handler( :Line3 , method(:Action3))
@mycad.set_handler( :Exit , method(:Action_exit))
if Keys.trigger?(:ESC) then SceneManager.return end
end
def Action1
# Action here
@mycad.active = false
end
def Action_exit
SceneManager.return
end
end[/php]
[php]#==============================================================================
# ■ Input
#==============================================================================
module Input
#
# constants - Created by OriginalWij and Yanfly
#
DEFAULT = [:DOWN, :LEFT, :RIGHT, :UP, :A, :B, :C, :X, :Y, :Z, :L, :R,
:SHIFT, :CTRL, :ALT, :F5, :F6, :F7, :F8, :F9]
LETTERS = {}
LETTERS = 65; LETTERS = 66; LETTERS = 67; LETTERS = 68
LETTERS = 69; LETTERS = 70; LETTERS = 71; LETTERS = 72
LETTERS = 73; LETTERS = 74; LETTERS = 75; LETTERS = 76
LETTERS = 77; LETTERS = 78; LETTERS = 79; LETTERS = 80
LETTERS = 81; LETTERS = 82; LETTERS = 83; LETTERS = 84
LETTERS = 85; LETTERS = 86; LETTERS = 87; LETTERS = 88
LETTERS = 89; LETTERS = 90
NUMBERS = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57]
NUMPAD = [96, 97, 98, 99, 100, 101, 102, 103, 104, 105]
BACK = 138; ENTER = 143; SPACE = 32; SCOLON = 186; ESC = 157
QUOTE = 222; EQUALS = 187; COMMA = 188; USCORE = 189; PERIOD = 190
SLASH = 191; LBRACE = 219; RBRACE = 221; BSLASH = 220; TILDE = 192
F10 = 121; F11 = 122; CAPS = 20; NMUL = 106; NPLUS = 107
NSEP = 108; NMINUS = 109; NDECI = 110; NDIV = 111;
Extras = [USCORE, EQUALS, LBRACE, RBRACE, BSLASH, SCOLON, QUOTE, COMMA,
PERIOD, SLASH, NMUL, NPLUS, NSEP, NMINUS, NDECI, NDIV]
#
# initial module settings - Created by OriginalWij and Yanfly
#
GetKeyState = Win32API.new("user32", "GetAsyncKeyState", "i", "i")
GetCapState = Win32API.new("user32", "GetKeyState", "i", "i")
KeyRepeatCounter = {}
module_function
#
# alias method: update - Created by OriginalWij
#
class <<self; alias input_update_debug update; end
def self.update
input_update_debug
for key in KeyRepeatCounter.keys
if (GetKeyState.call(key).abs & 0x8000 == 0x8000)
KeyRepeatCounter[key] += 1
else
KeyRepeatCounter.delete(key)
end
end
end
#
# alias method: press? - Created by OriginalWij
#
class <<self; alias input_press_debug press?; end
def self.press?(key)
return input_press_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
return true unless KeyRepeatCounter[adjusted_key].nil?
return key_pressed?(adjusted_key)
end
#
# alias method: trigger? - Created by OriginalWij
#
class <<self; alias input_trigger_debug trigger?; end
def self.trigger?(key)
return input_trigger_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
count = KeyRepeatCounter[adjusted_key]
return ((count == 0) || (count.nil? ? key_pressed?(adjusted_key) : false))
end
#
# alias method: repeat? - Created by OriginalWij
#
class <<self; alias input_repeat_debug repeat?; end
def self.repeat?(key)
return input_repeat_debug(key) if default_key?(key)
adjusted_key = adjust_key(key)
count = KeyRepeatCounter[adjusted_key]
return true if count == 0
if count.nil?
return key_pressed?(adjusted_key)
else
return (count >= 23 && (count - 23) % 6 == 0)
end
end
#
# new method: default_key? - Created by Yanfly
#
def self.default_key?(key)
return true if key.is_a?(Integer) && key < 30
return DEFAULT.include?(key)
end
#
# new method: adjust_key - Created by OriginalWij
#
def self.adjust_key(key)
key -= 130 if key.between?(130, 158)
return key
end
#
# new method: key_pressed? - Created by OriginalWij
#
def self.key_pressed?(key)
if (GetKeyState.call(key).abs & 0x8000 == 0x8000)
KeyRepeatCounter[key] = 0
return true
end
return false
end
#
# new method: typing? - Created by Yanfly
#
def self.typing?
return true if repeat?(SPACE)
for i in 'A'..'Z'
return true if repeat?(LETTERS)
end
for i in 0...NUMBERS.size
return true if repeat?(NUMBERS)
return true if repeat?(NUMPAD)
end
for key in Extras
return true if repeat?(key)
end
return false
end
#
# new method: key_type - Created by Yanfly
#
def self.key_type
return " " if repeat?(SPACE)
for i in 'A'..'Z'
next unless repeat?(LETTERS)
return upcase? ? i.upcase : i.downcase
end
for i in 0...NUMBERS.size
return i.to_s if repeat?(NUMPAD)
if !press?(SHIFT)
return i.to_s if repeat?(NUMBERS)
elsif repeat?(NUMBERS)
case i
when 1; return "!"
when 2; return "@"
when 3; return "#"
when 4; return "$"
when 5; return "%"
when 6; return "^"
when 7; return "&"
when 8; return "*"
when 9; return "("
when 0; return ")"
end
end
end
for key in Extras
next unless repeat?(key)
case key
when USCORE; return press?(SHIFT) ? "_" : "-"
when EQUALS; return press?(SHIFT) ? "+" : "="
when LBRACE; return press?(SHIFT) ? "{" : "["
when RBRACE; return press?(SHIFT) ? "}" : "]"
when BSLASH; return press?(SHIFT) ? "|" : "\\"
when SCOLON; return press?(SHIFT) ? ":" : ";"
when QUOTE; return press?(SHIFT) ? '"' : "'"
when COMMA; return press?(SHIFT) ? "<" : ","
when PERIOD; return press?(SHIFT) ? ">" : "."
when SLASH; return press?(SHIFT) ? "?" : "/"
when NMUL; return "*"
when NPLUS; return "+"
when NSEP; return ","
when NMINUS; return "-"
when NDECI; return "."
when NDIV; return "/"
end
end
return ""
end
#
# new method: upcase? - Created by Yanfly
#
def self.upcase?
return !press?(SHIFT) if GetCapState.call(CAPS) == 1
return true if press?(SHIFT)
return false
end
end # Input[/php]
Ko được
Chưa tìm thấy ...
[php]set_handler(:cancel, method(:return_scene))[/php]
Giả sử script sau là đúng :
[php]class 1 < 2
super
tim_thay_death
def tim_thay_death
death_tên_thật_là = tên_thật
end
end
###########
class 3 < 4
def tim_ra_su_that
tên_thật = a + b
A = new.1
end
end[/php]
Làm sao để có biến tên_thật ở def tim_thay_death
@death !!!