Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
addEvent and function of class
#4
You can write your own EventHandler, which can call the function from objects too. What you need send to him it sholud be name of function as string, and object address (in class just send "this")

my EventHandler work like that


Code:
evetns_onHit <- EventHandler(); //Global object

function onHit(targetID, killerID){
events_onHit.call(targetID, killerID);
}


And i add to him like this


Code:
in class
function hookCallbacks(){
events_onHit.add("myOwnOnHit", this);
}

function myOwnOnHit(targetID, killerID){}
Reply


Messages In This Thread
RE: addEvent and function of class - by Galin - 23.05.2016, 08:51

Possibly Related Threads…
Thread Author Replies Views Last Post
  items and items.xml Utautai 2 2,444 12.09.2020, 21:51
Last Post: Utautai
Question Diagonal and PPI Osmith 0 1,957 21.04.2016, 11:44
Last Post: Osmith
  callClientFunc and giveItem Osmith 4 4,409 18.02.2016, 13:04
Last Post: Bimbol
  Database and other Question (new team) Kemi 18 12,258 09.02.2016, 22:23
Last Post: Kemi

Forum Jump:


Users browsing this thread: 1 Guest(s)