1. As a challenge to myself, I thought I'd write a quick and dirty addon to play some thunder and print to the screen something like "Player X has killed Mr Bigglesworth!!" This is what I have so far:

    http://pastey.net/108483

    I am fairly certain the event UNIT_HEALTH is what I'm looking for, because if Biggs' health changes, then it would be a player changing it. Then if UnitIsDead is true, then play the sound and print the message. Also, since there are multiple ways to kill a creature, I could check UNIT_AURA, or other items, but that seems unnecessary when all I am after is whether the cat is alive or dead.

    The issue I am having is how to determine who the variable Killer is supposed to be. I know that to enter Naxxramas, you have to be in a raid, so I don't have to check for party.

    I figure I'm blind, but I just don't see an API or event to handle this. I'll probably have to write a function, but now I feel like I'm running in circles.

  2. As a challenge to myself, I thought I'd write a quick and dirty addon to play some thunder and print to the screen something like "Player X has killed Mr Bigglesworth!!" This is what I have so far:

    http://pastey.net/108483

    I am fairly certain the event UNIT_HEALTH is what I'm looking for, because if Biggs' health changes, then it would be a player changing it. Then if UnitIsDead is true, then play the sound and print the message. Also, since there are multiple ways to kill a creature, I could check UNIT_AURA, or other items, but that seems unnecessary when all I am after is whether the cat is alive or dead.

    The issue I am having is how to determine who the variable Killer is supposed to be. I know that to enter Naxxramas, you have to be in a raid, so I don't have to check for party.

    I figure I'm blind, but I just don't see an API or event to handle this. I'll probably have to write a function, but now I feel like I'm running in circles.

  3. This isn't a quick answer, but I'll do my best.  First I would say that using the Ace stack for somethign like this is a bit of a waste, considering the code isn't that terrible.  You want to use the COMBAT_LOG_EVENT_UNFILTERED event, looking for the UNIT_DIED combatEvent.  Code like the following should work to tell you when anyone in your party/raid kills a Shoveltusk Stag.  Obviously you should change isShoveltusk to a function that checks if the npc is Mr. Bigglesworth by substituting his id in there.

    http://wowprogramming.com/misc/snippets/party_kills

    Hope that helps!

  4. Actually it helps a great deal. I started with Ace 3 simply because my wow text editor defaults to it, but yes, you are correct of course, and I will probably switch to something simpler.

    And coincidentally, after I posted the original code, I thought of the combat_log_unfiltered, but only because I was looking at the wiki. Sadly, this site doesn't have any info on the combat log events and apis. At least, not that I could find. Possibly I am looking in the wrong section.

    I'll get back to you how it turns out. Thank you once again for everything, Mr Whitehead: the book, the site, the forums, and your patience as I fumble my way around coding!

  5. The APIs and events are listed because our listings are ALWAYS accurate based on the events and functions that are actually in the game client.  The functions are not all documented becuase they came out after the book came out and updating them is a laborious process.  We are in the process of getting things up to date over the next few months.

  6. Ok, I started getting a bit more complex, and wanted slash commands to turn the sound on or off. Straight to page 261 I went, and in went the code. Then localization was next, so page 127...  the result is thus:

    http://pastey.net/109829

    and the localization file is

    http://pastey.net/109830

    I know there is a bug or bugs in the code, since the slash commands don't work, and when I killed some DeepRun Rats using their MobID, no thunder, no message. I just can't see the bugs, and I feel silly for missing them.

  7. Ok, I started getting a bit more complex, and wanted slash commands to turn the sound on or off. Straight to page 261 I went, and in went the code. Then localization was next, so page 127...  the result is thus:

    http://pastey.net/109829

    and the localization file is

    http://pastey.net/109830

    I know there is a bug or bugs in the code, since the slash commands don't work, and when I killed some DeepRun Rats using their MobID, no thunder, no message. I just can't see the bugs, and I feel silly for missing them.

    You need to enable Lua errors.. your localization file is not a valid Lua file.  In particular:

        MrBigglesworthDeathLocalization["DEATH_MESSAGE"] = sourceName.. " killed Kenny! Er, killed "..biggsName.. "!!" 

    You cannot do this.  When the file is parsed, it will attempt to concatenate sourceName, and will complain because it is a nil value.  This part of the file does not have access to (nor should it) those variables.. because they do not exist yet.  It's really important to remember variable scope.. AND to read the error messages that WoW gives you.  This error would have told you exactly what was wrong.

    If you have a message you want to localize, you use format strings.  IN this case

        MrBigglesworthDeathLocalization["DEATH_MESSAGE"] = "%s killed Kenny! Er, killed %s!!" 

    Then, when you later need to build the string, you use string.format() and pass in the information you have. 

    1. You initialize biggsNameto a table, why?  You're never going to store a table there, so just leave it empty, i.e. local biggsName.  You don't need to assign anything to it.
    2. Once you have altered the code to change #1 and the localization issue above, then you need to change the AddMessage call in your addon to the following:

    local msg = string.format(L.DEATH_MESSAGE, sourceName, biggsName)

    ChatFrame1:AddMessage(msg)

    Does that make sense?

  8. Well, the good news is that with some help, including what you taught me about the combat log, and my mistake about passing variables, I can proudly say my first addon is done, built, and now sitting on Curse.com !

    There was some trial and error, a lot of bug fixing, and a second set of eyes on my code (thank you OrionShock) but man, I am one happy camper now.

    Thank you again, Cladhaire / Mr. Whitehead.

    The finished addon is called MrBigglesworthDeath.

    Myrroddin /  Paul.

  9. I'm sure the folks at wowinterface.com would love to be another distribution site for you, if you're interested in posting there.