AlexFolland/AutoGear

Autogear wont work on druid

Samann96 opened this issue · 34 comments

Hi
Today i used ag on my druid but it keeps giving me this error and ag wont work

454801x Interface\AddOns\AutoGear\AutoGear.lua:1566: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "@Interface\AddOns\AutoGear\AutoGear.lua"]:1566: in function `AutoGearSetStatWeights'
[string "@Interface\AddOns\AutoGear\AutoGear.lua"]:2562: in function `AutoGearUpdateEquippedItems'
[string "@Interface\AddOns\AutoGear\AutoGear.lua"]:2614: in function `AutoGearConsiderAllItems'
[string "@Interface\AddOns\AutoGear\AutoGear.lua"]:4197: in function `AutoGearMain'
[string "@Interface\AddOns\AutoGear\AutoGear.lua"]:364: in function <Interface\AddOns\AutoGear\AutoGear.lua:363>

@AlexFolland
image_2023-04-16_23-16-57
same situation, please help

I am also having this issue. Works on my paladin, not on my druid though.

Thanks for the report. What edition of the game is this, and what is the output of /ag spec in the chat?

Your image attachment didn't work. It looks like it was lost in translation from your email response to the github issue ticket comment. Can you please try navigating fully to this issue ticket on the github website, then pasting the image from your clipboard while the github comment editor is focused in your web browser?

Alternatively, transcribing the chat output to text here would work.

image

Here you go!

This looks only like your configuration is not working the way you expect it to work, which would just need support and not necessarily a bug fix. However, if there are Lua errors also being thrown, there is a real bug to fix. Do you see Lua errors as well? If so, can you please paste the exact error output from BugSack, or confirm it's the same as posted earlier in this issue ticket, plus what the error count you see is?

I am getting the same exact error as above. I'm new to BugSack but will paste what I get below. Before installing bugsack the counter would just run up infinite until I disabled and /reload. I would usually get a warning in the low 1000's to disable all addons but it was only AG causing the issue.

28x AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "@AutoGear/AutoGear.lua"]:1570: in function `AutoGearSetStatWeights'
[string "@AutoGear/AutoGear.lua"]:2584: in function `AutoGearUpdateEquippedItems'
[string "@AutoGear/AutoGear.lua"]:2357: in function <AutoGear/AutoGear.lua:2245>

Locals:
class = "DRUID"
spec = "Guardian"
(*temporary) = nil
(*temporary) = <function> defined =[C]:-1
(*temporary) = nil
(*temporary) = 11
(*temporary) = "attempt to index global 'AutoGearCurrentWeighting' (a nil value)"
TOC_VERSION_CURRENT = 30402
TOC_VERSION_WOTLK = 30000
weapons = "any"

Like I said above, no issues with my paladin, the lua errors only show on my druid.

Thanks. That helps a lot. The output you've pasted includes the local variable values, which the screenshot earlier did not include.

The only way I can see this error happening is if AutoGearDefaultWeights["DRUID"]["Guardian"] returned nil when accessed at line 1568 which is AutoGearCurrentWeighting = AutoGearDefaultWeights[class][spec] or nil. Since class is "DRUID" and spec is "Guardian", the access executed should be AutoGearDefaultWeights["DRUID"]["Guardian"]. This access should not result in nil because those keys' values are defined, as shown in this screenshot.

image

Therefore, I'd like to ask you to try to run /dump AutoGearDefaultWeights["DRUID"]["Guardian"] and copy-paste the output. If you can't copy from your chat, then the addon named "Prat" will let you do that, so you could install that first. Alternatively, pasting a screenshot of the output might work if it's not too much text to fit on-screen.

Here is the output:

[07:42:42] Dump: value=AutoGearDefaultWeights["DRUID"]["Guardian"]
[07:42:42] [1]={
[07:42:42]   Intellect=1e-06,
[07:42:42]   DamageSpellProc=1e-06,
[07:42:42]   DamageProc=1,
[07:42:42]   Agility=1.05,
[07:42:42]   Versatility=0.8,
[07:42:42]   Spirit=1e-06,
[07:42:42]   YellowSockets=1e-06,
[07:42:42]   ArmorPenetration=1e-06,
[07:42:42]   SpellHit=1e-06,
[07:42:42]   Strength=1e-06,
[07:42:42]   SpellCrit=1e-06,
[07:42:42]   RangedProc=1e-06,
[07:42:42]   RedSockets=1e-06,
[07:42:42]   SpellPower=1e-06,
[07:42:42]   Mp5=1e-06,
[07:42:42]   SpellPenetration=1e-06,
[07:42:42]   Haste=0.8,
[07:42:42]   ExperienceGained=100,
[07:42:42]   Dodge=0.4,
[07:42:42]   Armor=0.08,
[07:42:42]   Block=1e-06,
[07:42:42]   AttackPower=1,
[07:42:42]   Defense=1.33,
[07:42:42]   DPS=0.8,
[07:42:42]   MeleeProc=1,
[07:42:42]   HealingProc=1e-06,
[07:42:42]   Parry=1e-06,
[07:42:42]   BlueSockets=1e-06,
[07:42:42]   Multistrike=1,
[07:42:42]   MetaSockets=1e-06,
[07:42:42]   <skipped 5>
[07:42:42] }

