Outfitter (Abandoned)

Outfitter (Abandoned)

563k Downloads

Any chance of some of the bugs being fixed?

lvangh opened this issue ยท 2 comments

commented

I've been trying to take advantage of the scripting events but basically they stop working after the first Lua error. I've been trying to diagnose some of the issues but I'm a Lua beginner at best. Here's an error from one of the equip on target scripts with all addons disabled except Outfitter. I understand this was a quick fix to get it working in Classic and I 100% prefer this over Itemrack. If this is a side project, then that's cool and I'll assume there won't be any major support or re-work for 1.13. Just curious.

My first thought is that it wasn't passing local variables in each script because it kept saying nil value, but I kept disabled all scripts 1 by 1 until I had a simple UnitName equip and it still gave an error on the next mouseover in combat. So then I checked "disable in combat" on all of them as well. Still random Lua errors.

Message: [string "Script for 004-HitBoss"]:15: attempt to index a nil value
Time: Thu Oct  8 10:19:40 2020
Count: 1
Stack: [string "Script for 004-HitBoss"]:15: attempt to index a nil value
[string "Script for 004-HitBoss"]:15: in function `Function'
...dOns\Outfitter\Libraries/MC2EventLib/MC2EventLib.lua:39: in function `DispatchEvent'
...dOns\Outfitter\Libraries/MC2EventLib/MC2EventLib.lua:169: in function <...dOns\Outfitter\Libraries/MC2EventLib/MC2EventLib.lua:166>

Locals: self = <table> {
 PostProcess = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1888
 Debug = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1884
 LastScriptTime = 337778.028000
 RegisterEvent = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1850
 UnregisterAllEvents = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1876
 ScriptLockupCount = 0
 Outfit = <table> {
 }
 Function = <function> defined Script for 004-HitBoss:1
 NewContext = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1829
 Construct = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1841
 inherit = <function> defined @Interface\AddOns\Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:149
 InheritOver = <function> defined @Interface\AddOns\Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:128
 Inherit = <function> defined @Interface\AddOns\Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:149
 UnregisterEvent = <function> defined @Interface\AddOns\Outfitter\OutfitterScripting.lua:1865
 inheritOver = <function> defined @Interface\AddOns\Outfitter\Libraries/MC2AddonLib/MC2AddonLib.lua:128
}
event = "PLAYER_TARGET_CHANGED"
outfit = <table> {
 ScriptLockupCount = 0
 CombatDisabled = true
 didUnequip = false
 Items = <table> {
 }
 BindingIndex = 4
 CategoryID = "Complete"
 Name = "004-HitBoss"
 OutfitBar = <table> {
 }
 ScriptSettings = <table> {
 }
 ScriptID = "EQUIP_ON_TARGET"
}
equip = nil
immediate = nil
layer = nil
delay = nil
interrupt = nil
didEquip = nil
didUnequip = false
isEquipped = true
time = 337785.444000
setting = <table> {
 targetName = "high priest venoxis"
}
run = <function> defined @Interface\AddOns\Outfitter\Outfitter.lua:7921
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = nil
(*temporary) = true
(*temporary) = 1
(*temporary) = <table> {
 ScriptLockupCount = 0
 CombatDisabled = true
 didUnequip = false
 Items = <table> {
 }
 BindingIndex = 4
 CategoryID = "Complete"
 Name = "004-HitBoss"
 OutfitBar = <table> {
 }
 ScriptSettings = <table> {
 }
 ScriptID = "EQUIP_ON_TARGET"
}
(*temporary) = nil
(*temporary) = "attempt to index a nil value"

`

Here is another script that causes a Lua error and stops scripting - have to /reload. (I know you can use tables to list each mob but I'm not focused on efficiency right now.)

-- $EVENTS PLAYER_TARGET_CHANGED
-- $DESC Equips for Vael, Nef, Baron, Rag
local uN = UnitName("target")

if not UnitIsDead("target") and (uN == "Vaelastrasz the Corrupt" or uN == "Nefarian" or uN == "Flamegor" or uN == "Enonroc" or uN == "Onyxia" or uN == "Baron Geddon" or uN == "Ragnaros") then

equip = true
else
equip = false
end

I had some early testing/ experimental ones like this which counted the number of mages in a raid and changed for more/less crit (I know this is grasping for assumptions in spec but it was mainly about experimenting)

-- $EVENTS PLAYER_TARGET_CHANGED

-- Equip if it's the specified target

if UnitInRaid("player") == 1 and UnitLevel("target") < 63 and UnitIsEnemy("player","target") and (not UnitIsDead("target")) then
local mages=0 for i = 1, 40 do local _,_,_,_,_,class = GetRaidRosterInfo(i) 
  if class == "MAGE" then
    mages = mages + 1 
  end 
    if mages < 2  then 
      equip = true 
    end 
end
end
commented

I suspect some of these issues are with the outdated libraries from 7.x/8.x.
Another example error just on a simple target script:
image

commented

Sorry I just now seen this issue, but if you still have it could you give me your "Script for SP" so I can see the exact function it's calling to generate that error.

I suspect it may be an issue with the event names, however in TBC client this may be fixed by virtue of being the modern client.