Thread Tools Display Modes
06-21-09, 10:36 AM   #1
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Perhaps a strange request...

I'm sort someone is going to think I'm an obnoxious noob for making this request, but here goes...

I can't program, beyond some very basic HTML/XML (I used to be able to make UI mods in EQ/EQ2 and customize them using a sort of "monkey see, monkey do" approach, but I could never generate one of my own from scratch.)

I've spent all morning reading up on making WoW addons, read several howtos and starter guides, and I just don't have the skillset and won't be able to acquire it with the time/attention span I have available (I have a young child, my ability to concentrate is often not good.)

And yet, I have an addon I really want to take a stab at, because I've been told it would be "pretty simple" to do, and because I hate asking someone else to do something I'm not willing to do myself.

Basically, I want to try the mod I described in this thread. In essence, if you're escorting an NPC on an escort quest, and an event happens (the NPC faints, falls asleep, gets attacked) then the addon will play an alert sound (I'm thinking the basic "error" gong type of sound) and flash a warning message on your screen (not just in the chat box, but on the screen like a raid warning.)

Like I said, I can often do scripting in a sort of "monkey see, monkey do" sort of manner, so I've been searching for other mods with this sort of functionality, and I haven't yet found one that's just barebones enough for me to really get an idea of what they're doing so that I can emulate it. I get lost in the specifics of that particular mod with all its different events its looking for.

So what I would like to see is a very no-frills, straightforward sample of script with exactly the sort of functionality I've described. From there, I can go on to do the research as far as finding out what specific text event happens in the chat window with the various escort quests (i.e. Ringo says "Ughhhhh!" or "I don't feel so well" or whatever when he faints, or the chicken alerts you when it's being attacked, etc) and customize the script to look for those events.

In other words, you generate the code, I'll do the plodding and boring footwork of adapting it to various escort quests.

In the (admittedly unlikely, but a girl has to try) event that I actually do emerge from this experience with a functional addon worth sharing with others, you will of course get credit for it.
  Reply With Quote
06-21-09, 11:16 AM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
This is actually really easy:

Code:
local me = CreateFrame("frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfText = {
    "says \"Uggh\"", --note \" for quotes, since a literal " would close the string
    "I don't feel so well",
    "Ooh pretty shinies",
    "etc",
    "and so forth",
}

me.EventHandler(self, event, msg)
      for i = 1, #self.ListOfText do
           if msg:find(self.listOfText[i]) then
                 PlaySound("whateversoundyouwant")
                 RaidWarningFrame:AddMessage("msg")
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)

Last edited by Akryn : 06-21-09 at 03:08 PM.
  Reply With Quote
06-21-09, 12:59 PM   #3
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Thank you very much, Akryn. Now I just need to see if I can find all the NPC texts I want to include, figure out what sort of sound to include and where to find it, and try to cobble it all together with a toc and xml. Should be interesting to see if I can do this.
  Reply With Quote
06-21-09, 01:04 PM   #4
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
NP, good luck getting it working. You don't need an XML file FYI, just point the .toc at the Lua file.
  Reply With Quote
06-21-09, 10:04 PM   #5
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
So let me see if I have this right, since I don't have any characters of the proper level at this time to test this (or even a higher level character who hasn't done it yet.) Since I can't find the "alert" quotes for "The Sleeper Has Awakened" or "Wandering Shay" (which are the only other two timed escort quests with this sort of event that takes place that I can think of off the top of my head) I'm using the "A Little Help From My Friends" quest in Ungoro Crater as a test case. I am sure there are others, and I think if I ever release this addon, I will solicit people to send me suggestions of other quests I can add to it, especially Horde quests since it's been years since I played a Horde toon and I don't remember what escorts they have.

I'm a little confused about the quotes thing you commented on. I removed the / since I assumed that wasn't supposed to be in the final product, but I'm not sure that what I removed is actually what was supposed to be removed. If that makes sense?

I'm also not certain if I did the sound thing right. I chose the "RaidWarning" sound because that is what I see used in another addon I use, but I'm not sure if that's a sound that is actually already in game that the addon can find.

