按键精灵的脚本转成AU3应该怎么写?
本帖最后由 diandiand163 于 2009-11-5 14:00 编辑Plugin hwnd=Window.Foreground()
//得到当前窗口句柄
Plugin Window.Move(hwnd,0,0)
//把窗口移动到坐标 0,0
Plugin hwnd = Window.GetKeyFocusWnd()
Plugin hwnd=Window.MousePoint()
//捕捉当前窗口切换到后台
Rem 加血
IfColor 114,61,0011ff,2 //如果当前坐标颜色为0011ff,则跳转到子程序打怪
Gosub 打怪
Else
Plugin Bkgnd.KeyPress(hwnd,119) 否则后台按键F8,加血
EndIf
//Rem 加蓝
IfColor 114,68,cc0000,2 //如果当前坐标颜色为cc0000,则跳转到子程序打怪
Gosub 打怪
Else
Plugin Bkgnd.KeyPress(hwnd,120) //否则后台按键F9,加蓝
EndIf
//Rem 加宠
IfColor 120,100,0011ff,2
Gosub 打怪
Else
Plugin Bkgnd.KeyPress(hwnd,118)
EndIf
Goto 加血
//打怪子程序如下
Sub 打怪
Plugin Window.SendKeyPress(hwnd,122)
Delay 50 //CPU延迟
Plugin Window.SendKeyPress(hwnd,112)
Plugin Window.SendKeyPress(hwnd,113)
Plugin Window.SendKeyPress(hwnd,114)
Plugin Window.SendKeyPress(hwnd,115)
Delay 100
Return 打怪
这是游戏的后台打怪,转成AU3应该怎么写.
望高手赐教! 沙发自己座了,在线等回答.:face (29): 这坛子回贴的人怎么人这少啊,贴别沉下去了啊.还等人回答呢. $xiaozhan = ControlGetHandle ( "设备列表", "", "");获取指定控件的内部句柄. 要有耐心吗,毕竟游戏不是我们的主要涉足领域 #Include <WinAPI.au3>
$hwnd=WinGetHandle("标题")
WinMove("标题","文本",0,0)
WinSetState("标题",@SW_MINIMIZE)
While 1
;加血
If PixelGetColor ( 114,61,$hwnd)=0x0011ffThen
Gosub()
Else
$cv=_WinAPI_PostMessage($hwnd, 0x0100,119,0)
EndIf
;加蓝
If PixelGetColor ( 114,68,$hwnd)=0xcc0000Then
Gosub()
Else
$cv=_WinAPI_PostMessage($hwnd, 0x0100,120,0)
EndIf
;加宠
If PixelGetColor ( 120,100,$hwnd)=0x0011ffThen
Gosub()
Else
$cv=_WinAPI_PostMessage($hwnd, 0x0100,118,0)
EndIf
WEnd
Func Gosub()
$cv=_WinAPI_PostMessage($hwnd, 0x0100,122,0)
Sleep(50)
$cv=_WinAPI_PostMessage($hwnd, 0x0100,112,0)
$cv=_WinAPI_PostMessage($hwnd, 0x0100,113,0)
$cv=_WinAPI_PostMessage($hwnd, 0x0100,114,0)
$cv=_WinAPI_PostMessage($hwnd, 0x0100,115,0)
Sleep(100)
EndFunc
希望对你有帮助:) AU3的PostMessage函数是不是太垃圾了.居然这样也不行.
#Include <WinAPI.au3>
;Sleep(3000)
While 1
$hWnd=WinGetHandle( "游戏名称")
$cv=_WinAPI_PostMessage($hWnd, 0x0100,122, 0)
Sleep (100)
$cv=_WinAPI_PostMessage($hWnd, 0x0100,112, 0)
WEnd
只能运行前面按122的代码.后面112的那句根本不执行.我晕. 终于让我搞定了.呵呵.原来这么简单. AU3的PostMessage函数是不是太垃圾了.居然这样也不行.
#Include
;Sleep(3000)
While 1
$hWnd=WinGetHandle( "游戏名称")
$cv=_WinAPI_PostMessage($hWnd, 0x0100,122, 0)
Sleep (100)
$cv=_WinAPI_PostMessa ...
diandiand163 发表于 2009-11-6 09:44 http://www.autoitx.com/images/common/back.gif
比尔说 PostMessage是我家的 不是你们谁谁家的
页:
[1]