Currently if we need to set a timeout for script logic, a timer event needs to be created to check the status of the script logic. If multiple logical timeouts are needed concurrently, a more constant, fast(er), timer needs to be created to loop through each logic condition and determine if a timeout for each has occurred.
I propose a new Function/Event pair. A function to setup a timeout condition, and an event that would be raised when this condition is met. Scripting wise, it'd be a matter of simply calling the function to turn on a timeout check and responding to the Event if it's raised. The calling function will be used to turn off the timeout check if the script logic dictates. See examples below.
Function:
llExpire(string Event_tag, integer duration_in_seconds) -- if Duration is 0 or a negative number, remove that event tag.
to turn on an expire event:
> llExpire("listener_01", 30);
to turn off a defined expire event:
> llExpire("listener_01", 0);
provided that an expire tag has not raised the Expired Event,
it can be reset with a new value (this would turn off/remove
the event tag and apply it again in one step)
> llExpire("listener_01", 15);
Setting multiple timout event would a simple as:
> llExpire("listener_01", 30);
> llExpire("change_color", 15);
> llExpire("rotate_object", 60);
Event handling would be as follows.
Event:
Expired(string tag)
Example in use would be
> Expired(string Tag)
> {
> if (Tag == "listner_01")
> { // do the things desired on timeout; }
> }
if two timeout events expire at the same time, two Expired event would be queued up, one after the other, to simply logic.
Additional notes:
Any timeouts defined by the llExpire would only raise one event then be discarded.
Alternatively, it maybe that llExpire events could be made to repeat on the defined interval and it'd up to the script to turn off a given expire tag in the Expired Event if needed. This would prevent the timeout from being lost if the even queue got over filled.