持有物品时习得技能
# @taroxd metadata 1.0
# @id learn_skill_by_item
# @display 持有物品时习得技能
# @require taroxd_core
# @help 在角色处备注 <learn x by y>,表示当持有道具 y 时习得技能 x
Taroxd::LearnSkillByItem = /<learn\s*(\d+)\s*by\s*(\d+)>/i

class RPG::Actor < RPG::BaseItem

  # 由 [技能id, 物品] 构成的数组
  def learn_skill_by_item
    @learn_skill_by_item ||=
    @note.scan(Taroxd::LearnSkillByItem).map do |(x, y)|
      [x.to_i, $data_items[y.to_i]]
    end
  end
end

class Game_Actor < Game_Battler

  def_with :added_skills do |old|
    actor.learn_skill_by_item.each do |(skill_id, item)|
      old.push(skill_id) if $game_party.has_item?(item)
    end
    old
  end
end
全键盘脚本
# @taroxd metadata 1.0
# @require taroxd_core
# @display 全键盘脚本
# @id keyboard
module Keyboard

  Taroxd::Keyboard = self

  BUTTON_L  = 0x01        # left mouse button
  BUTTON_R  = 0x02        # right mouse button
  BUTTON_M  = 0x04        # middle mouse button
  BUTTON_4  = 0x05        # 4th mouse button
  BUTTON_5  = 0x06        # 5th mouse button

  BACK      = 0x08        # BACKSPACE key
  TAB       = 0x09        # TAB key
  ENTER     = 0x0D        # ENTER key
  SHIFT     = 0x10        # SHIFT key
  CTLR      = 0x11        # CTLR key
  ALT       = 0x12        # ALT key
  PAUSE     = 0x13        # PAUSE key
  CAPS      = 0x14        # CAPS LOCK key
  ESC       = 0x1B        # ESC key
  SPACE     = 0x20        # SPACEBAR
  PRIOR     = 0x21        # PAGE UP key
  NEXT      = 0x22        # PAGE DOWN key
  self::END = 0x23        # END key
  HOME      = 0x24        # HOME key
  LEFT      = 0x25        # LEFT ARROW key
  UP        = 0x26        # UP ARROW key
  RIGHT     = 0x27        # RIGHT ARROW key
  DOWN      = 0x28        # DOWN ARROW key
  SELECT    = 0x29        # SELECT key
  PRINT     = 0x2A        # PRINT key
  BB        = 0x2B        # SELECT key
  SNAPSHOT  = 0x2C        # PRINT SCREEN key
  INSERT    = 0x2D        # INS key
  DELETE    = 0x2E        # DEL key

  NUM0      = 0x30        # 0 key
  NUM1      = 0x31        # 1 key
  NUM2      = 0x32        # 2 key
  NUM3      = 0x33        # 3 key
  NUM4      = 0x34        # 4 key
  NUM5      = 0x35        # 5 key
  NUM6      = 0x36        # 6 key
  NUM7      = 0x37        # 7 key
  NUM8      = 0x38        # 8 key
  NUM9      = 0x39        # 9 key
  A         = 0x41        # A key
  B         = 0x42        # B key
  C         = 0x43        # C key
  D         = 0x44        # D key
  E         = 0x45        # E key
  F         = 0x46        # F key
  G         = 0x47        # G key
  H         = 0x48        # H key
  I         = 0x49        # I key
  J         = 0x4A        # J key
  K         = 0x4B        # K key
  L         = 0x4C        # L key
  M         = 0x4D        # M key
  N         = 0x4E        # N key
  O         = 0x4F        # O key
  P         = 0x50        # P key
  Q         = 0x51        # Q key
  R         = 0x52        # R key
  S         = 0x53        # S key
  T         = 0x54        # T key
  U         = 0x55        # U key
  V         = 0x56        # V key
  W         = 0x57        # W key
  X         = 0x58        # X key
  Y         = 0x59        # Y key
  Z         = 0x5A        # Z key

  LWIN      = 0x5B        # Left Windows key (Microsoft Natural keyboard)
  RWIN      = 0x5C        # Right Windows key (Natural keyboard)
  APPS      = 0x5D        # Applications key (Natural keyboard)

  NUMPAD0   = 0x60        # Numeric keypad 0 key
  NUMPAD1   = 0x61        # Numeric keypad 1 key
  NUMPAD2   = 0x62        # Numeric keypad 2 key
  NUMPAD3   = 0x63        # Numeric keypad 3 key
  NUMPAD4   = 0x64        # Numeric keypad 4 key
  NUMPAD5   = 0x65        # Numeric keypad 5 key
  NUMPAD6   = 0x66        # Numeric keypad 6 key
  NUMPAD7   = 0x67        # Numeric keypad 7 key
  NUMPAD8   = 0x68        # Numeric keypad 8 key
  NUMPAD9   = 0x69        # Numeric keypad 9 key
  MULTIPLY  = 0x6A        # Multiply key (*)
  ADD       = 0x6B        # Add key (+)
  SEPARATOR = 0x6C        # Separator key
  SUBTRACT  = 0x6D        # Subtract key (-)
  DECIMAL   = 0x6E        # Decimal key
  DIVIDE    = 0x6F        # Divide key (/)

  F1        = 0x70        # F1 key
  F2        = 0x71        # F2 key
  F3        = 0x72        # F3 key
  F4        = 0x73        # F4 key
  F5        = 0x74        # F5 key
  F6        = 0x75        # F6 key
  F7        = 0x76        # F7 key
  F8        = 0x77        # F8 key
  F9        = 0x78        # F9 key
  F10       = 0x79        # F10 key
  F11       = 0x7A        # F11 key
  F12       = 0x7B        # F12 key

  NUMLOCK   = 0x90        # NUM LOCK key
  SCROLL    = 0x91        # SCROLL LOCK key

  LSHIFT    = 0xA0        # Left SHIFT key
  RSHIFT    = 0xA1        # Right SHIFT key
  LCONTROL  = 0xA2        # Left CONTROL key
  RCONTROL  = 0xA3        # Right CONTROL key
  L_ALT     = 0xA4        # Left ALT key
  R_ALT     = 0xA5        # Right ALT key

  SEP       = 0xBC        # , key
  DASH      = 0xBD        # - key
  DOTT      = 0xBE        # . Key

  API = Win32API.new('user32', 'GetAsyncKeyState', 'I', 'I')

  # 以按键码为键,连续按下的帧数为值的 hash
  @states = Hash.new { |h, k| h[k] = 0 }

  def self.update
    @states.each_key do |key|
      @states[key] = press?(key) ? @states[key] + 1 : 0
    end
  end

  def self.clear
    @states.clear
  end

  def self.press?(key)
    API.call(key) < 0
  end

  def self.trigger?(key)
    @states[key] == 1
  end

  def self.repeat?(key)
    times = @states[key]
    times == 1 || times > 23 && times % 6 == 0
  end
end

Scene_Base.send :def_before, :post_start, Keyboard.method(:clear)
Input.singleton_def_after :update, Keyboard.method(:update)
物品禁用
# @taroxd metadata 1.0
# @id item_usable
# @display 物品禁用
# @require taroxd_core
# @help 
#    <unusable x> 或 <usable -x> :当 x 号开关开启时,技能/道具禁止使用
#    <usable x> 或 <unusable -x> :当 x 号开关关闭时,技能/道具禁止使用

Taroxd::ItemUsable = true

class RPG::UsableItem < RPG::BaseItem
  # 获取开关 ID 构成的数组
  def unusable_switches
    @unusable_switches ||=
    @note.scan(/<(UN)?USABLE\s+(-*\d+)>/i).map { |(un, id)|
      un ? id.to_i : -id.to_i
    }.uniq
  end
end

class Game_BattlerBase
  id_ok = -> id { (id > 0) ^ $game_switches[id.abs] }
  ok = -> item { item.unusable_switches.all?(&id_ok) }
  def_and :usable_item_conditions_met?, ok
end