Jump to content

Event handling possible?


Bugreporter

Recommended Posts

Hi,

is it possible to add event handling in a fight class ?

In this sample someone shout "Hero" and the mage/shaman/whatever cast Bloodlust/Timewarp/whatever.

    local frame=CreateFrame("Frame");  --[[Need a frame to capture events]]
    frame:RegisterEvent("CHAT_MSG_SAY"); --[[Register our event]]
    frame:SetScript("OnEvent",function(self,event,msg)  --[[ OnEvent handler receives event triggers ]]
		if event=="CHAT_MSG_SAY" and msg=="HERO" then  --[[ Someone sends "HERO" in /say ]]
			hero=SpellInfo(2825)
			CastSpellByName(Hero)
        end
    end);

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...