I am playing with a lumberjack script and having issues getting event macro 22 to work consistently. I have the script cutting logs into boards by assigning the log ID to #LTargetID and using event macro 22 0. I can confirm that the value of #LtargetID is correctly assigned, but it still fails. For some reason #LtargetID is retaining the tree targe and will try to cut the last tree I hit. If I manually target something other than the tree, then it will accept #LtargetID assignments. I am at a loss for what I am doing wrong.
Here is an example of the code I am having trouble with. It works fine if I manually target something after I am done cutting trees, but otherwise never cuts the logs despite having the right IDs:
;==========================================================
Sub Cut_Logs
event sysmessage In Cut Logs
Finditem %Hatchet C_ , #CharID
If #FindCnt < 1
Finditem %Hatchet C_ , #BackpackID
If #FindCnt < 1
Return
Set %Cutwith #FindID
Finditem ZLK C_ , #BackpackID
event sysmessage Hatchet is %CutWith Logs are #Findtype #findid LtargetID is #LtargetID
For %LogCount 1 #FindCnt
{
Set #Findindex %LogCount
Set #LobjectID %CutWith
Event Macro 17 0
target 20
Set #LtargetID #FindID
event sysmessage Findindex is #Findindex TargetID is #LtargetID
Event Macro 22 0
Wait 20
}
Wait 20
Return