I'm a big nerd, and I like statistics. My anti-duel addon, DuelResponse, tracks how many duels it blocks across all characters, as well as per character.
It does this with two variables:
- GlobalDC (all characters)
- DuelsDeclined (per character)
I've added a button to the new Options menu I added in version 4.0.0 which will allow you to reset these numbers. However, since 'DuelsDeclined' is saved on a per-character basis, that would mean having to perform the reset every time you logged into another character.
To prevent that, I wrote a little function which would do it for you.
Code:
function resetcheck()
local x = tonumber(GlobalDC) -- number of duel requests blocked across all of your characters characters
local y = tonumber(DuelsDeclined) -- number of duel requests blocked on the character you are playing
-- Check to see if the all character counter has been reset to zero, and if the local counter is greater than zero.
-- If both of these conditions are true, then reset the local counter to zero.
if x == 0 and y > 0 then
y = 0
DuelsDeclined = y
end
end
However, it's not working. For some reason, the function doesn't seem to register 'y' as a number, even though I am telling it to. I was on my Monk at the time of posting this, and she has had 17 duel requests blocked; I added a line of code to the above to display 'y' in a message box, and it said '0.'
I cannot for the life of me figure out what is going on, as I do not see anything wrong with my code. Then again, this is me we're dealing with, so chances are high that I have in fact overlooked something.
Thanks in advance for any help. If you have any questions, please feel free to ask.