[EasyUO] Shindaril's Easy Lumberjacking
Posted: Sun Feb 11, 2018 5:33 pm
Well, got into the mood, so here I am, presenting an easy lumberjacking script for EasyUO. This is based on the old camping training script I found from my script library, but is a bit more sophisticated. This one doesn't spam so much.
The script uses an equipped hatchet to chop on any tree you're standing next to. It watches your weight and moves the logs into your Bag of Holding / Bag of Resources once your weight is over 350. If you're carrying more than that before starting or from the other lumberjacking products, it will halt.
Unfortunately due to the EasyUO's way of obtaining tile data, the script starts with the "tile init" command, which can take several minutes to finish. For this reason, it's highly advised that you use the EasyUO's Pause button when you wish to take a break before continuing later. You can resume the script where it was paused at by pressing the Play button without the need of running the "tile init" command again.
I will not be adding an option to cut the logs into boards to this script. There are two reasons for this. Firstly, it'd take comparing #Property to find out what type of logs you have and then clicking to switch your saw to the correct wood type, which is, in my opinion, faster and easier done manually. Secondly, the carpentry system is going to be re-made, so any carpentry gump scripting would become obsolete once the new system is introduced to the shard. I might do this on a later date, but won't make any promises for now.
The setup for this script is simple, just define your resource container's ID into %Storage and equip your hatchet before running the script. Remember, it takes a while for the "tile init" to finish, so be patient.
The script uses an equipped hatchet to chop on any tree you're standing next to. It watches your weight and moves the logs into your Bag of Holding / Bag of Resources once your weight is over 350. If you're carrying more than that before starting or from the other lumberjacking products, it will halt.
Unfortunately due to the EasyUO's way of obtaining tile data, the script starts with the "tile init" command, which can take several minutes to finish. For this reason, it's highly advised that you use the EasyUO's Pause button when you wish to take a break before continuing later. You can resume the script where it was paused at by pressing the Play button without the need of running the "tile init" command again.
I will not be adding an option to cut the logs into boards to this script. There are two reasons for this. Firstly, it'd take comparing #Property to find out what type of logs you have and then clicking to switch your saw to the correct wood type, which is, in my opinion, faster and easier done manually. Secondly, the carpentry system is going to be re-made, so any carpentry gump scripting would become obsolete once the new system is introduced to the shard. I might do this on a later date, but won't make any promises for now.
The setup for this script is simple, just define your resource container's ID into %Storage and equip your hatchet before running the script. Remember, it takes a while for the "tile init" to finish, so be patient.
Code: Select all
; Shindaril's Easy Lumberjacking
; Version: 1.0
; Date: 11.2.2018
;
; A simple script to cut any tree you're standing next to
; This script assumes you have a Bag of Holding or a Bag of Resources
; that has been defined in %Storage variable
; It's also assumed that you have a Hatchet equipped. This is what you get
; out of a Tool House.
;
; Due to the long taking "tile init" command, the use of EasyUO's Pause button is advised
; You can resume the script by pressing Play again without the need of running the slow
; tile init again
tile init ; This line is mandatory and it does take a few minutes to execute
set %Axe FSF_ ; Hatchet, straight out of tool house
; precaution for us double axe users, so we won't chop out our weapon
set %LastObject null
set %Storage BGLWNPD ; ItemID of your Bag of Holding / Bag of Resources
set %Wood ZLK_ ; Only logs listed. All other lumberjacking products will stay in your mamin backpack
set #lpc 20
while #True
{
if #Weight > 350
{
finditem %Wood C_ , #BackpackID
event exMsg 12 3 #CharID #FindCnt
if #FindKind = -1
{
event exMsg 12 0 #CharID You're carrying too much, halting...
halt
}
for %i 1 #FindCnt
{
finditem %wood C_ , #BackpackID
{
exevent drag #FindID #Findstack
wait 10
exevent dropc %Storage
wait 10
}
}
}
GoSub FindTree
if #Result = #True
{
GoSub GetTreeTarget
finditem %Axe C_ , #CharID
if #FindKind = -1
{
event exMsg 12 3 #CharID No hatchet found, halting...
halt
}
set %LastObject #lObjectID
set #lObjectID #FindID
event macro 17 0
target 2s
event macro 22 0
set #lObjectID %LastObject
}
wait 60 ; 3s wait, can be adjusted
}
sub FindTree
namespace push
namespace local ScanTree
set #lpc 1000
set !StartX #CharPosX - 1
set !StartY #CharPosY - 1
set !EndX #CharPosX + 1
set !EndY #CharPosY + 1
for !X !StartX !EndX
{
for !Y !StartY !EndY
{
tile cnt !X !Y #CursKind
for !TileKind 0 #TileCnt
{
tile get !X !Y !TileKind #CursKind
if TREE in #TileName ; || PALM in #TileName ; Uncomment the palms if you want to cut palms. Commented it out because of the small palms around some forests
{
set !TreeX !X
set !TreeY !Y
set !TreeZ #TileZ
set !TreeTile #TileType
set !TreeKind 3
set #lpc 20
namespace pop
return #true
}
}
}
}
set #lpc 20
namespace pop
return #False
Sub GetTreeTarget
namespace push
namespace local ScanTree
set #lTargetX !TreeX
set #lTargetY !TreeY
set #lTargetZ !TreeZ
set #lTargetTile !TreeTile
set #lTargetKind !TreeKind
namespace pop
return