OK, so it's not nil, meaning there's no reason you should get that error. Well, the code in AutoGearSetStatWeights where the error is being thrown is very simple and looks correct, and I don't see the same issue on my druid in Wrath Classic, so I guess something else in your setup is interfering. I have no idea what it could be. If you enable only AutoGear and Pawn with all other addons disabled temporarily, do you still see the issue?

I have another thought. I wonder if it doesn't throw an error if Pawn is disabled. This is obviously not what we want, but if that's the case, then it'll give me more information about how to track this down.

image

This is with just Pawn and AG, I will try again with just AG but I downloaded Pawn specifically because I was getting this error and I was hoping if it pulled from a different stat weight it would go away

OK, thanks. When, exactly, is the error thrown? Is it only when you enter the game world, or is it some time after? If after, what action(s) trigger(s) it?

It seems to be when items are looted, or I try equipping an item. For instance, I've been playing for about 10 min with just AG turned on, no error yet but I haven't looted gear from any mobs. I just tried changing my cloak and this error triggered:

Message: Interface/AddOns/AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
Time: Fri Jun 30 11:42:55 2023
Count: 2
Stack: Interface/AddOns/AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "=[C]"]: ?
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:1570: in function `AutoGearSetStatWeights'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:2584: in function `AutoGearUpdateEquippedItems'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:2357: in function <Interface/AddOns/AutoGear/AutoGear.lua:2245>

Locals: (*temporary) = <function> defined =[C]:-1

The above triggers when I try to equip a different peice of gear, but does not go infinite, the below triggers when looting gear and does go infinite

