Kill counter - help needed

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Kill counter - help needed

Post by noblestone »

Script:

if runXP == nil then
runXP = 0
end

if runKills == nil then
runKills = 0
end

xpStopWatch = createStopWatch()

Trigger:

You receive (.*) experience points.

runXP = runXP + matches[2]
runKills = runKills + 1

Aliases:

Start it -

startStopWatch(xpStopWatch)
runXp = 0
runKills = 0

Report -

send("em reports: " .. runXP .. " xp received over " .. runKills .. " mobs, taking " .. getStopWatchTime(xpStopWatch) / 60 .. " minutes for an average of " .. runXP / runKills .. " XP per mob at a rate of " .. runXP / (getStopWatchTime(xpStopWatch) / 60) .. " XP per minute.")


-------------

My question is why isn't it working at all, I have tried to find what went wrong. Anyone can figure it out, would appreciate help here. Thanks

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Kill counter - help needed

Post by kevutian »

Couple of things, really. First of all, rather than those initial if statements, try something like:

Code: Select all

runXP = runXP or 0
Where you have:

Code: Select all

runXP = runXP + matches[2]
is causing a problem. Because you are matching this against (.*), you are trying to math a string to a number. The error console will be telling you this ;)

Simply change to:

Code: Select all

runXP = runXP + tonumber(matches[2])
Try with those changes. I suspect that might resolve your issue.

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Kill counter - help needed

Post by noblestone »

Made the changes, wont work at all, could I import files so u can take a look at it? Let me know.

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Kill counter - help needed

Post by noblestone »

Still getting this after changes:

Mocci reports: 0 xp received over 0 mobs, taking 0.27493333333333 minutes for an
average of nan XP per mob at a rate of 0 XP per minute.

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Kill counter - help needed

Post by noblestone »

here are the files I am working on...

Xp Counter Files

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Kill counter - help needed

Post by kevutian »

Aye, took a look. On your trigger, rather than using a 'substring' type, try setting it to 'perl regex'

Let me know how that works out :)

User avatar
kevutian
Posts: 217
Joined: Fri Aug 20, 2010 8:18 pm
Location: United Kingdom
Contact:

Re: Kill counter - help needed

Post by kevutian »

Here you go. Delete what you have, download and install this and let me know how things go.

Linky.

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Kill counter - help needed

Post by noblestone »

it is now working!

Thanks so much, and am wondering what alias or script shall i add to set reset the counter - i suspect alias.

Thanks again!

noblestone
Posts: 154
Joined: Sun Jul 29, 2012 6:50 am

Re: Kill counter - help needed

Post by noblestone »

Wondering how to fix the decimals, need it to be round off.

the report is 186014 XP of 286 monsters which took 96.433333333333
minutes with an average of 650.3986013986 XP per monster at a rate of
1928.9388178362 XP per minute.

Thanks

Delrayne
Posts: 159
Joined: Tue Jun 07, 2011 7:07 pm
Contact:

Re: Kill counter - help needed

Post by Delrayne »

math.floor() should help with that.

Post Reply