Thread Tools Display Modes
01-25-24, 10:37 PM   #1
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 111
Game event

Hi all. There is a game event.

1) And there are prescribed text tasks.
2) There is a date file that already contains all these texts.

How can I make an addon react when certain text appears on an event?

I can do this with emotion via CHAT_MSG_MONSTER_EMOTE and with NPC messages via CHAT_MSG_MONSTER_SAY. What to do with an event? I can do it if I write in the chat. What if you don’t write?

Screenshot of the event.
  Reply With Quote
01-25-24, 11:13 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
It depends on what tasks you want to do. Keep in mind things like moving, casting a spell, using abilities, etc are protected actions and can't be run autonomously.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
01-25-24, 11:59 PM   #3
Hubb777
A Flamescale Wyrmkin
 
Hubb777's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2024
Posts: 111
Originally Posted by SDPhantom View Post
It depends on what tasks you want to do. Keep in mind things like moving, casting a spell, using abilities, etc are protected actions and can't be run autonomously.
Hello. I want this or that task to happen. A direction arrow appeared to show where to perform.

I think one of the lines is responsible for this:
DISPLAY_EVENT_TOASTS
DISPLAY_EVENT_TOAST_LINK
SCENARIO_UPDATE

Last edited by Hubb777 : 01-26-24 at 12:18 AM.
  Reply With Quote
01-26-24, 05:58 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,934
At the most basic, the following allows you to monitor specific events and handle what to do when they trigger. This code in a lua file and the addon's toc file will be a simple addon.

Just replace < EVENT # > tags with a particular event name and add the appropriate code. For example I am just printing the event name and it's arguments. Just add a new else if section for each new event you want to watch and react to.

But, like SDPhantom said, there are restrictions to what you are allowed to do.

Lua Code:
  1. local eventWatcher = CreateFrame("Frame")
  2.  
  3. local function OnEvent(self,event,...)
  4.     local args = { ... }
  5.    
  6.     if event == "< EVENT 1 >" then
  7.         -- What to do if this event triggers
  8.         print(event,...)
  9.  
  10.     elseif event == "< EVENT 2 >" then
  11.         -- What to do if this event triggers
  12.         print(event,...)
  13.  
  14.     end    
  15.    
  16. end
  17.  
  18. eventWatcher:SetScript( "OnEvent", OnEvent );
  19. eventWatcher:RegisterEvent( " < EVENT 1 >" );
  20. eventWatcher:RegisterEvent( " < EVENT 2 >" );
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Game event


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