#IfWinActive ahk_exe BNSR.exe ;只在剑灵窗口开启/暂停/继续AHK
;PNG截图示例在另外个专栏文章里面
;这个是只交接任务的、没写攻击,默认界面,窗口模式1920x1080(四行绿字注意看)
F1::
MouseGetPos, mouseX, mouseY
PixelGetColor, color, %mouseX%, %mouseY%, RGB
clipboard = (%mouseX%,%mouseY%)=="%color%" ;用F1取色,并复制到剪贴板
return
]::
loop
{
gosub L
sleep 10000 ;此处改为一段攻击,比如Gosub LabelQS,就是一拖二挂蜘蛛了(一个号打,两
;个号站着只交接任务,正常人只能3开,能6开的话就不用ALT+TAB切换,用ALT+ESC)
;LabelQS标签参考另外个文档,需要改坐标,那文档对应的不是默认界面
}
return
L:
;提交任务,循环3次执行3个窗口的任务
loop 3
{
ImageSearch, FoundX, FoundY, 1633,389,1704,913,*60, D:\tt\djzxrw1.png ;搜索任务完成图标1,搜索区域看着办
if (ErrorLevel=0)
{
Target(FoundX,FoundY)
sleep 500
}
else
{
ImageSearch, Foundx1, FoundY1, 1633,389,1704,913,*30, D:\tt\djzxrw2.png ;搜索任务完成图标2,搜索区域看着办
if (ErrorLevel=0)
Target(Foundx1,FoundY1)
sleep 500
}
if (GetColor(1877,73)=="0x219BD4" OR GetColor(1843,74)=="0x229ED7" OR GetColor(1831,73)=="0x229FD9"
OR GetColor(1831,73)=="0x229FD9")
yongmeng()
send {alt down}
sleep 200
send {tab}
sleep 100
send {tab}
sleep 100
send {alt up}
sleep 200
}
return
GetColor(x,y)
{
PixelGetColor, color, x, y, RGB
StringRight color,color,10 ;
return color
}
Return
Target(x,y) ;提交任务,其实多个场所都可以用此函数提交任务
{
k:=0
x:=x+20
y:=y+3
send {alt down}
sleep 300
click %x%,%y% 2
sleep 100
send {alt up}
sleep 100
ImageSearch, FoundX, FoundY, 485,237,1332,814,*170, D:\tt\djzxrwff.png ;这个图片不同场所颜色深度变化大*170
if (ErrorLevel=0)
{
c:=0
while (c<9)
{
ImageSearch, FoundXt, FoundYt, 1623,916,1681,943,*90, D:\tt\qr.png
if (ErrorLevel=0)
{
ImageSearch, FoundXu, FoundYu, 1578,785,1675,824,*90, D:\tt\ym2.png
if (ErrorLevel=0)
k:=1 ;提交的是勇猛任务,则改变k的值
click 1669,926
sleep 300
break ;此IF条件是出现确认按钮,出现就跳出循环,否则执行下面的ELSE
}
else
{
send f
sleep 100
c++
}
}
if (k=1)
yongmeng()
else
{
ImageSearch, FoundX, FoundY, 1583,689,1669,734,*100, D:\tt\jhzg.png ;净化之光30道具任务
if (ErrorLevel=0)
{
click 1727,859
sleep 100
send f
}
else
{
click 1696,859 ;若有道具需要选择则点击此处,但没有道具选择时左键也会点击一次
sleep 100
send f
}
}
}
}
return
yongmeng()
{
ImageSearch, FoundX, FoundY,21,35,1386,476,*100, D:\tt\rwrz.png ;搜任务日志,若J窗口存在则按下ESC
if (ErrorLevel = 0)
{
send {esc}
sleep 100
}
x1:=0
y1:=0
x2:=0
y2:=0
y2_f:=0
send j ;按J键弹出任务窗口并出现鼠标指针
sleep 600
ImageSearch, FoundX, FoundY,21,35,1386,476,*100, D:\tt\rwrz.png ;搜任务日志①
if (ErrorLevel = 0)
{
x1:=FoundX+78
y1:=FoundY+41
x2:=FoundX+184
y2:=FoundY+80
y2_f:=y2+530
}
;(x1,y1)是入手书信4个字位置,(x2,y2)和(x2,y2_f)是滑条滑行始终
;改用变量后增加了搜素任务①,但不用在意任务日志窗口位置
else
return
click %x1%,%y1%
sleep 300
a:=x1-117
b:=y1+23
c:=x1-50
d:=y1+555
ImageSearch, FoundX, FoundY, %a%,%b%,%c%,%d%,*60, D:\tt\ym.png
;(a,b,c,d)是书信栏目对应“入手书信”位置的区域
if (ErrorLevel = 0)
{
mousemove FoundX+175,FoundY+8
click
sleep 100
}
else
{
SendEvent {Click %x2% %y2% Down}{Click %x2% %y2_f% Up}
sleep 300
xm:=x1+78
ym:=y1+530
click %xm%,%ym% ;(xm,ym)是入手书信勇猛按钮对应入手书信4个字的位置
sleep 100
}
c:=0
while (c<9)
{
if (GetColor(1652,934)=="0xECECED" AND GetColor(1673,930)=="0xEAEAEA" AND GetColor(1775,930)=="0xDEDFDF")
{
click 1673,929
sleep 100
break ;此IF条件是出现确认按钮,出现就跳出循环,否则执行下面的ELSE
}
else
{
click 1432,1013
sleep 100
c++
}
}
;以下按次j并按一次空格跳一下退出j窗口
sleep 200
send j
sleep 100
send {space down}
sleep 50
send {space up}
sleep 100
}
return
0::
reload
return