Post by polymerase on Jul 27, 2020 18:47:55 GMT
- EasyLOU 1.0.0.29
- LoU 1.0.0.4
- LoU 1.0.0.4
- Must have: (1) Hatchet or Pickaxe and Prospector's Tool (lots) inside the backpack; and (2) a packhorse around.
--[[
Fully automated harvesting script - modified from crowface's original script.
Needs to be customized for your uses - indicated with <>.
MoveEx() - gets you to a spot reliably.
dropoff() - casts Gate to get you to your dropoff spot and back and NOT mess
up the current "rail" of harvesting
defend() - if attacked, it'll move away, make pets attack, and spam fireball.
Once done, it'll move back and equip hatchet again. Customize how
you need it.
doGather() - based on crowface's doTree() - harvests tree, uses prospect tool,
and watches for mobs. Will move on after backpack weight stops
increasing.
Instead of doing the dropoff() routine this script transfers resources to a e.g.
a packhorse using the doTransferAll() rountine.
]]
function Equip(item) --[[stole this from utils.lua]]
FindItem (item)
local tool_id = FINDITEMID[1]
local cont_id = FINDITEMCNTID[1]
if tool_id == nil or tool_id == "N/A" then
print(item .. " not found!")
return
end
if tostring(cont_id) == tostring(CHARID) then
print(item .. " already equipped!")
return
end
print("Equipping " .. item)
SayCustom(".x use " .. tool_id .. " Equip")
end
function MoveEx(x,y,z)
--[[starts you moving towards coordinates and waits until you're there
before continuing]]
count = 0
repeat
count = count + 1
Move(x,y,z)
sleep(300)
until ((CHARPOSX == x) and (CHARPOSZ == z)) or count > 120
end
function dropoff()
print('dropping off...')
repeat
Macro(3) --[[this is casting gate from a hotkey to my house]]
sleep(4000)
FindPanel("Moongate")
until string.match(FINDPANELID[1], "ConfirmMoongate")
ClickButton(FINDPANELID[1], "0") --[["0" is the confirmation button]]
sleep(3000)
FindItem("Logs",tonumber(BACKPACKID)) --[[finds all logs in my backpack]]
for id in FINDITEMID do
Drag(id)
Dropc(<container id you want to drop into>) --[[and drops them in a
chest at my house]]
sleep(500)
end
FindItem("Kindling",tonumber(BACKPACKID)) --[[moves kindling...]]
Drag(FINDITEMID[1])
Dropc(<container id you want to drop into>)
sleep(500)
FindItem("Apple",tonumber(BACKPACKID)) --[[...and apples...]]
Drag(FINDITEMID[1])
Dropc(<container id you want to drop into>)
sleep(500)
FindItem("Portal") --[[...and travels back through the moongate]]
UseSelected(tonumber(FINDITEMID[1]))
sleep(1000)
FindPanel("Moongate")
ClickButton(FINDPANELID[1], "0")
sleep(3000)
Equip("Hatchet") --[[don't forget to re-equip your hatchet!]]
end
function isNotMobile(name)
FindMobile(name)
return FINDMOBILEID[1] == "N/A"
end
function defend()
while MONSTERSNEARBY == 'True' do --[[if a monster is within maybe 5 units]]
local x = CHARPOSX
local y = CHARPOSY
local z = CHARPOSZ
mId_s = MONSTERSID[1]
mId = tonumber(mId_s)
Move(x-5,y,z) --[[run away a bit]]
sleep(1000)
Say('all follow me') --[[get your pets with you]]
sleep(1000)
Say('all kill')
TargetDynamic(mId) --[[make the pets attack mob (stupid boglings!)]]
for i=1,10 do
Macro(10) --[[fireball on my hotbar]]
TargetDynamic(mId)
end
print('mob dead')
Equip("hatchet") --[[re-equip yourself!]]
MoveEx(x,y,z)
FindPermanent("Tree") --[[and re-engage the tree]]
closestId = FINDPERMAID[1]
Macro(28)
sleep(500)
TargetPermanent(closestId)
end
end
-- item: string name of item ("sand")
-- destination: string name of container (e.g. "packhorse")
function doTransfer(item, origin, destination, all, qty)
all = all or nil
qty = qty or nil
--[[find origin container]]
FindItem(origin)
local from = tonumber(FINDITEMID[1])
UseSelected(from)
--[[find destination container]]
FindItem(destination)
local to = tonumber(FINDITEMID[1])
UseSelected(to)
--[[find item]]
FindItem(item, from)
local items = FINDITEMID[1]
if qty == nil then
for each_item in items do
Drag(each_item)
if all == nil then break end
end
else
ContextMenu(item_id, "Split Stack")
sleep(500)
SetInput("StackSplit","TextFieldStackAmount",qty)
sleep(500)
ClickButton("StackSplit",2)
sleep(500)
end
Dropc(to)
end
function doTransferAll(item, origin, destination)
doTransfer(item, origin, destination, true)
end
function doGather(x,y,z,item,target)
Equip(item)
MoveEx(x,y,z)
FindPermanent(target) --[[find all trees]]
closestId = FINDPERMAID[1] --[[finds the closest one]]
print('At spot with x/z: ' .. x .. ',' .. z)
Macro(28) -- the 'q' key
sleep(500)
TargetPermanent(closestId)
print("whacking " .. target)
sleep(1000)
repeat
defend() --[[checks for nearby monsters and defends]]
startWeight = CHARWEIGHT
FindItem("prospector", BACKPACKID)
prospectId = FINDITEMID[1]
UseSelected(prospectId) --[[uses prospecting tool from pack on tree]]
TargetPermanent(closestId)
sleep(250)
FindPanel("Inspecting")
ClickButton(FINDPANELID[1], "0")
sleep(4000)
endWeight = CHARWEIGHT
print('start/end weight: ' .. startWeight .. ','..endWeight)
until startWeight == endWeight --[[will move to next tree if, within 4
seconds-ish, weight didn't change
(as in the tree is gone)]]
if tonumber(endWeight) > 350 then --[[getting full, dropoff time!]]
--dropoff()
print("Heavy")
doTransferAll("log", BACKPACKID, "saddlebags")
doTransferAll("kindling", BACKPACKID, "saddlebags")
doTransferAll("ore", BACKPACKID, "saddlebags")
end
end
while true do
sleep(3000)
doGather(<spotX>, <spotY>, <spotZ>, "Hatchet", "Tree")
doGather(<spotX>, <spotY>, <spotZ>, "Hatchet", "Tree")
doGather(<spotX>, <spotY>, <spotZ>, "Hatchet", "Tree")
doGather(<spotX>, <spotY>, <spotZ>, "Pickaxe", "Rock")
doGather(<spotX>, <spotY>, <spotZ>, "Pickaxe", "Rock")
doGather(<spotX>, <spotY>, <spotZ>, "Pickaxe", "Rock")
end