Hey, does anyone know how to get information from the listener event? I used
RegisterEventListener(OBJECT_SELF,OBJECT_SELF,EVENT_TYPE_COMMAND_COMPLETE);
to listen to the command complete event, which works, but all the listener event fields are empty for me. That makes it difficult to react to the right commands only.
I intended to use the listener to avoid modifying any core scripts. Fortunately, there were other solutions for my task. I'm still curious though.
Listener event data?
Débuté par
Magic
, déc. 30 2009 02:47
#1
Posté 30 décembre 2009 - 02:47
#2
Posté 31 décembre 2009 - 12:26
assume you listen EVENT_TYPE_COMMAND_COMPLETE, is this what you tried ?
void main() { event ev = GetCurrentEvent(); int nEventType = GetEventType(ev); switch(nEventType) { case EVENT_TYPE_LISTENER: { int nLastCommandType = GetEventInteger(ev, 0); int nCommandStatus = GetEventInteger(ev, 1); int nLastSubCommand = GetEventInteger(ev, 2); object oLastTarget = OBJECT_INVALID; object oBlockingObject = GetEventObject(ev, 2); ... } } }
#3
Posté 17 janvier 2010 - 03:33
Oops sorry, I missed your answer somehow.
Yes, that's basically what I did. The commands after case EVENT_TYPE_LISTENER will be executed but as said, all the event data fields are empty (0 or "" or OBJECT_INVALID etc.) when retrieved by the GetEvent*() functions. So I wondered if you or anyone had success using it.
Yes, that's basically what I did. The commands after case EVENT_TYPE_LISTENER will be executed but as said, all the event data fields are empty (0 or "" or OBJECT_INVALID etc.) when retrieved by the GetEvent*() functions. So I wondered if you or anyone had success using it.
#4
Posté 18 janvier 2010 - 03:47
I tried it for 5 minutes and stopped when I saw it was not working
#5
Posté 18 janvier 2010 - 07:00
Hehe ok thanks. Hm I needed some more minutes but I'm just that naïve when I assume something should work. ^^
#6
Posté 03 février 2010 - 04:13
Does anyone have a final answer about EVENT_TYPE_LISTENER ?
The process of RegisterEventListener works fine but the event is "empty", contains no data about the listened event.
In the toolset description of RegisterEventListener we can read :
but no event data.
I tried to read value for -100 to 100 with GetEventInteger, Float, String, Object, Resource and got nothing.
Without these informations, there is nothing to do with EVENT_TYPE_LISTENER. It is a shame because I could improve mods compatibility a lot.
The process of RegisterEventListener works fine but the event is "empty", contains no data about the listened event.
In the toolset description of RegisterEventListener we can read :
Registers an object to listen to the specified event type on the target object. When an object is registered as a listener for an event type, whenever the target object receives an event of that type a listener event will be fired to the listening object with the event data that the listening object can then process.
but no event data.
I tried to read value for -100 to 100 with GetEventInteger, Float, String, Object, Resource and got nothing.
Without these informations, there is nothing to do with EVENT_TYPE_LISTENER. It is a shame because I could improve mods compatibility a lot.
Modifié par anakin5, 03 février 2010 - 04:13 .





Retour en haut






