Hello Everyone, Maybe Garkin? You're one of the top I've seen in the forums
I've been debugging Alchemist Addon Escape bug for like 5 days now, I've lost so much sleep.
I read Garkin said the Unicorn "List" with "self" was causing the "escape or keyboard bug"... I removed that library and used a simple chat for display.. This didn't help.
I've gone line for line in the code and commenting out each line, crafting an item in game.. and then testing the lockup... it's locking up no matter what???
As far as I can tell...
Its locking up on
local combinations = Alchemist.Algorithm.get_optimal_combinations(inventory, num_reagent_slots)
if I have num_reagent_slots return 1 instead of 2... it doesn't lock up after crafting.
Inside get_optimal_combinations it locks up if we provide "2"
Full function below (please see under this function)_
Lua Code:
function Alchemist.print_combinations()
local inventory = Alchemist.Inventory.new()
inventory:populate_from_control(ALCHEMY["inventory"])
local num_reagent_slots = Alchemist.get_num_reagent_slots()
local combinations = Alchemist.Algorithm.get_optimal_combinations(inventory, num_reagent_slots)
--
local mw = Alchemist.listview
local SI = Alchemist.SI
mw:clear()
mw.control:SetHidden(false)
if #combinations == 0 then
mw:add_message(SI.get(SI.NO_DISCOVERIES_AVAILABLE))
else
mw:add_message(string.format(SI.get(SI.COMBINATIONS_AVAILABLE), #combinations))
mw:add_message("")
for _, combination in pairs(combinations) do
mw:add_message(SI.get(SI.COMBINE_THE_FOLLOWING))
table.sort(combination.reagents, function(a, b) return a.name < b.name end)
for _, reagent in pairs(combination.reagents) do
mw:add_message("- |c00ff00" .. reagent.name)
end
mw:add_message(SI.get(SI.TO_GET_THE_FOLLOWING_DISCOVERIES))
table.sort(combination.discoveries, function(a, b) return a.reagent.name < b.reagent.name end)
for _, discovery in pairs(combination.discoveries) do
mw:add_message("- |c9999ff" .. discovery.reagent.name .. ": " .. discovery.trait)
end
mw:add_message("")
end
end
end
Here are the combinations
.. I've stepped through each code and it either hands the UI in game (force close) or nothing.... commenting out doesn't help.
Lua Code:
local function get_optimal_combinations(inventory, max_reagents)
-- returns a list of combinations that can be done in order, to maximize discovery of traits.
local ret = {}
local combination
repeat
combination = get_best_combination(inventory, max_reagents)
if combination then
table.insert(ret, combination)
for _, reagent in pairs(combination.reagents) do
inventory:decrement_reagent_qty(reagent)
end
for _, discovery in pairs(combination.discoveries) do
discovery.reagent:discover(discovery.trait)
end
end
until not combination
return ret
end
To be honest, I only have a few more days of testing this.. attempting fixes before I get completely burnt out on this Addon.
I'm out of herbs to test with....so its really annoying, lol
If anyone has time.. please feel free to debug this, I'm more than happy to add additional devs to the Addon.
Thanks,
AB