PDA

View Full Version : Getting stats data from item tooltips


RareBeast
25-01-2007, 08:52 AM
Hi all,

I'm new to modding (and programming). Trying my hand at writing one that rates gear based on it's stats I'm just not sure how to get the various stats off the tool tip of the item. I think I know how to search for "+4 Agility" in the tooltip, but not how to extract the numerical value of the stat.

Search for "%+(%d+) Agility" - I know the brackets bit isn't quite right. But how do I say Item_Agility = (%d+) so that in the above example, the Item_Agility would have a "value" of 4?

I have looked at many mods LUA files (equipcompare, itemscore, outfitter, tankpoints) and can understand bits, but none of them seem to be clearly doing what I want (i'm sure their solutions are more elegant) in a way I can understand :)

Thanks for any advice :)

Wintrow
25-01-2007, 04:31 PM
local txt = 'one two three';
local result;
_, _, result = string.find(txt,'one (.+) three');
foo_PrintToChat(result); -- will print 'two' to chat


the first two results from string.find are the starting and ending positions of 'two'. By assigning them to _ we are discarding them.