WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Help with TinyDPS - Mysterious error (https://www.wowinterface.com/forums/showthread.php?t=35101)

Sideshow 09-22-10 04:16 AM

Help with TinyDPS - Mysterious error
 
Hello

Some of the users (small percentage) are complaining about a bug.
I never had or have the issue, so I can't solve it.

So I require aid :cool:

The problem is located in a little function used to track spells. Well I have 3 of those actually, one for spells, one for heals and one for melee. The melee one is causing the trouble:

Code:

local function trackMelee(amount, arg7)
        if tdps.trackSpells then
                if not tmp.cds['Melee'] then tmp.cds['Melee'] = {} end -- make the spell
                if not tmp.ods['Melee'] then tmp.ods['Melee'] = {} end
                tmp.cds['Melee'][arg7] = (tmp.cds['Melee'][arg7] or 0) + amount -- record the amount
                tmp.ods['Melee'][arg7] = (tmp.ods['Melee'][arg7] or 0) + amount
        end
end

- Arg7 is the target name. (all 'args' come from the combat event ofcourse)
- tmp is a reference to the current combatant.
- cds is a table with damage spells of the current fight.
- ods is the same but the for overall data
- Since melee is no spell, I just write 'Melee' ofcourse. (The other function for real spell has an extra paramater and looks like this: local function trackSpell(amount, arg7, arg10)
- At the end, 'Melee' is a table in a table, containing names of mobs. The value of the mob name is a number. (in the case 'damage done')

Now the error: attempt to index field 'Melee' (a number value)
Again, only a marginal percentage of users get this error.
I have no clue.

Any help ?
http://www.wowinterface.com/download....html#comments

zork 09-22-10 05:39 AM

What would happen if your targetname (arg7) is "A'lar" for example?
A name with one single quote. Could that destroy your variable? Not sure if you filter special characters out before using them. Maybe you could NPCID's instead.

You could try double quotes and/or parse the string "Melee" into a variable in forehand and use the variable instead of the string each time. The guys who posted it should tell you where it happened.

If it works for you all of the time but for some it does not, on special occasions. My suggestion would be to let him post what is parsed into his trackMelee function. So let him post "amount" and "arg7". You could then hardcode these values and test the behaviour. Saving the complete lua file in Unicode (UTF-8) may help if the language used is out of order.

Code:

print("amount: "..amount.." / arg7: "..arg7)
The only difference I see from trackMelee to trackSpell is that you are using SingleQuoted strings as a reference. So it should have sth to do with that.

Slakah 09-22-10 09:04 AM

Would be nice to get a dump of their "tdPlayer" Saved Variable. Also because we don't have the full error report (with line numbers and local variables) it is much harder to fix, also I don't know what version the person is using so even if we had line numbers they may be wrong.

Sideshow 09-22-10 06:25 PM

Quote:

Originally Posted by Slakah (Post 206940)
Would be nice to get a dump of their "tdPlayer" Saved Variable. Also because we don't have the full error report (with line numbers and local variables) it is much harder to fix, also I don't know what version the person is using so even if we had line numbers they may be wrong.

This is it, just me beating up the target dummies. For some people, this caused a bug :confused: This variable looks sort of clean to me though.

So tdPlayer is a table with guid's ...

Code:

tdPlayer = {
        ["0x010000000031BCEB"] = {
                ["yhs"] = {
                },
                ["zhs"] = {
                },
                ["c"] = 31.62899994850159,
                ["yds"] = {
                },
                ["yd"] = 0,
                ["class"] = "WARRIOR",
                ["ch"] = 0,
                ["pets"] = {
                },
                ["ods"] = {
                        ["Melee"] = {
                                ["Grandmaster's Training Dummy"] = 8562,
                                ["Heroic Training Dummy"] = 10022,
                                ["Expert's Training Dummy"] = 9235,
                        },
                        ["Cleave"] = {
                                ["Expert's Training Dummy"] = 6735,
                        },
                        ["Slam"] = {
                                ["Expert's Training Dummy"] = 7772,
                        },
                        ["Whirlwind"] = {
                                ["Grandmaster's Training Dummy"] = 21313,
                                ["Expert's Training Dummy"] = 15159,
                        },
                        ["Intercept"] = {
                                ["Grandmaster's Training Dummy"] = 646,
                                ["Expert's Training Dummy"] = 1095,
                        },
                        ["Bloodthirst"] = {
                                ["Grandmaster's Training Dummy"] = 6599,
                                ["Heroic Training Dummy"] = 8702,
                                ["Expert's Training Dummy"] = 7811,
                        },
                        ["Deep Wounds"] = {
                                ["Grandmaster's Training Dummy"] = 4531,
                                ["Heroic Training Dummy"] = 4568,
                                ["Expert's Training Dummy"] = 1618,
                        },
                        ["Heroic Throw"] = {
                                ["Heroic Training Dummy"] = 8091,
                        },
                        ["Heroic Strike"] = {
                                ["Heroic Training Dummy"] = 3267,
                        },
                },
                ["cd"] = 125726,
                ["xd"] = 0,
                ["ohs"] = {
                },
                ["zh"] = 0,
                ["zds"] = {
                },
                ["zd"] = 0,
                ["stamp"] = 1285201696.848,
                ["oh"] = 0,
                ["xh"] = 0,
                ["yh"] = 0,
                ["xds"] = {
                },
                ["xhs"] = {
                },
                ["y"] = 0,
                ["x"] = 0,
                ["name"] = "Sideshow",
                ["z"] = 0,
                ["chs"] = {
                },
                ["cds"] = {
                        ["Melee"] = {
                                ["Grandmaster's Training Dummy"] = 8562,
                                ["Heroic Training Dummy"] = 10022,
                                ["Expert's Training Dummy"] = 9235,
                        },
                        ["Cleave"] = {
                                ["Expert's Training Dummy"] = 6735,
                        },
                        ["Slam"] = {
                                ["Expert's Training Dummy"] = 7772,
                        },
                        ["Whirlwind"] = {
                                ["Grandmaster's Training Dummy"] = 21313,
                                ["Expert's Training Dummy"] = 15159,
                        },
                        ["Intercept"] = {
                                ["Grandmaster's Training Dummy"] = 646,
                                ["Expert's Training Dummy"] = 1095,
                        },
                        ["Bloodthirst"] = {
                                ["Grandmaster's Training Dummy"] = 6599,
                                ["Heroic Training Dummy"] = 8702,
                                ["Expert's Training Dummy"] = 7811,
                        },
                        ["Deep Wounds"] = {
                                ["Grandmaster's Training Dummy"] = 4531,
                                ["Heroic Training Dummy"] = 4568,
                                ["Expert's Training Dummy"] = 1618,
                        },
                        ["Heroic Throw"] = {
                                ["Heroic Training Dummy"] = 8091,
                        },
                        ["Heroic Strike"] = {
                                ["Heroic Training Dummy"] = 3267,
                        },
                },
                ["od"] = 125726,
                ["o"] = 31.62899994850159,
        },
}


Slakah 09-22-10 06:59 PM

Nah I was specifically referring to the SVs of people experiencing the bug, according to the error you provided (attempt to index field 'Melee' (a number value)). tdPlayer[<playerguid>].ods.Melee is a number value instead of a table, and after looking at your code I have no idea why this would happen other than people manually changing the SVs or a previous version of your mod saved tdPlayer[<playerguid>].ods.Melee as a number and has remained like that ever since.

Vrul 09-23-10 01:05 AM

Quote:

Originally Posted by Slakah (Post 206984)
according to the error you provided (attempt to index field 'Melee' (a number value)). tdPlayer[<playerguid>].ods.Melee is a number value instead of a table, and after looking at your code I have no idea why this would happen other than people manually changing the SVs or a previous version of your mod saved tdPlayer[<playerguid>].ods.Melee as a number and has remained like that ever since.

I looked through the code too and saw nothing that could cause that error and I agree with what Slakah stated for possible causes. I suggest having anyone with that issue manually reset their settings via the drop-down menu.

Sideshow 09-23-10 08:19 AM

Ok thanks all

I got the Sv from a friendly guy, who had the bug:

Code:

...
["ods"] = {
["Mind Sear"] = 54902,
["Melee"] = 1927,
["Shadow Word: Pain"] = 42555,
...

Heh :(:( No idae how this happened.
Anyway, next update of the addon will get a hard reset op all SVs.

Thanks all


All times are GMT -6. The time now is 10:57 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI