Zorphin Zadark
Registered User
Join date: 29 Nov 2008
Posts: 11
|
10-01-2009 07:18
I have an object which sends a link message to a prim every 0.25 seconds. In response to this message the prim perfoms an llSetPos which, of course delays the script by 0.2 seconds.
In laggy sims of course, the messages are getting queued and the whole process is getting behind and out of sync.
Is there any way that the target prim, when reacting to the link_message event can discard events if there are more than one in the queue? Basically, when the event is triggered I only want the prim to respond to the last (most recent) event to be added to queue if there are more than one event waiting, and thus to keep it in synch by "skipping frames" if needed.
thanks, ZZ
|
Destiny Niles
Registered User
Join date: 23 Aug 2006
Posts: 949
|
10-01-2009 08:30
Changing states may work. It clears alot of things, I know it don't clear all queues, but it does some of them and the linkmessage might be one. Give it a try.
|
Meade Paravane
Hedgehog
Join date: 21 Nov 2006
Posts: 4,845
|
10-01-2009 08:35
You could also have the child prim, the one that's doing the moves, just set a global variable when it gets the link message and use a timer to actually do the moves.. Something like: vector gDestination = ZERO_VECTOR;
default { state_entry() { llSetTimerEvent (0.5); }
link_message(integer from, integer cmd, string message, key id) { gDestination = (vector)message; }
timer() { if (gDestination != ZERO_VECTOR) { llSetPos (gDestination); gDestination = ZERO_VECTOR; } } }
_____________________
Tired of shouting clubs and lucky chairs? Vote for llParcelSay!!! - Go here: http://jira.secondlife.com/browse/SVC-1224- If you see "if you were logged in.." on the left, click it and log in - Click the "Vote for it" link on the left
|
Zorphin Zadark
Registered User
Join date: 29 Nov 2008
Posts: 11
|
10-01-2009 09:10
Thanks to both of you.
I had considered similar options to both of these, but was trying to get the child prim to do as little as possible so it could do what it had to do as quickly as possible - but I will experiment a bit more in those directions if no one knows of a way to just pull the last event from the queue.
thanks
|
Indeterminate Schism
Registered User
Join date: 24 May 2008
Posts: 236
|
10-02-2009 05:14
Except by changing state to clear the event queue, as said aboce, you can't manipulate it at all, so that's out. Alternatively - have the linked-prim send a 'ready' message when it is, er, ready. Your main prim then only sends commands on request. If you're synchronising or skipping frames like this you may want to track/communicate how many frames have passed/to process rather than just 'tick'.
[Edit:] It's unlikely to be useful to you but for the record we can use llMinEventDelay( float delay ); to 'slow' the event queue. Almost the complete opposite of what you want, sadly.
|