Thread Tools Display Modes
09-22-10, 04:16 AM   #1
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
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

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
  Reply With Quote
09-22-10, 05:39 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
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.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 09-22-10 at 05:49 AM.
  Reply With Quote
09-22-10, 09:04 AM   #3
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
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.

Last edited by Slakah : 09-22-10 at 09:15 AM.
  Reply With Quote
09-22-10, 06:25 PM   #4
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
Originally Posted by Slakah View Post
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 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,
	},
}

Last edited by Sideshow : 09-22-10 at 06:29 PM.
  Reply With Quote
09-22-10, 06:59 PM   #5
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
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.
  Reply With Quote
09-23-10, 01:05 AM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Slakah View Post
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.
  Reply With Quote
09-23-10, 08:19 AM   #7
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
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
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Help with TinyDPS - Mysterious error

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off