Skip to content

Listen Events

ρMain edited this page Feb 27, 2018 · 3 revisions

Want to listen specific events?

Simply use the following function. You can listen multiples events and apply a function as callback when they are fired.

  • Callback prototype: function(self, event, arg1, type, srcGuid, srcName, arg2, targetGuid, targetName, arg3, spellId, object, x, y, z);
-- Register an event list and associate a script(
function RegisterEvents(eventArray, filters, enabled, script);

RegisterEvents({PLAYER_TOTEM_UPDATE}, nil, true, -- true to enable the feature
	function(_, _, _, _, _, srcName, _, _, _, _, _, player_unit, posx, posy, posz)
		print("The player "..srcName.." spawned or destroyed a totem")
	end
)
Clone this wiki locally