Project1
标题:
能否将快捷键整合到一个脚本上?在线等
[打印本页]
作者:
a107480098
时间:
2015-6-18 14:44
标题:
能否将快捷键整合到一个脚本上?在线等
能否将脚本编辑器里所有快捷键的操作整合到一个脚本上?如果可以,怎么样来整合?写个范例脚本,谢谢!比如下面3个快捷键操作,分别来自3个不同的脚本:
[pre lang="ruby"]# alt + E 物品菜单
if Kboard.keyb($R_Key_ALT) == 1 and Kboard.keyb($R_Key_E) == 1 and $anzhu == nil
$scene = Scene_Item.new
end
# alt + R宠物菜单
if Kboard.keyb($R_Key_ALT) == 1 and Kboard.keyb($R_Key_R) == 1 and $anzhu == nil
$scene = Scene_Baby.new
end
# alt + A装备菜单
if Kboard.keyb($R_Key_ALT) == 1 and Kboard.keyb($R_Key_A) == 1 and $anzhu == nil
$scene = Scene_Equip.new
end[/pre]
作者:
kuerlulu
时间:
2015-6-18 15:39
黑Input的写法:
$a107480098_counter = {:物品 => 0, :宠物 => 0, :装备 => 0}
class << Input
alias a107480098_update update
def update
a107480098_update
update_counter(:物品, $R_Key_ALT, $R_Key_E, Scene_Item)
update_counter(:宠物, $R_Key_ALT, $R_Key_R, Scene_Baby)
update_counter(:装备, $R_Key_ALT, $R_Key_A, Scene_Equip)
end
def update_counter(sym, key1, key2, scene)
if Kboard.keyb(key1) == 1 and Kboard.keyb(key2) == 1
$a107480098_counter[sym] += 1
else
$a107480098_counter[sym] = 0
end
$scene = scene.new if $a107480098_counter[sym] == 1
end
end
复制代码
欢迎光临 Project1 (https://rpg.blue/)
Powered by Discuz! X5.0