赞 | 3 |
VIP | 0 |
好人卡 | 39 |
积分 | 1 |
经验 | 101436 |
最后登录 | 2017-9-1 |
在线时间 | 2276 小时 |
Lv1.梦旅人 路人党员
- 梦石
- 0
- 星屑
- 52
- 在线时间
- 2276 小时
- 注册时间
- 2010-12-30
- 帖子
- 3225
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 英顺的马甲 于 2011-2-21 15:32 编辑
其实就是改进作弊码脚本
解决设置公共事件必须依照顺序的问题
作弊码设置方法:Cheat[公共事件编号] = 作弊码字符串,不分大小写,支持空格,不支持标点符号,支持数字但不支持小键盘。- module Key
- Cheat = {}
- # 以下设置作弊码
- Cheat[1] = "hello"
- Cheat[10] = "it is a good day to die"
- # 以上设置作弊码
- @key_code = {
- # =============================
- "BACK"=> 0x08,
- "TAB"=> 0x09,
- "SHIFT"=> 0x10,
- "ALT"=> 0x12,
- "CAP"=> 0x14,
- "ESC"=> 0x1B,
- "SPACE"=> 0x20,
- " "=> 0x20,
- "LEFT"=> 0x25,
- "UP"=> 0x26,
- "RIGHT"=> 0x27,
- "DOWN"=> 0x28,
- "ENTER" => 13,
- "LCTRL" => 0xA2,
- "RCTRL" => 0xA3,
- "LALT" => 0xA4,
- "RALT" => 0xA5,
- "SPACE" => 0x20,
- # =============================
- "A" => 0x41,
- "B" => 0x42,
- "C" => 0x43,
- "D" => 0x44,
- "E" => 0x45,
- "F" => 0x46,
- "G" => 0x47,
- "H" => 0x48,
- "I" => 0x49,
- "J" => 0x4A,
- "K" => 0x4B,
- "L" => 0x4C,
- "M" => 0x4D,
- "N" => 0x4E,
- "O" => 0x4F,
- "P" => 0x50,
- "Q" => 0x51,
- "R" => 0x52,
- "S" => 0x53,
- "T" => 0x54,
- "U" => 0x55,
- "V" => 0x56,
- "W" => 0x57,
- "X" => 0x58,
- "Y" => 0x59,
- "Z" => 0x5A,
- # =============================
- "F1" => 0x70,
- "F2" => 0x71,
- "F3" => 0x72,
- "F4" => 0x73,
- "F5" => 0x74,
- "F6" => 0x75,
- "F7" => 0x76,
- "F8" => 0x77,
- "F9" => 0x78,
- "F10" => 0x79,
- "F11" => 0x7A,
- "F12" => 0x7B,
- # =============================
- "0" => 0x30,
- "1" => 0x31,
- "2" => 0x32,
- "3" => 0x33,
- "4" => 0x34,
- "5" => 0x35,
- "6" => 0x36,
- "7" => 0x37,
- "8" => 0x38,
- "9" => 0x39
- # =============================
- }
- module_function
- @R_Key_Hash = {}
- @trigger = {}
- @R_Key_Repeat = {}
- GetKeyState = Win32API.new("user32","GetAsyncKeyState",['I'],'I')
- def update
- @key_code.each_value do |i|
- result = GetKeyState.call(i)
- if @R_Key_Hash[i] == 1 and result != 0
- @trigger[i] = false
- next
- end
- if result != 0
- @R_Key_Hash[i] = 1
- @trigger[i] = true
- next
- else
- @R_Key_Hash[i] = 0
- @trigger[i] = false
- next
- end
- end
- end
- def press?(rkey)
- return GetKeyState.call(rkey) != 0
- end
- def repeat?(rkey)
- result = GetKeyState.call(rkey)
- if result != 0
- if @R_Key_Repeat[rkey].nil?
- @R_Key_Repeat[rkey] = 0
- return true
- end
- @R_Key_Repeat[rkey] += 1
- else
- @R_Key_Repeat[rkey] = nil
- @R_Key_Hash[rkey] = 0
- end
- if !@R_Key_Repeat[rkey].nil? and @R_Key_Repeat[rkey] > 10 # 6和10乃精确 repeat
- @R_Key_Repeat[rkey] = 6
- return true
- else
- return false
- end
- end
- def trigger?(rkey)
- return @trigger[rkey]
- end
- def [](key)
- return @key_code[key]
- end
- end
- module Graphics
- @self_update = method('update') if @self_update.nil?
- module_function
- def update
- @self_update.call
- Key.update
- end
- end
- class Scene_Map
- alias old update
- def update
- @mj=Key::Cheat
- for i in 0...999
- if @mj[i] != nil
- array = @mj[i].upcase.scan(/./)
- @mj[i]=[nil]
- for n in 0...array.size
- @mj[i].push(Key[array[n]])
- end
- end
- end
- n = 0
- for i in 1..190
- n = i if Key.trigger?(i)
- end
- if n > 0
- if @open
- @open = false
- for @k in @z
- @open = true if n == @mj[@k][@j[@k]]
- end
- for @k in @z
- if n == @mj[@k][@j[@k]]
- @j[@k]+=1
- if @j[@k]==@mj[@k].size
- $game_temp.common_event_id = @k
- @j[@k] = 0
- end
- else
- @j[@k] = 0
- end
- end
- end
- end
- if @open != true
- @z = []
- @j = []
- for i in 0...999
- if @mj.has_key?(i)
- if n == @mj[i][1]
- @z.push(i)
- @j[i] = 2
- @open = true
- end
- end
- end
- end
- old
- end
- end
复制代码 |
|