Project1
标题: 求作弊码脚本= = [打印本页]
作者: 魔之哆啦 时间: 2011-6-15 18:16
标题: 求作弊码脚本= =
本帖最后由 fux2 于 2011-6-16 07:08 编辑
- 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
复制代码 这个是我唯一见到的脚本。希望大家能在此改一改。能够用。或者给我一些其它的。。