frozen 发表于 2008-8-31 13:23:46

请帮忙看看下面代码为什么在游戏过程中按热键无效呢?

在游戏过程中按热键可以发送秘籍代码,可是却无法打开秘籍,这是怎么回事呢?
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
If Not FileExists(@ScriptDir & "\Roadrash.exe") Then
MsgBox(8256, "", '在当前目录下不存在文件"Roadrash.exe",' & @CRLF & "请确认本程序在暴力摩托根目录下并且存在" & @CRLF & '文件"Roadrash.exe"。')
Exit
ElseIf RegRead("HKLM\SOFTWARE\Electronic Arts\RoadRash 95", "Controls") = "" Then
RegWrite("HKLM\SOFTWARE\Electronic Arts\RoadRash\1.0")
RegWrite("HKLM\SOFTWARE\Electronic Arts\RoadRash 95", "Controls", "REG_BINARY", ".w.s.a.u.h.j.k.l. .d.i")
EndIf
#Region ### START Koda GUI section ###
$Form1 = GUICreate("暴力摩托作弊器 - By Frozen", 210, 155, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetFont(10, 400, 0, "宋体")
$Button1 = GUICtrlCreateButton("运行游戏", 4, 128, 65, 25, $BS_DEFPUSHBUTTON)
$Button2 = GUICtrlCreateButton("使用说明", 73, 128, 65, 25, 0)
$Button3 = GUICtrlCreateButton("退出程序", 142, 128, 65, 25, 0)
$Edit1 = GUICtrlCreateEdit("", 2, 2, 210, 106, $ES_READONLY, 0)
GUICtrlSetData(-1, StringFormat(" 秘籍 热键 说明\r\n XYZZY 1 开启作弊\r\n K" & Chr(39) & "THUNK! 2 得到木棒\r\n THWACK! 3 得到铁鞭\r\n SPOON! 4 得到加速功能\r\n YES,OCCIFER 5 杀掉警察\r\n BRIBE 6 减少路上警察\r\n PLUGH 7 取消作弊"))
GUICtrlSetColor(-1, 0x808000)
GUICtrlSetTip(-1, "注意:必须在比赛过程中才可以使用")
$Checkbox1 = GUICtrlCreateCheckbox("游戏结束后自动退出", 4, 110, 135, 15)
GUICtrlSetState(-1, $GUI_CHECKED)
GUISetState(@SW_SHOW)
Opt("TrayMenuMode", 1)
$Display = TrayCreateItem("隐藏")
$Quit = TrayCreateItem("退出")
TraySetClick(1)
Opt("TrayIconDebug", 1)
#EndRegion ### END Koda GUI section ###
HotKeySet("{1}", "Open_Cheat")
HotKeySet("{2}", "Get_Crabstick")
HotKeySet("{3}", "Get_Whip")
HotKeySet("{4}", "Accelerate")
HotKeySet("{5}", "Kill_Police")
HotKeySet("{6}", "Bribe_Police")
HotKeySet("{7}", "Close_Cheat")
HotKeySet("{8}", "AutoRun")
While 1
$nMsg = GUIGetMsg(1)
$Tmsg = TrayGetMsg()
Select
;托盘菜单
Case $Tmsg = $Display
If TrayItemGetText($Display) = "显示" Then
GUISetState(@SW_SHOWNORMAL, $Form1)
TrayItemSetText($Display, "隐藏")
ElseIf TrayItemGetText($Display) = "隐藏" Then
GUISetState(@SW_HIDE, $Form1)
TrayItemSetText($Display, "显示")
EndIf
Case $Tmsg = $Quit Or $nMsg = $Button3
Exit
Case $nMsg = $Button1
If ProcessExists("Roadrash.exe") Then
WinActivate("Road Rash")
If GUICtrlRead($Checkbox1) = $GUI_CHECKED And Not WinExists("Road Rash") Then
Exit
EndIf
Else
Run(@ScriptDir & "\Roadrash.exe")
WinWait("Road Rash")
If GUICtrlRead($Checkbox1) = $GUI_CHECKED And Not WinExists("Road Rash") Then
Exit
EndIf
EndIf
Case $nMsg = $Button2
MsgBox(8256, "使用说明!", "在游戏比赛过程中先按“1”键开启作弊," & @CRLF & "此时你的名称(玩家名称)会变为黄色,这" & @CRLF & "表示已开启了秘籍的输入功能,然后再输" & @CRLF & "入你需要的功能所对应的热键即可。如果" & @CRLF & "你不想再使用秘籍,只需要按下“ 7”键" & @CRLF & "即可取消秘籍。")
EndSelect
WEnd
Func Open_Cheat()
Send("xyzzy")
EndFunc ;==>Open_Cheat
Func Get_Crabstick()
Send("k'thunk+1")
EndFunc ;==>Get_Crabstick
Func Get_Whip()
Send("thwack+1")
EndFunc ;==>Get_Whip
Func Accelerate()
Send("spoon+1")
EndFunc ;==>Accelerate
Func Kill_Police()
Send("yes,occifer")
EndFunc ;==>Kill_Police
Func Bribe_Police()
Send("bribe")
EndFunc ;==>Bribe_Police
Func Close_Cheat()
Send("plugh")
EndFunc ;==>Close_Cheat
Func AutoRun()
Send("{w Down}")
EndFunc ;==>AutoRun
页: [1]
查看完整版本: 请帮忙看看下面代码为什么在游戏过程中按热键无效呢?