[EasyUO] Auto Lumberjacking an area.
Posted: Sun Dec 05, 2021 11:29 am
Ever wish you could run up amongst a bunch of trees and click play and harvest the trees in the area? That's what this script does. You have to keep an eye on it because you will get AFK checked while it's running. You will need woodworkers keys to keep your pack cleaned out and not get overweight. You also will need a high use hatchet from either your exex box or the tool house. Just put the axe in your hand run up amongst some trees and click play. It will show you what tree of the count in the area it's on. Once it gets back to tree number 1 then stop the script (not pause) and move to a new area and start it again.
Please let me know if you have trouble.
Please let me know if you have trouble.
Code: Select all
set %currentTree 0
set %treeCount 0
set %currentX 0
set %currentY 0
gosub getwoodkeys
sub scanTiles
set #LPC 1000
set %range 15
tile init noOverrides
set %minX #charPosX - %range
set %maxX #charPosX + %range
set %minY #charPosY - %range
set %maxY #charPosY + %range
for %x %minX %maxX
{
for %y %minY %maxY
{
tile cnt %x %y
for %i 1 #tileCnt
{
tile get %x %y %i
if TREE in #tileName
{
set % , tx , %spot %x
set % , ty , %spot %y
set % , tz , %spot #tileZ
set % , tt , %spot #tileType
set %spot %spot + 1
set %treeX . %treeCount %x
set %treeY . %treeCount %y
set %treeZ . %treeCount #tileZ
set %treeCount ( %treeCount + 1 )
}
}
}
}
gosub walkToTree
return
sub walkToTree
set #LPC 10
set %msgTree %currentTree + 1
event ExMsg #charID 3 0 Tree %msgTree of %treeCount $
set %currentX ( %treeX . %currentTree )
set %currentY ( %treeY . %currentTree )
set %currentZ ( %treeZ . %currentTree )
if %currentTree = %treeCount - 1
set %currentTree -1
move %currentX %currentY 0 5s
gosub lumber
return
sub lumber
finditem FSF
set #lObjectId #findID
set #lTargetX %currentX
set #lTargetY %currentY
set #lTargetZ %currentZ
set #lTargetKind 3
Tile cnt %currentX %currentY
Tile Get %currentX %currentY #tileCnt
set #lTargetTile #tileType
repeat
{
event macro 17 0 ; last object
target 5s
event macro 22 0 ; last target
set %jStart #jindex
set %timeexpire #time + 5 ; wait for 5 sec for a server response
set %nextTreeNow 0
while #jindex = %jStart ; wait for response from server.
{
if #time > %timeexpire
{
set %nextTreeNow 1
break
}
}
set %jEnd #jIndex
for %i %jStart %jEnd
{
scanjournal %i
if not_enough_wood in #journal
{
set %nextTreeNow 1
}
if use_an_axe_on in #journal
{
set %nextTreeNow 1
wait 1s
set %currentTree ( %currentTree + 1 )
gosub walkToTree
}
if too_far_away in #journal
{
set %nextTreeNow 1
set %currentTree ( %currentTree + 1 )
wait 1s
gosub walkToTree
}
if you_hack_at in #journal
{
set %nextTreeNow 1
}
}
}
until %nextTreeNow = 1
wait 5
; add logs and items to wood keys
;event ExMsg #charID 3 0 Chopping Logs
gosub chopLogs
wait 5
;event ExMsg #charID 3 0 Adding to Keys
gosub woodKeys
set %currentTree ( %currentTree + 1 )
gosub walkToTree
return
gosub scanTiles
sub chopLogs
; chop all logs in pack
finditem FSF
set #lObjectId #findID
set %HATCHET #findID
set %Log ZLK
finditem %Log C_, #BackpackID
while #findkind <> -1
{
set #lObjectId %HATCHET
event macro 17 0 ; last object
target 5s
wait 4
set #lTargetId #findId
set #lTargetKind 1
event macro 22 0 ; last target
wait 4
finditem %Log C_, #BackpackID
}
return
sub getwoodkeys
_findwoodkeys:
findItem NUI C_ , #backpackID
if #findkind = -1
return
event property #findID
if Wood in #property
{
set %keys #true
set %keysid #findid
set #lObjectID %keysid
event macro 17 0 ; last object
return
}
if %keys <> #true
{
ignoreitem #findID
goto _findwoodkeys
}
return
;;;;; Wood ;;;;;
sub woodKeys
set #lObjectID %keysid
event macro 17 0
gosub keyMenuWait
set %clickX #contPosX + 290
set %clickY #contPosY + 360
click %clickX %clickY
target 3s
wait 3
set %lTargetKind #lTargetKind
set #lTargetKind 1
woodAddLoop:
finditem TLK C_ , #backpackID
if #findKind = -1
{
goto barkAddLoop
}
set #lTargetID #findID
set #lTargetKind 1
event macro 22 0 ; last target
target 3s
goto woodAddLoop
barkAddLoop:
finditem NWS C_ , #backpackID
if #findKind = -1
{
goto switchAddLoop
}
set #lTargetID #findID
set #lTargetKind 1
event macro 22 0 ; last target
target 3s
goto barkAddLoop
switchAddLoop:
finditem BWR C_ , #backpackID
if #findKind = -1
{
goto fungiAddLoop
}
set #lTargetID #findID
set #lTargetKind 1
event macro 22 0 ; last target
target 3s
goto switchAddLoop
fungiAddLoop:
finditem XWS C_ , #backpackID
if #findKind = -1
{
goto parasiticAddLoop
}
set #lTargetID #findID
set #lTargetKind 1
; wait 3s
event macro 22 0 ; last target
target 3s
goto fungiAddLoop
parasiticAddLoop:
finditem YWS C_ , #backpackID
if #findKind = -1
{
key ESC
wait 1s
click %clickX %clickY r
set #lTargetKind %lTargetKind
return
}
set #lTargetID #findID
set #lTargetKind 1
event macro 22 0 ; last target
target 3s
goto parasiticAddLoop
return
sub keyMenuWait
set %timePass = #sCnt + 5
keyLoop:
if #sCnt > %timePass
{
event macro 17 0
set %timePass = #sCnt + 5
}
wait 1
if #contSize <> 505_395
goto keyLoop
return