Message: Interface/AddOns/AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
Time: Fri Jun 30 11:46:37 2023
Count: 326
Stack: Interface/AddOns/AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "=[C]"]: ?
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:1570: in function `AutoGearSetStatWeights'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:2584: in function `AutoGearUpdateEquippedItems'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:2636: in function `AutoGearConsiderAllItems'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:4220: in function `AutoGearMain'
[string "@Interface/AddOns/AutoGear/AutoGear.lua"]:368: in function <Interface/AddOns/AutoGear/AutoGear.lua:367>

Locals: (*temporary) = <function> defined =[C]:-1

Thank you for the analysis! Are there more locals in those error messages, like you included before? Seeing the local variable values is extremely useful for figuring this out.

I'm not sure what you mean by locals? Would it show in the same place near the bottom of the error? If so, no. I copy/pasted the whole lua error. Let me know if I should be looking elsewhere.

Oooh wait do you mean like the bugsack report I uploaded earlier? I can turn bugsack back on and try to get the error to trigger again if that's what you need.

30x AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "@AutoGear/AutoGear.lua"]:1570: in function `AutoGearSetStatWeights'
[string "@AutoGear/AutoGear.lua"]:2584: in function `AutoGearUpdateEquippedItems'
[string "@AutoGear/AutoGear.lua"]:2357: in function <AutoGear/AutoGear.lua:2245>

Locals:
class = "DRUID"
spec = "Guardian"
(*temporary) = nil
(*temporary) = <function> defined =[C]:-1
(*temporary) = nil
(*temporary) = 11
(*temporary) = "attempt to index global 'AutoGearCurrentWeighting' (a nil value)"
TOC_VERSION_CURRENT = 30402
TOC_VERSION_WOTLK = 30000
weapons = "any"

Here is the bug when trying to equip an item from bags
Edit: seems weird but now this one is triggering over and over. It did not earlier when I just equipped something but it is going infinite with bugsack enabled, I paused a reloaded once it hit over 100

The "locals" are the local variables and their values at the execution point which triggered the error. It's important to see that class and spec are populated. Since class and spec are populated, and since /dump AutoGearDefaultWeights["DRUID"]["Guardian"] (using the values of class and spec at that point) returns a non-nil value, this error makes no sense. The only way that AutoGearCurrentWeighting could be nil at that point in the code is if AutoGearDefaultWeights["DRUID"]["Guardian"] returns nil, which it doesn't. This issue is cursed.

Can you show me what you have set in AutoGear's settings? This can be with your usual addons enabled. I just want to see override settings.

Also, would you mind telling me what happens if you equip a different piece of gear after disabling an override?

Also, what language is the game set to? If not English, can you tell me what happens if you try setting the game language to English, restarting, and trying equipping a different piece of gear?

image

Game is in English, I'm playing in the US and can only speak English :)

Also, would you mind telling me what happens if you equip a different piece of gear after disabling an override? What do you mean by override? Do you mean if I equip, cause the error, close it out, and try again? Because I can't get the error window to close it keeps repopulating once it starts.

I agree this is confusing, I don't understand why it would even need AutoGearDefaultWeight info pulled if it's using Pawn's?

Explanation of that: The weapons preferred by each spec are still used from AutoGearDefaultWeights, as Pawn doesn't have a way to specify that. In the case of a feral druid, the weapons preferred are set to "any", which essentially means any weapons which can be equipped and evaluate to a higher score (using either Pawn's or AutoGear's weights, depending on whether "Use Pawn to evaluate upgrades" is enabled) will be preferred. That's likely to be a 2-handed staff or polearm, in the case of a feral druid, but if you have no good weapons or there's some insanely high-stats 1-handed weapon you find while leveling, it'll still allow using the 1-handed weapon.

AutoGear doesn't actually know Pawn's stat weights at all. It only uses Pawn's stat weights when evaluating the score for an item in AutoGearDetermineItemScore. When using Pawn is enabled, AutoGear simply calls PawnGetSingleValueFromItem instead of doing a score calculation using AutoGear weights.

The issue is still cursed, as accessing AutoGearDefaultWeights["DRUID"]["Guardian"] does not return nil when you access it with /dump AutoGearDefaultWeights["DRUID"]["Guardian"], yet the error means that it does return nil when accessing it inside AutoGearSetStatWeights. Therefore, this is extremely confusing. It makes absolutely no sense, but I'm still trying to make sense of it. I've asked @Synthetikaryote to give me a second opinion when he has time (which he doesn't have much of these days).

Ah okay, thanks for the explanation! I'm definitely no coder but I do like to understand the logic. And sounds good on the 2nd opinion, I will just play without it for now.

I've released an alpha version of the addon which may work around the issue, even though it doesn't resolve it properly since the issue still makes no sense. If it does work around the issue, please let me know. If you find any regressions the attempted fix caused, please let me know. I'm doing this blindly without testing.

I've tagged it for release, so now there are release packages. Please let me know if the workaround helps.

Sadly same/similar error on my druid. Still stable on my paladin:

7005x AutoGear/AutoGear.lua:1570: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "@AutoGear/AutoGear.lua"]:1570: in function `AutoGearSetStatWeights'
[string "@AutoGear/AutoGear.lua"]:2584: in function `AutoGearUpdateEquippedItems'
[string "@AutoGear/AutoGear.lua"]:2636: in function `AutoGearConsiderAllItems'
[string "@AutoGear/AutoGear.lua"]:4220: in function `AutoGearMain'
[string "@AutoGear/AutoGear.lua"]:368: in function <AutoGear/AutoGear.lua:367>

Locals:
class = "DRUID"
spec = "Feral Combat"
(*temporary) = nil
(*temporary) = <function> defined =[C]:-1
(*temporary) = nil
(*temporary) = 11
(*temporary) = "attempt to index global 'AutoGearCurrentWeighting' (a nil value)"
TOC_VERSION_CURRENT = 30402
TOC_VERSION_WOTLK = 30000
weapons = "any"

Oh, looks like you are still running the previous version. I see why, too. There's a BigWigs packager bug which I reported here causing the release package to have been uploaded as alpha.

For now, please try the alpha package, which is the current version.

Well, slightly different infinite error now. This didn't trigger right away either it took like 30 mins to start going off.

21047x AutoGear/AutoGear.lua:3760: attempt to index global 'AutoGearCurrentWeighting' (a nil value)
[string "@AutoGear/AutoGear.lua"]:3760: in function `AutoGearDetermineItemScore'
[string "@AutoGear/AutoGear.lua"]:2597: in function `AutoGearUpdateEquippedItems'
[string "@AutoGear/AutoGear.lua"]:2642: in function `AutoGearConsiderAllItems'
[string "@AutoGear/AutoGear.lua"]:4235: in function `AutoGearMain'
[string "@AutoGear/AutoGear.lua"]:368: in function <AutoGear/AutoGear.lua:367>

Locals:
info = <table> {
 isGear = true
 rarity = 1
 link = "|cffffffff|Hitem:5976::::::::71:::::::::|h[Guild Tabard]|h|r"
 id = 5976
 classID = 4
 reason = "(invalid item for |cffff7d0aFeral Combat Druid|r)"
 shouldShowScoreInTooltip = 1
 unusable = 1
 item = <table> {
 }
 invType = 19
 rarityColor = <table> {
 }
 subclassID = 0
 equipped = true
 name = "Guild Tabard"
}
(*temporary) = nil
(*temporary) = "|cffffffff|Hitem:5976::::::::71:::::::::|h[Guild Tabard]|h|r"
(*temporary) = false
(*temporary) = "|cffffffff|Hitem:5976::::::::71:::::::::|h[Guild Tabard]|h|r"
(*temporary) = "attempt to index global 'AutoGearCurrentWeighting' (a nil value)"
E = 0.000001
maxPlayerLevel = 80

To reach line 3760, you have to have the Pawn option disabled or Pawn itself disabled. Did either Pawn or the AutoGear option for Pawn get disabled? Also, was AutoGear working until then?

I added a check at that line which should at least try to set stat weights again if they're missing there. That being said, I'm still interested in the answers to my questions in my previous comment.

Hmmm, my last play session of several hours just now I never got an error to trip. I did check and with the reinstall I forgot to tell AutoGear to use Pawns stat weights so it was going off the internal weighting. Next time I play I can see if the Pawn weighting works as well or if that triggers anything.