Thread Tools Display Modes
08-18-08, 05:01 PM   #1
Niightblade
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 21
Trigger events manually?

Is is possible to trigger an event manually for testing purposes?
  Reply With Quote
08-18-08, 06:45 PM   #2
Shirik
Blasphemer!
Premium Member
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2007
Posts: 818
Not literally, however you could always do something like

Code:
local f = CreateFrame("FRAME");
f:RegisterEvent("CHAT_MSG_ADDON");
f:SetScript("OnEvent", function(self, event, ...)
   if event == "CHAT_MSG_ADDON" then
      -- Handling code here
   end
end);

f:GetScript("OnEvent")(f, "CHAT_MSG_ADDON", --[[ All the params here ]]);
__________________
たしかにひとつのじだいがおわるのお
ぼくはこのめでみたよ
だけどつぎがじぶんおばんだってことわ
しりたくなかったんだ
It's my turn next.

Shakespeare liked regexes too!
/(bb|[^b]{2})/
  Reply With Quote
08-18-08, 07:13 PM   #3
Niightblade
A Fallenroot Satyr
AddOn Author - Click to view addons
Join Date: Dec 2006
Posts: 21
Hmm ok thanks for that. I don't suppose you have an example of the args that are parsed when SPELL_DISPEL_FAILED is triggered do you? Very hard to test something that fails so rarely

Last edited by Niightblade : 08-18-08 at 07:26 PM.
  Reply With Quote
08-19-08, 07:33 AM   #4
LBXZero
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 61
I know there are a few events that are fired from an API function, but not all of them. The only API function I know that fires a couple of events is UpdateSpells(), and those events are probably not what you want.

Although, I do have a suggestion for it. Have a saved variable that is specifically for specialize debugging. Every time the event occurs, add the parameter list to the saved variable. From there, you have test parameters to play with the function. I did something similar that was saving the list of keys in _G that are functions.

Last edited by LBXZero : 08-19-08 at 07:38 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Trigger events manually?


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