按键精灵软件制作DNF刷图脚本
作为脚本爱好者,菜鸟级的我练手写了个DNF自动刷图脚本,用的是大漠插件。
操作方法
- 01
大概思路如下: PutAttachment "C:\test_game", "*.*" Call Plugin.RegDll.Reg("C:\test_game\dm.dll") set dm = createobject("dm.dmsoft") dm_ret = dm.SetPath("c:\test_game") set ws=createobject("Wscript.Shell") ws.run "regsvr32 c:\test_game\dm.dll /s"//注册大漠到系统 ver = dm.Ver() If len(ver) = 0 Then MessageBox "创建对象失败,检查系统是否禁用了vbs脚本权限" EndScript End If
- 02
hwnd = dm.GetForegroundWindow() dm.MoveWindow hwnd, 0 , 0 dm.SetDict 1, "DNF字库.txt" Dim 第一次 第一次 = 0 Delay 500 dm_ret = dm.BindWindow(hwnd,"normal","normal","normal",0) Delay 200 If dm_ret=0 Then MessageBox "绑定“失败”" ExitScript End If
- 03
UserVar 行数=1 "你的仓库在第几行" UserVar 名字="仓库" "你仓库的名字" x = 420 y=124+(行数-1)*37 xx = 500 yy=124+行数*37 info = dm.FetchWord(x,y,xx,yy,"ddc593",名字) If len(info) > 0 Then dm.SetPath "c:\test_game" dm.AddDict 0, info dm.SaveDict 0, "test.txt" Else MsgBox "不符合条件" End If
- 04
dm.keypress 27 Delay 300 dm.keypress 66 Delay 300 dm.moveto 595, 91 dm.leftdown Delay 50 dm.leftup Delay 50 Do dm_ret = dm.FindStr(411,122,507,494,名字,"ddc593",1.0,intX,intY) If intX >= 0 and intY >= 0 Then dm.MoveTo intX, intY dm.LeftClick Delay 200 dm.MoveTo intX + 5, intY + 30 dm.LeftClick Delay 100 For 5 dm.keypress 8 Delay 100 Next dm.keypress 49 Delay 100 dm.keypress 13 Delay 100 dm.keypress 13 Delay 100 Exit do Else dm.keypress 113 Delay 10 End If Loop