这款游戏虽然是点击任务自动寻路,但是中途也会碰到许多其他内容。比如触发打怪,剧情等等。我的逻辑思路是找到字后如何如何。触发新的场景就设置抓个图,或字在如何如何。然后让按键无限循环。但是到11级以后触发的新场景越来越多。代码越写越多。造成了很不效率。比方说循环找 “第”字。这是任务核心字,只要有这个字就2秒点一下,游戏就会自动寻路。但是随着命令越来越多现在要10多秒才点一下“字”在继续的话就会无限增长了。感觉很不对。而且总出错。最近学了下大漠。学的也迷迷糊糊的。我填一段代码。希望有高手指点一二。有分
//建立大漠对象
Set dm = createobject("dm.dmsoft")
//工具文件夹(图片等)
dm.setPath "c:\nsh"
//字库
dm.SetDict 0, "nsh.txt"
Delay 100
//任务识别
dm_ret = dm.FindPic(1325,504,1533,621,"111.bmp","fbb617",0.9,0,intX,intY)
If intX > 0 And intY > 0 Then
Delay 100
MoveTo 1406, 559
Delay 100
LeftClick 1
Delay 100
End If
//剧情点击加速翻页
Delay 100
dm_ret = Lib.大漠命令.大漠简易找图("222.bmp")
If dm_ret > - 1 Then
MoveTo 1252, 832
Delay 100
LeftClick 1
Delay 100
LeftClick 2
Delay 100
End If
//第一任务怪
dm_ret = Lib.大漠命令.大漠简易找图("333.bmp")
If dm_ret > - 1 Then
KeyPress "1", 1
Delay 3000
KeyPress "2", 1
Delay 3000
KeyPress "F1", 1
Delay 3000
KeyPress "1", 1
Delay 3000
KeyPress "2", 1
Delay 3000
KeyPress "F1", 1
Delay 100
For 59
Delay 100
KeyPress "1", 1
Delay 500
KeyPress "1", 1
Delay 500
KeyPress "1", 1
Delay 500
KeyPress "2", 1
Delay 500
Next
Delay 6000
End If
Delay 100
dm_ret = Lib.大漠命令.大漠简易找图("F.bmp")
If dm_ret > - 1 Then
Delay 100
KeyPress "F", 1
Delay 3000
End If
Delay 100
dm_ret = Lib.大漠命令.大漠循环找图增强版(1006,559,1107,635,"1.0.bmp|2.0.bmp|3.0.bmp",30)
Delay 100
If dm_ret > - 1 Then
Delay 100
Call Lib.大漠命令.大漠移动并左键单击坐标(ImgX, ImgY)
Delay 100
End If
Delay 100