传奇SF挂机脚本

好像现在外挂都过不了登陆器,包括找罗楠拿的收费挂也不行,只好自己写一个挂机脚本。

说明

按键精灵+大漠插件制作,职业:战士、道士,挂机位置尸魔洞一层,打开小地图为全图,分辨率为800×600。自动打怪、自动捡取、自动买药、自动修装备。测试6个小时正常挂机,初学写出来的感觉应该还能优化。不过写出来后也没兴致再玩游戏了。。。毕竟还要吃饭呢。

脚本

//PutAttachment "c:\test_game","*.*"
//PutAttachment ".\Plugin", "RegDll.dll"
//call Plugin.Regdll.reg("c:\test_game\dm.dll")
//注册大漠

//设置大漠路径以及字库名
Set dm = createobject("dm.dmsoft")
dm.SetPath ("d:")
dm_ret = dm.SetDict(0,"lanhuo.txt")

//绑定窗口和模式
hwnd = dm.GetMousePointWindow()
dm_ret = dm.BindWindow(hwnd, "dx2", "windows", "windows", 0)

//初始化跑图路径,和人物点
Dim nn,myx, myy
myx = 390
myy = 230
nn=1

Rem 打怪
dm_ret = dm.FindStr(230,58,575,331, "宝箱", "ffffff-000000", 1.0, intX, intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "打宝箱"&intX&":"&intY
 dm.MoveTo intX + 1, intY + 32
 Delay 20
 dm.LeftClick 
 Delay 2000
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
End If
dm_ret = dm.FindMultiColor(321, 124, 462, 213, "ff0000", "0|1|9c0000,0|2|100808,0|3|-111111,0|3|-100808,0|6|-101010", 1.0, 0, intX, intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "打恶灵"&intX&":"&intY
 dm.MoveTo intX + 15, intY + 45
 dm.LeftClick 
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
 Goto 打怪
End If

Rem 捡东西
//判断身边是否有怪,有怪就先打怪,没怪就捡东西
dm_ret = dm.FindMultiColor(321,124,462,213,"ff0000","0|1|9c0000,0|2|100808,0|3|-111111,0|3|-100808",1.0,0,intX,intY)
If dm_ret = 1 Then 
 Goto 打怪
End If

//捡神开头的物品
dm_ret = dm.FindStrFast(0, 0, 800, 438, "神", "ff0000-000000|ffffff-000000|88ddee-000000", 1.0, intX, intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "捡神"&intX&":"&intY
  intX = intX + 25
  intY = intY + 13
 If intX < myx and intY < myy Then 
 Call 走左上角()
 ElseIf intX < myx and intY > myy Then 
 Call 走左下角()
 ElseIf intX > myx and intY < myy Then
 Call 走右上角()
 ElseIf intX > myx and intY > myy Then 
 Call 走右下角()
 ElseIf intX = myx and intY > myy Then
 Call 走下()
 ElseIf intX = myx and intY < myy Then
 Call 走上()
 ElseIf intX > myx and intY = myy Then
 Call 走右()
 ElseIf intX < myx and intY = myy Then
 Call 走左()
 End If
 Delay 1000
 Goto 捡东西
End If

//捡金或强开头的物品
dm_ret = dm.FindStrFast(0, 0, 800, 438, "金|强", "ff0000-000000|ffffff-000000|88ddee-000000", 1.0, intX, intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "捡金或强"&intX&":"&intY
  intX = intX + 13
  intY = intY + 18
 If intX < myx and intY < myy Then 
 Call 走左上角()
 ElseIf intX < myx and intY > myy Then 
 Call 走左下角()
 ElseIf intX > myx and intY < myy Then
 Call 走右上角()
 ElseIf intX > myx and intY > myy Then 
 Call 走右下角()
 ElseIf intX = myx and intY > myy Then
 Call 走下()
 ElseIf intX = myx and intY < myy Then
 Call 走上()
 ElseIf intX > myx and intY = myy Then
 Call 走右()
 ElseIf intX < myx and intY = myy Then
 Call 走左()
 End If
 Delay 1000
 Goto 捡东西
End If

Rem 买东西
Delay 500
hong = dm.Ocr(304, 425, 318, 440, "ffffff-000000", 1.0)
lan = dm.Ocr(346, 423, 366, 439, "ffffff-000000", 1.0)
TracePrint "红:" & hong
TracePrint "蓝:" & lan
If hong = 0 Then
 TracePrint "买红药"
 dm.MoveTo 766,566
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 166, 22
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 574, 83
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 50, 205
 Delay 2000
 dm.LeftClick 
 dm.KeyPress 48
 dm.MoveTo 88, 266
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 344, 318
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 692, 400 //打开背包
 Delay 2000
 dm.LeftClick 
 Delay 2000
 //解开红药
 dm_ret = dm.FindMultiColor(0, 0, 800, 600, "7b3118", "1|0|6b3118,2|0|6b3118,3|0|7b3118,4|0|942918", 1.0, 0, intX, intY)
 If intX >= 0 and intY >= 0 Then 
 dm.MoveTo intX, intY
 Delay 2000
 dm.RightClick 
 Delay 2000
 End If
 //使用修复水
 dm_ret = dm.FindMultiColor(0, 0, 800, 600, "d6c6ad", "1|0|bda57b,2|0|efc68c,3|0|f7f7de,4|0|b5a594", 1.0, 0, intX, intY)
 If intX >= 0 and intY >= 0 Then 
 dm.MoveTo intX, intY
 Delay 2000
 dm.RightClick 
 Delay 2000
 End If
 dm.KeyPress 120
 Delay 2000
 dm.KeyPress 27
 Delay 2000
End If

If lan = 0 Then
 TracePrint "买蓝药"
 dm.MoveTo 766,566
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 166, 22
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 574, 147
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 50, 205
 Delay 2000
 dm.LeftClick 
 dm.KeyPress 48
 dm.MoveTo 88, 266
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 344, 318
 Delay 2000
 dm.LeftClick 
 dm.MoveTo 692, 400 //打开背包
 Delay 2000
 dm.LeftClick 
 Delay 2000
 //解开蓝药
 dm_ret = dm.FindMultiColor(0, 0, 800, 600, "104284", "1|0|291884,2|0|291884,3|0|215aa5,4|0|738cff", 1.0, 0, intX, intY)
 If intX >= 0 and intY >= 0 Then 
 dm.MoveTo intX, intY
 Delay 2000
 dm.RightClick 
 Delay 2000
 End If
 //使用修复水
 dm_ret = dm.FindMultiColor(0, 0, 800, 600, "d6c6ad", "1|0|bda57b,2|0|efc68c,3|0|f7f7de,4|0|b5a594", 1.0, 0, intX, intY)
 If intX >= 0 and intY >= 0 Then 
 dm.MoveTo intX, intY
 Delay 2000
 dm.RightClick 
 Delay 2000
 End If
 dm.KeyPress 120
 Delay 2000
 dm.KeyPress 27
End If

Rem 找怪
dm_ret = dm.FindStr(80,39,744,355,"恶|灵","ffffff-000000",1.0,intX,intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "屏幕范围找恶灵:"&intX&":"&intY
 dm.MoveTo intX+25, intY+5
 dm.LeftClick 
 dm.MoveToEx 100, 100, 100, 100
 Delay 200
 dm.MoveToEx 100, 100, 100, 100
 Delay 200
 dm.MoveToEx 100, 100, 100, 100
 Goto 打怪
End If

dm_ret = dm.FindStr(80,39,744,355, "宝|箱", "ffffff-000000", 1.0, intX, intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "屏幕范围找宝箱:"&intX&":"&intY
 dm.MoveTo intX+4, intY+51
 dm.LeftClick
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
 Delay 200
 dm.MoveToEx 390, 230, 100, 100
 Goto 打怪
End If

dm_ret = dm.FindMultiColor(672,0,800,128,"ff0000","0|1|ff0000,0|2|ff0000,0|3|ff0000,1|1|ff0000",1.0,0,intX,intY)
If intX >= 0 and intY >= 0 Then
 TracePrint "小地图找怪:"&intX&":"&intY
 i=1
 For 5
 dm.MoveTo intX + i, intY + i
 dm.RightClick 
 i = i + 1
 Delay 100
 Next
 Goto 打怪
End If

Rem 寻路
zuobiao = dm.Ocr(68,583,129,599, "ffffff-000000", 1.0)
zuobiaox = mid(zuobiao,1,instr(zuobiao, ":")-1)
zuobiaoy = mid(zuobiao,instr(zuobiao, ":")+1,3)
TracePrint "跑图中,当前坐标:" & zuobiaox & ":" & zuobiaoy
If 170 > zuobiaox > 164 and 128 > zuobiaoy > 120 Then 
 nn=2
ElseIf  165 > zuobiaox > 150 and 30 > zuobiaoy > 20 Then
 nn = 3
ElseIf 28 > zuobiaox > 18 and 80 > zuobiaoy > 70 Then
 nn = 4
ElseIf 65 > zuobiaox > 55 and 180 > zuobiaoy > 170 Then
 nn = 1
End If
Select case nn
Case 1
 Delay 200
 dm.MoveTo 770, 100
 Delay 200
 dm.RightClick 
 Goto 打怪
Case 2
 Delay 200
 dm.MoveTo 760, 20
 Delay 200
 dm.RightClick 
 Goto 打怪
Case 3
 Delay 200
 dm.MoveTo 630, 60
 Delay 200
 dm.RightClick 
 Goto 打怪
Case 4
 Delay 200
 dm.MoveTo 666, 140
 Delay 200
 dm.RightClick 
 Goto 打怪
End Select

//随机走路的子程序,打算用于多线程判断是不是卡住了,后来发现用不到。
Sub 随机走()
Randomize
TmpRnd = Int(rnd * 8 + 1)
TracePrint "随机走路:" & TmpRnd
Select Case TmpRnd
 Case 1
 Call 走左()
 Case 2
 Call 走右()
 Case 3
 Call 走上()
 Case 4
 Call 走下()
 Case 5
 Call 走左上角()
 Case 6
 Call 走右上角()
 Case 7
 Call 走左下角()
 Case 8
 Call 走右下角()
End Select
End Sub
Sub 走左()
 dm.MoveTo myx - 90, myy
 dm.LeftClick
End Sub
Sub 走右()
 dm.MoveTo myx + 90, myy
 dm.LeftClick 
End Sub
Sub 走上()
 dm.MoveTo myx, myy - 90
 dm.LeftClick 
End Sub
Sub 走下()
 dm.MoveTo myx, myy + 90
 dm.LeftClick 
End Sub
Sub 走左上角()
 dm.MoveTo myx - 90, myy - 90
 dm.LeftClick
End Sub
Sub 走右上角()
 dm.MoveTo myx + 90, myy - 90
 dm.LeftClick
End Sub
Sub 走左下角()
 dm.MoveTo myx - 90, myy + 90
 dm.LeftClick
End Sub
Sub 走右下角()
 dm.MoveTo myx + 90, myy + 90
 dm.LeftClick
End Sub
Sub OnScriptExit()
    dm_ret = dm.UnBindWindow() 
End Sub

大漠插件

大漠插件(免费版)
提取码:s4mi

字库

211441BF9A00207F8927FF248490FF0$神$0.0.56$12
04349A50426FC30A7F2C219474A0130$恶$0.0.48$11
003126A9542A895E2A2542A95F44008$灵$0.0.45$11
30049092124A48CFC9212624A490C00$宝$0.0.50$12
2498A17FB284485FF2AA556AA9553F8$箱$0.0.64$12
6310A224488610$2$0.0.16$8
411FE0040$1$0.0.11$8
8011E2C0600$7$0.0.11$8
421022444886E0$3$0.0.15$8
7E1022044087E0$0$0.0.18$8
0C0281947F8050$4$0.0.18$8
721122244907C0$9$0.0.18$8
6E1222444886E0$8$0.0.19$8
3E0922444884E0$6$0.0.18$8
FA1222444888E0$5$0.0.19$8
840$:$0.0.2$6
080120451494911FD24149114120200$金$0.0.45$12
7E1222446880E0$6$0.0.19$8
F21222444888E0$5$0.0.18$8
080681107F8050$4$0.0.16$8
C010027C700800$7$0.0.13$8
701162244487E0$9$0.0.19$8
4F0921E7800079E92524FF949E941E0$强$0.0.63$12

你可能感兴趣的:(传奇SF挂机脚本)