View Single Post
04/01/15, 05:30 AM   #1
awesomebilly
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 23
Alchemist (Seeking Help) @Garkin?

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:
  1. function Alchemist.print_combinations()
  2.     local inventory = Alchemist.Inventory.new()
  3.     inventory:populate_from_control(ALCHEMY["inventory"])
  4.  
  5.     local num_reagent_slots = Alchemist.get_num_reagent_slots()
  6.     local combinations = Alchemist.Algorithm.get_optimal_combinations(inventory, num_reagent_slots)
  7.     --
  8.     local mw = Alchemist.listview
  9.     local SI = Alchemist.SI
  10.  
  11.     mw:clear()
  12.     mw.control:SetHidden(false)
  13.  
  14.     if #combinations == 0 then
  15.         mw:add_message(SI.get(SI.NO_DISCOVERIES_AVAILABLE))
  16.     else
  17.         mw:add_message(string.format(SI.get(SI.COMBINATIONS_AVAILABLE), #combinations))
  18.         mw:add_message("")
  19.         for _, combination in pairs(combinations) do
  20.             mw:add_message(SI.get(SI.COMBINE_THE_FOLLOWING))
  21.  
  22.             table.sort(combination.reagents, function(a, b) return a.name < b.name end)
  23.             for _, reagent in pairs(combination.reagents) do
  24.                 mw:add_message("- |c00ff00" .. reagent.name)
  25.             end
  26.  
  27.             mw:add_message(SI.get(SI.TO_GET_THE_FOLLOWING_DISCOVERIES))
  28.  
  29.             table.sort(combination.discoveries, function(a, b) return a.reagent.name < b.reagent.name end)
  30.             for _, discovery in pairs(combination.discoveries) do
  31.                 mw:add_message("- |c9999ff" .. discovery.reagent.name .. ": " .. discovery.trait)
  32.             end
  33.             mw:add_message("")
  34.         end
  35.     end
  36. 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:
  1. local function get_optimal_combinations(inventory, max_reagents)
  2.  
  3.     -- returns a list of combinations that can be done in order, to maximize discovery of traits.
  4.     local ret = {}
  5.  
  6.     local combination
  7.     repeat
  8.         combination = get_best_combination(inventory, max_reagents)
  9.         if combination then
  10.             table.insert(ret, combination)
  11.             for _, reagent in pairs(combination.reagents) do
  12.                 inventory:decrement_reagent_qty(reagent)
  13.             end
  14.  
  15.             for _, discovery in pairs(combination.discoveries) do
  16.                 discovery.reagent:discover(discovery.trait)
  17.             end
  18.         end
  19.     until not combination
  20.  
  21.     return ret
  22. 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

Last edited by awesomebilly : 04/01/15 at 10:35 AM.
  Reply With Quote