EC: Stop Loot All, Organizer, and Restock if overweight, too many items, or container is closed
In the EC the Loot All and Organizer will continue to run forever if the destination container is overweight or as too many item. Loot All, Organizer, and Restock will continue to run forever if the source container is closed. The following code will stop them from running forever.
To the file source\ContainerWindow.lua add the following functions
To the file source\ContainerWindow.lua add the following functions
--start of added code
function ContainerWindow.StopLootAll()
local oldOrganizeParent = ContainerWindow.OrganizeParent
ContainerWindow.OrganizeParent = WindowGetId(WindowUtils.GetActiveDialog())
if(oldOrganizeParent ~= nil and oldOrganizeParent ~= ContainerWindow.OrganizeParent)then
ContainerWindow.LootAll[oldOrganizeParent] = nil
end
if(ContainerWindow.OrganizeParent ~= nil) then
ContainerWindow.LootAll[ContainerWindow.OrganizeParent] = nil
end
moveObjects = {} -- cleanup
end
function ContainerWindow.StopOrganizer()
Actions.MassOrganize = false -- abort organizer
ContainerWindow.Organize = false -- enable the button
moveObjects = {} -- cleanup
end
function ContainerWindow.StopRestock()
ContainerWindow.Restock = false -- enable the button
end
--end of added code
Add the following code to the bottom of the function ContainerWindow.UpdatePickupTimer in the file source\ContainerWindow.lua
--start of added code
local organizerParentOpen = false
--end of added code
for id, value in pairs(ContainerWindow.OpenContainers) do
if ContainerWindow.OpenContainers[id] ~= nil then
--start of added code
if(id == ContainerWindow.OrganizeParent) then
organizerParentOpen = true
end
--end of added code
local isDirty = ContainerWindow.OpenContainers[id].dirty
if(isDirty == 1 and ContainerWindow.OpenContainers[id].LastUpdate and ContainerWindow.OpenContainers[id].LastUpdate < ContainerWindow.DeltaRefresh)then
ContainerWindow.UpdateContents(id)
if (ContainerSearch.Container == id) then
ContainerSearch.UpdateList()
end
end
end
end
--start of added code
if(organizerParentOpen == false) then -- stop organizer, restock, loot all
ContainerWindow.StopOrganizer()
ContainerWindow.StopRestock()
ContainerWindow.StopLootAll()
end
--end of added code
end
Add the following code to the function TextParsing.SpecialTexts in the file source\TextParsing.lua
(Note: this code replaces the code added in the post: https://forum.uo.com/discussion/13267/ec-stop-loot-all-from-running-forever-if-the-loot-bag-can-not-hold-more-weight
(Note: this code replaces the code added in the post: https://forum.uo.com/discussion/13267/ec-stop-loot-all-from-running-forever-if-the-loot-bag-can-not-hold-more-weight
function TextParsing.SpecialTexts()
local senderText = SystemData.Text
local find = wstring.find
--start of added code
if ( senderText ~= nil) then
local tooMuchWeight = GetStringFromTid(1080016) -- "That container cannot hold more weight."
local tooManyItems = GetStringFromTid(1080017) -- "That container cannot hold more items."
if( senderText == tooMuchWeight or senderText == tooManyItems) then
ContainerWindow.StopOrganizer()
ContainerWindow.StopLootAll()
return
end
end
--end of added code
Comments
Never be afraid to challenge the status quo
you can just hit the "view" button (green cross) twice and it pops them into view again. and irealize the way to do it is probably within this list, but i am too illiterate with coding to see it lol
Never be afraid to challenge the status quo
Vacuum pushes the LootAll button.
--
You can write a LootAll script command, but it ends up being a multi-line script, if I remember correctly, as you have to also identify the corpse (container) you want to execute LootAll on.
It's easier to just use Vacuum.
Never be afraid to challenge the status quo
Never be afraid to challenge the status quo
My apologies, but Vacuum does not push LootAll. Vacuum pushes the organizer agent.
I was using LootAll, but didn't like the way it worked, so I wrote a catch-all organizer called "Loot", which Vacuum is executing. In answering you I conflated LootAll and Loot.
Anyway, good luck!
Never be afraid to challenge the status quo