|
本帖最后由 seemifly 于 2017-11-20 11:21 编辑
这里给出一个思路,希望可以帮助到大家。
- [General]
- SyntaxVersion=2
- BeginHotkey=121
- BeginHotkeyMod=0
- PauseHotkey=0
- PauseHotkeyMod=0
- StopHotkey=123
- StopHotkeyMod=0
- RunOnce=1
- EnableWindow=
- MacroID=80b3da3c-1d70-4f0d-9279-c48195503760
- Description=¥ú«Æ ’Ω ø
- Enable=1
- AutoRun=0
- [Repeat]
- Type=0
- Number=1
- [SetupUI]
- Type=2
- QUI=
- [Relative]
- SetupOCXFile=
- [Comment]
- [Script]
- Global hwnd, DelayForEachRound, Weapon1, Weapon2, StartCoorX,StartCoorY,ShopLoc,AmtEachRound,AmtEarn
- hwnd = Plugin.Window.MousePoint()
- Call ¥ÛƒÆ◊¢≤·∞Û∂®
- DelayForEachRound = 50000
- Weapon1 = "biubiu"
- Weapon2 = "great sword"
- StartCoorX = 32
- StartCoorY = 33
- ShopLoc = 2228257
- AmtEachRound = 1850
- AmtEarn = 0
- //////////////////////////Ω≈±æ÷˜ÃÂ//////////////////////////////
- Rem begin
- Call SendCmd("sing Earn " & AmtEarn)
- Delay 500
- Call ChangeWeapon(Weapon1)
- Delay 1000
- Call SendCmd("kill moneyman")
- Delay 1000
- Call ChangeWeapon(Weapon2)
- Delay 40000
- Call MoveAroundAndGetAll(StartCoorX, StartCoorY)
- Delay 1000
- Call SellAll(ShopLoc)
- AmtEarn = AmtEarn + AmtEachRound
- Goto begin
- ///////////////////////////÷˜ÃÂΩ· ˉ/////////////////////////////
- ///////////////////////////∑Ω∑®øè///////////////////////////////
- Sub ¥ÛƒÆ◊¢≤·∞Û∂®
- PutAttachment "C:\kok\anjian\dm","*.*"
- PutAttachment ".\Plugin" ,"RegDll.dll"
- Call Plugin.RegDll.Reg("C:\kok\anjian\dm\dm.dll")
- set dm = createobject("dm.dmsoft")
- dm.SetPath "C:\kok\anjian\dm"
- hwnd = dm.GetMousePointWindow()
- dm_ret = dm.BindWindow(hwnd, "dx", "normal", "dx", 0)
- End Sub
- Function ChangeWeapon(weapon)
- Delay 100
- dm.SendString hwnd, "wield " & weapon
- Delay 500
- dm.KeyPress 13
- Delay 1000
- End Function
- Function SendCmd(cmd)
- Delay 500
- dm.SendString hwnd, cmd
- dm.KeyPress 13
- Delay 500
- End Function
- Function MoveAroundAndGetAll(x, y)
- Dim newX, newY,loc
- // //nw
- // newX = x-1
- // newY = y-1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //n
- newX = x
- newY = y-2
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- Call GetAllNearBy(newX, newY)
-
-
- // //ne
- // newX = x+1
- // newY = y-1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- // //sw
- // newX = x-1
- // newY = y+1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //s
- newX = x
- newY = y+2
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- Call GetAllNearBy(newX, newY)
-
- // //se
- // newX = x+1
- // newY = y+1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //00
- newX = x
- newY = y
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- //Call GetAllNearBy(newX, newY)
- End Function
- Function GetAllNearBy(x, y)
- Dim SW_Y, SW_X,Temp_X,loc
-
- SW_Y = y - 1
- SW_X = x - 1
-
- For 3
- Temp_X = SW_X
- For 3
- loc = CoorToLoc(Temp_X, SW_Y)
- //Call SendCmd("sing x:" & Temp_X & " y:" & SW_Y & " loc:" & loc)
- //Delay 100
- Call SendCmd("get ALL_ITEM_IN "&loc)
- Temp_X = Temp_X + 1
- Delay 100
- Next
- SW_Y = SW_Y + 1
- Next
-
- End Function
- Function SellAll(ShopLoc)
- Call SendCmd("look 1@" & ShopLoc)
- Delay 500
- For 5
- Call SendCmd("sell 1")
- Delay 100
- Next
- End Function
- Function CoorToLoc(x, y)
- CoorToLoc = 65536*x+y
- End Function
- Sub OnScriptExit()
- dm.UnBindWindow
- set dm = nothing
- End Sub
- Sub OnThreadExit()
- dm.UnBindWindow
- set dm = nothing
- End Sub
复制代码
坐标地址码换算,感谢清风大神提供的公式:
- Function CoorToLoc(x, y)
- CoorToLoc = 65536*x+y
- End Function
复制代码
通过传入当前左边,计算周围9格地址码并拾取:
- Function GetAllNearBy(x, y)
- Dim SW_Y, SW_X,Temp_X,loc
-
- SW_Y = y - 1
- SW_X = x - 1
-
- For 3
- Temp_X = SW_X
- For 3
- loc = CoorToLoc(Temp_X, SW_Y)
- //Call SendCmd("sing x:" & Temp_X & " y:" & SW_Y & " loc:" & loc)
- //Delay 100
- Call SendCmd("get ALL_ITEM_IN "&loc)
- Temp_X = Temp_X + 1
- Delay 100
- Next
- SW_Y = SW_Y + 1
- Next
复制代码
跑多个固定点,以达到覆盖所有拾取外围:
- Function MoveAroundAndGetAll(x, y)
- Dim newX, newY,loc
- // //nw
- // newX = x-1
- // newY = y-1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //n
- newX = x
- newY = y-2
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- Call GetAllNearBy(newX, newY)
-
-
- // //ne
- // newX = x+1
- // newY = y-1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- // //sw
- // newX = x-1
- // newY = y+1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //s
- newX = x
- newY = y+2
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- Call GetAllNearBy(newX, newY)
-
- // //se
- // newX = x+1
- // newY = y+1
- // loc = CoorToLoc(newX, newY)
- // Delay 500
- // Call SendCmd("run "&loc)
- // Delay 5000
- // Call GetAllNearBy(newX, newY)
-
- //00
- newX = x
- newY = y
- loc = CoorToLoc(newX, newY)
- Delay 500
- Call SendCmd("run "&loc)
- Delay 2000
- //Call GetAllNearBy(newX, newY)
- End Function
- Function GetAllNearBy(x, y)
- Dim SW_Y, SW_X,Temp_X,loc
-
- SW_Y = y - 1
- SW_X = x - 1
-
- For 3
- Temp_X = SW_X
- For 3
- loc = CoorToLoc(Temp_X, SW_Y)
- //Call SendCmd("sing x:" & Temp_X & " y:" & SW_Y & " loc:" & loc)
- //Delay 100
- Call SendCmd("get ALL_ITEM_IN "&loc)
- Temp_X = Temp_X + 1
- Delay 100
- Next
- SW_Y = SW_Y + 1
- Next
-
- End Function
复制代码
代码有待优化的地方
在流程上可以修改为先计算出所有需要拾取的点,以及跑位点。再筛除掉重复的点。以提高效率。
有空我会补上。 |
|