Anyway, here is what I have:


Code:
local me = CreateFrame("frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfText = {
    "Uuuuuuggggghhhhh....", --note \" for quotes, since a literal " would close the string
    "I'm not feeling so well...",
    "Maybe... you could carry me?",
    "The heat... I can't take it...",
}

me.EventHandler(self, event, msg)
      for i = 1, #self.ListOfText do
           if msg:find(self.listOfText[i]) then
                 PlaySound("RaidWarning")
                 RaidWarningFrame:AddMessage("Head's Up!  Your quest NPC needs help!!!")
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
And the .toc file looks like this:

Code:
## Interface: 30100
## Title: Escort Event Alert (Ringo)
## Author:  Ambrya, thanks to large amounts of help from Akryn
## Notes:  Plays a sound and displays a warning message on screen when an event requiring attention occurs during the escort quest "A Little Help From My Friends"

escortalert.lua
Does this look right, or am I completely off the mark?

Also, would it be better to include the entire quote, including the Ringo says: part? For example

Code:
me.listOfText = {
    "Ringo says: Uuuuuuggggghhhhh....", --note \" for quotes, since a literal " would close the string
    "Ringo says: I'm not feeling so well...",
    "Ringo says: Maybe... you could carry me?",
    "Ringo says: The heat... I can't take it...",
}

Last edited by Ambrya : 06-21-09 at 11:05 PM.
  Reply With Quote
06-22-09, 04:30 AM   #6
Slakah
A Molten Giant
 
Slakah's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2007
Posts: 863
That should all work apart from
Code:
me.listOfText = {
    "Ringo says: Uuuuuuggggghhhhh....", --note \" for quotes, since a literal " would close the string
    "Ringo says: I'm not feeling so well...",
    "Ringo says: Maybe... you could carry me?",
    "Ringo says: The heat... I can't take it...",
}
because the first argument from CHAT_MSG_MONSTER_* isn't the formatted string and only has the message, apart from CHAT_MSG_MONSTER_EMOTE, which includes %s where %s is the monster name, i.e. "%s keels over and throws up" (a lovely image I know).

Also "frame" should start with a capital F ("Frame").

Code:
local addon = CreateFrame("Frame", "EscortEventAlert")


local triggers = {
	CHAT_MSG_MONSTER_EMOTE = {
		["<monster emote message>"] = true --remember include %s where the monster name should be
	}
	CHAT_MSG_MONSTER_SAY = {
		["<monster say message>"] = true
	}
	
	CHAT_MSG_MONSTER_WHISPER = {
		["<monster whisper message>"] = true
	}
}

addon:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
addon:RegisterEvent("CHAT_MSG_MONSTER_SAY")
addon:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")

