MontuZ wrote:
We want to get the events that are sent to the script while the script is doing something and not listening for events
And that's exactly what it does.
When process gots event, POL saves it into memory. I call it
queue, which is array of events sent to process. Using Wait_For_Event(x) POL will return first event from the
queue, no matter when it was send. And if
queue is empty, it will sleep x seconds waiting for one.
Wait_For_Event(0) checks if
queue is empty, and whether or not it is, returns immediately. That's why using the function I wrote one could swap the
queue from POL into the script process.
Tested it out using AI-script with enabled event SYSEVENT_SPEECH. First it slept for 10 seconds, while my character flooded various texts in game next to the npc. After 10 seconds, script called and printed out result of Get_Events_Queued(). Surprisingly every phrase I flooded while npc was sleeping printed into console.
Disclaimer: I do not really know how POL handles this stuff; what I told above is just a way I quess it works.