if table.getn(mySavedVar) > 1 then -- if we've logged in as more than one character
local player = UnitName("Player")
ChatFrame1:AddMessage('I believe I've also seen you:')
for name,number in pairs(mySavedVar) do
if name ~= player then
if number = 1 then
ChatFrame1:AddMessage('...once as '..name..'.')
else
ChatFrame1:AddMessage('...'..number..' times as '..name..'.')
end
end
end
end

Can you test the addon live? like without reloading the addon ? or restart the game ?
also. I have this addon that shows XP gained in an dungeon. I downloaded it from some guy here ^^ @ treeston

however . the window was very small .. so I located the source of the window and increased it by 2 times.
but .. now it has 1 big window with larger font( also increased the size) and 1 smaller window with the txt runXP

is it possible to show the window while not in an dungeon ? (I know it can be done but how ? just some tips maybe I come up with it myself

Help!, coding is not my friend...

Ok guys, this is a wonderfulll guide, and reading this i went to the stables , hoped on ma big white horse and said "IM GONNA CREATE A WHYHELLOTHAR!!!!!!! " .......which aftera while (2 or so hours) and 1000 reloadui´s WORKS, but "not as intended" i´ll paste the code here, and the thing is that i have an XP Broker in Fortress , and when my code works the numbers do not match, my code just cant record correctly the mobs im killing, so....care to help?...ill post a screenshot too, maybe it´ll explain better....

Code:

-- RidOfMe: First try at making an addon, let´s see if may be done having zero programming skills.... ;)
-- Purpose: Displaying a really annoying message each time your character gains any experience, telling you how many points you need to level up.
-- Work Variables
XP = UnitXP("player")
TotalXP = UnitXPMax("player")
MyLvl = UnitLevel("player")
-- Code
local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_COMBAT_XP_GAIN")
f:SetScript("OnEvent", function(self,event,...)
ChatFrame1:AddMessage(" Yes I´m annoying, but you are only " ..(TotalXP - XP).. " points away from getting rid of me, so move on to Level " ..(MyLvl + 1).. " ,NOW.")
end)

Screenshoot:

Thanks for the help!
Qelk

---------- Post added 2011-01-06 at 01:30 AM ----------

Oh another thing, this coding provoked some weird side effect: Now when i kill anything instead of saying for example "2515" on the floating purple text above my head, it displays "430987:2515" indicating my current experience and the experience gotten from the kill....dunno...:P

I believe you need to put the 3 variables into where the chat message is added. By defining the variables before the function, they are only defined once. When you put them inside the function, the variables will be updated every time the function is triggered. So it should look like this:

Code:

-- RidOfMe: First try at making an addon, let´s see if may be done having zero programming skills.... ;)
-- Purpose: Displaying a really annoying message each time your character gains any experience, telling you how many points you need to level up.
-- Code
local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_COMBAT_XP_GAIN")
f:SetScript("OnEvent", function(self,event,...)
XP = UnitXP("player")
TotalXP = UnitXPMax("player")
MyLvl = UnitLevel("player")
ChatFrame1:AddMessage(" Yes I´m annoying, but you are only " ..(TotalXP - XP).. " points away from getting rid of me, so move on to Level " ..(MyLvl + 1).. " ,NOW.")
end)

As far as the weird side effect you are getting, I have no idea lol.

EDIT: Sorry about that, made sure the cases were correct. I guess when I quoted the code it made everything lowercase.

I believe you need to put the 3 variables into where the chat message is added. By defining the variables before the function, they are only defined once. When you put them inside the function, the variables will be updated every time the function is triggered. So it should look like this:
<snip>

Lua is case sensitive. Your code would just produce enormous amounts of errors.

THAKS GUYS!, works like a charm now (its not like it useful, but knowing ZERO about programming, it makes me happy as a TMNT with a pizza). Now, for the sake of notice, i had to change the event from ""CHAT_MSG_COMBAT_XP_GAIN" to "PLAYER_XP_UPDATE" because it didn´t account XP from exploring or farming materials....

Quick question, originally, I wanted it to say "Yes i´m annoying but you are X points nearer to level Y , and of getting rid of me" where X should be the number of XP points that just were aerned a moment ago, but checking the list of functions on WowWiki i couldnt find one that read THAT number , example:

Kill a mob: 3498 XP earned,

"Yes I´m annoying but you are 3498 points nearer to level 82, and of getting rid of me"

So i had to work around and use "UnitXPMax("player") - UnitXP("player")" as an alternative, so anyone knows what event reads the XP amount you win in a given moment by killing,exploring,questing,farming?....or it cannot be read directly?.

PD: The side effect i named before still lingers, Pygmies knows why.....

Originally Posted by Idaho

so if bolvar is on fire how is he in the frozen throne shouldnt it melt cause hes on fire and fire is hot so the frozen throne which is made of ice and is cold shouldnt it melt

Apparently Physics applies where we are cows that become chickens then becomes cats then do you /kill and /lololololol.....yep. ^^

Originally Posted by SPF18

If Bolvar turns out to be a dragon, I'll put a pancake on my face and wave at traffic for 10 minutes.

Reading through it I ran across a nitpicky detail in the If statements section going over operators. You state "== variable is equal to variable2" which is fine, though I personally prefer using the phrase "same as" rather than "equal to".

However, what occurred to me as potentially useful for the guide would be a note on the difference between "=" and "==". I searched, admittedly rather quickly, through the guide for a distinction between the two, but was unable to find it made anywhere. I would expect anyone with scripting experience to know the difference, but if this guide is intended to be used by those new to programming then this difference should be made clear. It's one of the easiest mistakes to make and one of the most frustrating to solve if you don't have an understanding on the differences between the two.

For those who might not understand, "=" is used to set the value of a variable. Thus, an if statement like "if x = y" will set the value of x to y rather than check to see if the values of the two variables are equivalent. It will also always return true (and thus perform whatever code is contained in the if statement), unless y is equivalent to 0. On the other hand, an if statement like "if x == y" will compare the values of x and y and only proceed with the code in the if statement if the two variables are equivalent in value.

It might also be useful to note that when checking for equality it will compare variable type. This might be a little more advanced than this guide warrants, but 0 == "0" will return false as the first is a number and the latter is a string.

So I understand it should do /say WhyHelloThar when I login.
But isn't working.

The thing is I wanted to create an addon that will hide my hunter bar using this: /script ShapeshiftBarFrame:Hide()
I write that in game to hide the bar, however if I teleport, or logount-login I neet to write it again.

It should be piece of cake, however I still don't understand function(self,event,...) those needs to be named? .... <- the dots needs to be removed?

Theres a Visual studio based wow addon creator called "Addon Studio". It lets you create the windows and menus in a visual way such as with visual basic and similar languages. Has all Lua built in to it for help with auto correction and things like that. Auto generates TOC and things like that I believe also.