local function OnEvent(self, event, msg, monster)
	if triggers[event][msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Head's Up!  "..monster.." needs help!!!")
	end
end

addon:SetScript("OnEvent", OnEvent)

addon.triggers = triggers
heres something which will only match exact cases so should be marginally more efficient, but requires EXACT matches. Also it might be an idea for later to allow localisation of the message strings.

Hope this helps.
  Reply With Quote
06-22-09, 08:24 AM   #7
Recluse
A Cliff Giant
 
Recluse's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 70
Could you not skip the event subtables and instead just do a search on the triggers table when an event happens, since you are registering specific events?

Code:
local addon = CreateFrame("Frame", "EscortEventAlert")

local triggers = {
	["<monster emote message>"] = true,
	["<monster say message>"] = true,
	["<monster whisper message>"] = true
}

addon:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
addon:RegisterEvent("CHAT_MSG_MONSTER_SAY")
addon:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")

local function OnEvent(self, event, msg, monster)
	if triggers[msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage(monster.." needs help")
	end
end

addon:SetScript("OnEvent", OnEvent)
__________________
We'd be together, but only diamonds last forever...
  Reply With Quote
06-22-09, 08:37 AM   #8
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Okay, so when the the quest NPC is saying something, omit the "%s says:" part, but include %s when the NPC is doing an emote. So, adding in events from "The Sleeper Has Awakened" that include both quotes and emotes, we get this, no?


Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfText = {
    --Events from Ringo in the "A Little Help From My Friends" quest
    "Uuuuuuggggghhhhh....",
    "I'm not feeling so well...",
    "Maybe... you could carry me?",
    "The heat... I can't take it...",
    --Events from Kerlonian Evershade in the "The Sleeper Has Awakened" quest
    "This looks like the perfect place for a nap...",
    "Yaaaaawwwwwnnnn...",
    "Oh, I am so tired...",
    "Be on the alert! The Blackwood furbolgs are numerous in the area...",
    "You don't mind if I stop here for a moment, do you?",
    "It's quiet... Too quiet...",
    "Kerlonian Evershade looks very sleepy...",
    "Kerlonian Evershade suddenly falls asleep",
    "Kerlonian Evershade begins to drift off...",

}

me.EventHandler(self, event, msg)
      for i = 1, #self.ListOfText do
           if msg:find(self.listOfText[i]) then
                 PlaySound("RaidWarning")
                 RaidWarningFrame:AddMessage("Head's Up!  Your quest NPC needs help!!!")
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
Now, in the case of "The Sleeper Has Awakened" (and, I think, "A Little Help From My Friends" as well) the quote usually follows the emote, for instance:

Kerlonian Evershade looks very sleepy...
Kerlonian Evershade says: This looks like the perfect place for a nap...


Will this trigger the addon twice, then?

I found an old unplayed character of mine last night who hadn't done "The Sleeper Has Awakened" so I was able to run through that and get screenshots of the events and have added them into the addon as well. UNFORTUNATELY, I very stupidly accidentally turned the quest in instead of abandoning it, so I can't test the addon. (/headdesk)

If I am understanding the second example you posted, I would modify it to include "Ringo" or "Kerlonian Evershade" where "monster" is, like this?

Code:
local addon = CreateFrame("Frame", "EscortEventAlert")


local triggers = {
	CHAT_MSG_MONSTER_EMOTE = {
		["<Ringo emote message>"] = true --remember include %s where the monster name should be
	}
	CHAT_MSG_MONSTER_SAY = {
		["<Ringo say message>"] = true
	}
	
	CHAT_MSG_MONSTER_WHISPER = {
		["<Ringo whisper message>"] = true
	}
}

addon:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
addon:RegisterEvent("CHAT_MSG_MONSTER_SAY")
addon:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")

local function OnEvent(self, event, msg, monster)
	if triggers[event][msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Head's Up!  "Ringo" needs you to use the canteen!!!")
	end
end

addon:SetScript("OnEvent", OnEvent)

addon.triggers = triggers
And then I would include another section of the macro for Kerlonian Evershade, perhaps like this?

Code:
local addon = CreateFrame("Frame", "EscortEventAlert")


local triggers = {
	CHAT_MSG_MONSTER_EMOTE = {
		["<Ringo emote message>"] = true --remember include %s where the monster name should be
	}
	CHAT_MSG_MONSTER_SAY = {
		["<Ringo say message>"] = true
	}
	
	CHAT_MSG_MONSTER_WHISPER = {
		["<Ringo whisper message>"] = true
	}
	CHAT_MSG_MONSTER_EMOTE = {
		["<Kerlonian Evershade emote message>"] = true
	}
	CHAT_MSG_MONSTER_SAY = {
		["<Kerlonian Evershade say message>"] = true
	}
	
	CHAT_MSG_MONSTER_WHISPER = {
		["<Kerlonian Evershade whisper message>"] = true
	}

}

addon:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
addon:RegisterEvent("CHAT_MSG_MONSTER_SAY")
addon:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")

local function OnEvent(self, event, msg, Ringo)
	if triggers[event][msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Head's Up!  Ringo needs you to use the canteen!!!")
	end

local function OnEvent(self, event, msg, Kerlonian Evershade)
	if triggers[event][msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Darn it!  That lazy druid has fallen asleep again, use the horn!!!")
	end
end

addon:SetScript("OnEvent", OnEvent)

addon.triggers = triggers
(I suspect I screwed up where the end commands go, and probably a lot more than that, just trying to see if I understand the idea.)

The nice thing about this second variation, of course, is that it doesn't appear to require me to research all the various quotes and emotes. Which means if you wanted to post this addon and take credit for it yourself, rather than humoring me, you could do so (and I would totally understand.)

Of course, the sleeping druid alert doesn't really work in the context of the NPC getting attacked, whether by a passing mob or during the scripted events, but that's okay.

Last edited by Ambrya : 06-22-09 at 09:00 AM.
  Reply With Quote
06-22-09, 08:53 AM   #9
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Originally Posted by recluse View Post
Could you not skip the event subtables and instead just do a search on the triggers table when an event happens, since you are registering specific events?
So this is basically just a slightly more compact version of the second variation that Akryn posted, correct?

Code:
local addon = CreateFrame("Frame", "EscortEventAlert")

local triggers = {
	["<Ringo emote message>"] = true,
	["<Ringo say message>"] = true,
	["<Ringo whisper message>"] = true
	["<Kerlonian Evershade emote message>"] = true,
	["<Kerlonian Evershade say message>"] = true,
	["<Kerlonian Evershade whisper message>"] = true
}

addon:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
addon:RegisterEvent("CHAT_MSG_MONSTER_SAY")
addon:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")

local function OnEvent(self, event, msg, Ringo)
	if triggers[msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Ringo needs help") --customizable?
	end
local function OnEvent(self, event, msg, Kerlonian Evershade)
	if triggers[msg] then
		PlaySound("RaidWarning")
		RaidWarningFrame:AddMessage("Kerlonian Evershade needs help")
	end
end

addon:SetScript("OnEvent", OnEvent)
I'm feeling iffy on that last part, again I'm trying to get a grasp on the theory of how to adapt this for various NPCs so that I can add in as many quests as I might find or get requests for.
  Reply With Quote
06-22-09, 04:26 PM   #10
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Ignore this now, if you're going with names I don't think anyone has quote marks in their name

Last edited by Akryn : 06-22-09 at 05:05 PM.
  Reply With Quote
06-22-09, 04:33 PM   #11
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
By the way, I stand behind my original code (minus the capitalisation of "Frame", bah). It's inefficient but easier to modify for someone without Lua experience which is what I was going for. Because of the way this addon works, the loss in efficiency will never ever be noticed by anyone running anything better than a P2.

Last edited by Akryn : 06-22-09 at 04:36 PM.
  Reply With Quote
06-22-09, 04:48 PM   #12
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
I agree the initial code is definitely easier to deal with for someone of my skill level (which is to say, no skill at all.)

However it is dependent upon having the exact quotes and emotes, which could get to be cumbersome in the event that this addon catches on and I start getting requests to add any number of the other dozens of escort quests in the game (though admittedly, the number of timed escorts with tricky events like the fainting/sleeping/etc are limited enough that if I focus mainly on those, eventually I should be able to accumulate all the necessary information.)

In that regard, the second bit of code is more effective, since all it really requires is the NPC name. So in the case that going that route becomes necessary, I should probably know if I've got the idea right in the examples I posted of how I would adapt it for the quests I am using as test cases...so how badly did I screw it up?
  Reply With Quote
06-22-09, 05:02 PM   #13
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
However it is dependent upon having the exact quotes and emotes
Oh I see, well just change it to this:

Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfNames = {
     "NPC A",
     "NPC B",
     "etc...",
}

me.EventHandler(self, event, _, name)
      for i = 1, #self.listOfNames do
           if name:find(self.listOfNames[i]) then
                 PlaySound("RaidWarning")
                 RaidWarningFrame:AddMessage("Heads Up!  Your quest NPC needs help!!!")
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
  Reply With Quote
06-22-09, 06:00 PM   #14
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Originally Posted by Akryn View Post
Oh I see, well just change it to this:


Very cool, and exactly what was needed. Thank you so very much. I realized I initially did ask for a script that would run when certain things were said...then upon researching even just a small handful of quests I began to realize just how impossible that would turn out to be, collecting the accurate quotes and emotes (of which there might be up to a dozen or so associated with any given quest, if the list of events from "The Sleeper Has Awakened" is any indication) when there is no realistic way I have of collecting the data myself for each and every one.

So what I would end up with then, is this, right?

Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfNames = {
     "Ringo",
     "Kerlonian Evershade",
     "Shay",
     "A-Me 01"
     --etc
}

me.EventHandler(self, event, _, name)
      for i = 1, #self.listOfNames do
           if name:find(self.listOfNames[i]) then
                 PlaySound("RaidWarning")
                 RaidWarningFrame:AddMessage("Heads Up!  Your quest NPC needs help!!!")
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
That is just about perfect...it works for both escort quests that have a "catch" (like needing to dump the water on the NPC) and regular escorts where the NPC has a phrase they speak or emote they perform when being attacked by wandering mobs or when encountering scripted fights along the way.

One question...what is the "_" supposed to be in the line?

Code:
me.EventHandler(self, event, _, name)
Thank you so very much for taking the time to help me. I think because of its simplicity, this is definitely the route to go. I admit, though, I'm ambitious enough to want to someday make it a little more customizable, in the manner of the second script you posted. If for no other reason than it would be fun to include customized warning for each specific NPC (like the "lazy druid" line in my earlier attempt.) But I suspect that is, in fact, beyond me.

Another thought just occurred to me...if you had this addon and someone else walked by you escorting one of the quest NPCs and the NPC spoke/emoted, would it trigger the addon? How difficult would it be to check that you're on the escort quest, and not just a bystander?

Last edited by Ambrya : 06-22-09 at 06:08 PM.
  Reply With Quote
06-22-09, 06:19 PM   #15
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
_ is just a common way of basically telling the game "I don't care about this" -- in this case, it's in the slot for the message, and we only care about the name.

I only actually posted two versions (well three now). The other posters weren't me.

If you'd like to add customisable phrases that's certainly doable. Note that in this version the {} are not optional, but the comma and second phrase are. If you omit that part, it will use the default:
Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfNames = {
     {"Ringo"},
     {"Kerlonian Evershade", "Darn it!  That lazy druid has fallen asleep again, use the horn!!!"},
     {"Shay"},
     {"A-Me 01"},
     --etc
}

me.EventHandler(self, event, _, name)
      for i = 1, #self.listOfNames do
           if name:find(self.listOfNames[i][1]) then
                 PlaySound("RaidWarning")
                 local msg = self.listOfNames[i][2] or "Heads Up!  Your quest NPC needs help!!!"
                 RaidWarningFrame:AddMessage(msg)
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
edit: matrix fail -_-

Last edited by Akryn : 06-22-09 at 06:36 PM.
  Reply With Quote
06-22-09, 06:25 PM   #16
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Another thought just occurred to me...if you had this addon and someone else walked by you escorting one of the quest NPCs and the NPC spoke/emoted, would it trigger the addon? How difficult would it be to check that you're on the escort quest, and not just a bystander?
Yes it would. Checking for that would add a *lot* of extra complexity, especially because you couldn't just check to see if you were on the quest, you'd have to make sure that you were actively doing the escort, which would involve writing code to detect the start/fail/success of each different escort (most would be made easier because the escort and quest are the same thing, but some of them aren't). Anyway, I wouldn't bother unless you want to actually get into addon coding, in which case it would be an interesting (although tedious) first project.

A workaround might be a slash command that toggled the announce on and off?
  Reply With Quote
06-22-09, 06:54 PM   #17
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Originally Posted by Akryn View Post
_ is just a common way of basically telling the game "I don't care about this" -- in this case, it's in the slot for the message, and we only care about the name.

I only actually posted two versions (well three now). The other posters weren't me.

If you'd like to add customisable phrases that's certainly doable. Note that in this version the {} are not optional, but the comma and second phrase are. If you omit that part, it will use the default:
You, sir, are brilliant, and if I didn't already have someone's kid, I'd offer to have your babies right about now. Thank you so much.

The only other script that has been posted (aside from my customizations of the scripts that have been posted) was basically just a slightly more compact version of your second script, which I butchered in essentially the same way as I did yours. Either way, this still really is the best one for my purposes. At this point I think perhaps the ONLY thing that might be problematic is quests where the NPC gets attacked but doesn't say anything, and well, hey, you can't be everything to everybody, right?

I think I'm going to do some research and add a few more quest NPCs to the list, and maybe post this and ask someone to take it for a test drive, since I don't have any characters able to do so right now.
  Reply With Quote
06-22-09, 06:58 PM   #18
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Originally Posted by Akryn View Post
Yes it would. Checking for that would add a *lot* of extra complexity, especially because you couldn't just check to see if you were on the quest, you'd have to make sure that you were actively doing the escort, which would involve writing code to detect the start/fail/success of each different escort (most would be made easier because the escort and quest are the same thing, but some of them aren't). Anyway, I wouldn't bother unless you want to actually get into addon coding, in which case it would be an interesting (although tedious) first project.

A workaround might be a slash command that toggled the announce on and off?
I suspect then we'd run into difficulty with people turning it off and forgetting to turn it back on again. Considering how rare it is to run into someone doing an escort at the exact moment the NPC speaks or emotes, and then to continue to be near that person long enough for it to be a persistent problem, I don't think it would be worth the trouble.
  Reply With Quote
06-22-09, 08:39 PM   #19
Ambrya
Premium Member
Premium Member
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 49
Hmmm....it doesn't work.

Tested it on a friend's toon just now, running the "The Sleeper Has Awakened" (Kerlonian Evershade) quest. First event took place, no RaidWarning sound, no message on the screen, nothing.

Here's what I have:

Code:
local me = CreateFrame("Frame")

me:RegisterEvent("CHAT_MSG_MONSTER_EMOTE")
me:RegisterEvent("CHAT_MSG_MONSTER_SAY")
me:RegisterEvent("CHAT_MSG_MONSTER_WHISPER")
--add any others...that's probably good enough

me.listOfNames = {
     {"Ringo", "Yo! The goblin has fainted, throw some water on him, quick!!"},
     {"Kerlonian Evershade", "Darn it!  That lazy druid has fallen asleep again, time to use the horn!!!"},
     {"Shay", "That dippy night elf girl is chasing butterflies again, better ring the bell and call her back."},
     {"A-Me 01", "The suicidal ape robot is charging off into the fray again, go defend her!"},
     --etc
}

me.EventHandler(self, event, _, name)
      for i = 1, #self.listOfNames do
           if name:find(self.listOfNames[i][1]) then
                 PlaySound("RaidWarning")
                 local msg = self.listOfNames[i][2] or "Heads Up!  Your quest NPC needs help!!!"
                 RaidWarningFrame:AddMessage(msg)
                 return
           end
      end
end

me:SetScript("OnEvent", me.EventHandler)
And my .toc is:

Code:
## Interface: 30100
## Title: Escort Event Alert
## Author:  Code by Akryn, quest identification and customization by Ambrya
## Notes:  Plays a sound and displays a warning message on screen when an event requiring attention occurs during certain escort quests.

escortalert.lua
The .toc appears to be okay...I can see the addon and its description in the list of addons on the character selection screen, it's up to date, everything seems to be in place...but nothing happens.
  Reply With Quote
06-22-09, 09:03 PM   #20
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
I don't know why I *always* forget to define functions as functions when I'm writing outside of a real text editor...something about the lack of syntax highlighting or something:

function me.EventHandler(self, event, _, name)

That's probably the only problem, but I'll test it out and post any other errors if I find them.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Perhaps a strange request...

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off