Post by polymerase on Jul 27, 2020 18:41:34 GMT
- EasyLOU 1.0.0.29
- LoU 1.0.0.4
- LoU 1.0.0.4
- Must have: (1) A few boards backpack; (2) lots of boards in a packhorse; (3) must set 'trash_id' and 'table_id' variables; (4) bandages are optional.
function ExtractLastTooltip(tips)
local last_tip = nil
for id in string.gmatch(tips, "([^|]+)") do
last_tip = id
end
return last_tip
end
function getTooltipParam(id, param)
GetTooltip(id)
last_tip = ExtractLastTooltip(TOOLTIPTEXT):gsub(param .. ": ", "")
return tonumber(last_tip)
end
-------------------
function checkMinResource(item, where, min)
FindItem(item, where)
local id = FINDITEMID[1]
if id != nil then return getTooltipParam(id, "Weight") < min
else return false
end
end
-------------------
function doTransfer(item, origin, destination, all)
-- item: string name of item ("sand")
-- destination: string name of container (e.g. "packhorse")
-- find origin container
FindItem(origin)
--local from = tonumber(getElement(FINDITEMID,1))
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
if items != "N/A" then
for each_item in items do
Drag(each_item)
Dropc(to)
if all == nil then break end
end
end
end
function doTransferAll(item, origin, destination)
doTransfer(item, origin, destination, true)
end
function doTransferQty(item, qty, origin, destination, all)
-- item: string name of item ("sand")
-- destination: string name of container (e.g. "packhorse")
-- 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 item_id = FINDITEMID[1]
--SayCustom(".x use " .. item_id .. " Split Stack")
ContextMenu(item_id, "Split Stack")
sleep(500)
SetInput("StackSplit","TextFieldStackAmount",qty)
sleep(500)
ClickButton("StackSplit",2)
sleep(500)
Dropc(to)
end
function doOpenTool(instructions, item)
local b_id = nil
local s_item = string.lower(item)
for each_instruction in string.gmatch(instructions, "([^>]+)") do
FindButton("CraftingWindow", each_instruction)
ClickButton("CraftingWindow", FINDBUTTONNAME[1])
sleep(250)
end
FindButton("CraftingWindow", item)
if s_item == "lockpicks" then b_id = FINDBUTTONNAME[3]
elseif s_item == "plain board" then b_id = FINDBUTTONNAME[2]
elseif s_item == "oak board" then b_id = FINDBUTTONNAME[2]
elseif s_item == "yew board" then b_id = FINDBUTTONNAME[2]
elseif s_item == "bloodwood board" then b_id = FINDBUTTONNAME[2]
elseif s_item == "frostwood board" then b_id = FINDBUTTONNAME[2]
else b_id = FINDBUTTONNAME[1]
end
ClickButton("CraftingWindow", b_id)
sleep(250)
end
function doCraftAll(tool, instructions, item)
FindButton("CraftingWindow", "Craft All")
sleep(500)
if FINDBUTTONNAME[1] == "N/A" or FINDBUTTONNAME[1] == nil then
FindItem(tool)
UseSelected(FINDITEMID[1])
doOpenTool(instructions, item)
FindButton("CraftingWindow", "Craft All")
end
print(FINDBUTTONNAME[1])
ClickButton("CraftingWindow", FINDBUTTONNAME[1])
return
end
-------------------
function defend()
repeat
SayCustom(".x bandageself")
Say("guards")
sleep(500)
until HEALTH == 100
end
-------------------
-- there in general are hard to find by name
trash_id = <id>
table_id = <id>
run = true
doCraftAll(table_id, "Furnishings>Fences/Walls", "single small fence panel")
while run do
sleep(500)
FindItem("board", BACKPACKID)
if FINDITEMID[1] == "N/A" or checkMinResource("board", BACKPACKID, 20) then
print("Need log!")
doTransferAll("fence", BACKPACKID, trash_id)
doTransferQty("board", "saddlebags", BACKPACKID, 100)
doCraftAll(table_id, "Furnishings>Fences/Walls", "single small fence panel")
end
if tonumber(HEALTH) < 100 then
defend()
end
end