Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llDelay()

Kaneda Akebono
Junior Member
Join date: 7 Jun 2004
Posts: 14
06-15-2004 11:04
I would REALLY like to see an llDelay command. The effect would cause a delay between functions and allow the user to specify the delay as a floating number... something like...


llDelay(float num)

which would cause a delay equal to num. However, unlike llSleep... the user would still be able to act upon the object and trigger events. Timers aren't an ideal way to do this, and in a situation I have now the only solution is to use timers in conjunction with multiple states, which is much messier than a simple delay command. The next closest thing is llMinEventDelay, but only effects events, not functions. Please consider this addition. Thanks for your time.

-Kaneda
Carnildo Greenacre
Flight Engineer
Join date: 15 Nov 2003
Posts: 1,044
06-15-2004 19:17
You do realize that implementing this requires the LSL virtual machine to be re-written from the ground up to support multi-threading, don't you?
_____________________
perl -le '$_ = 1; (1 x $_) !~ /^(11+)\1+$/ && print while $_++;'
Kaneda Akebono
Junior Member
Join date: 7 Jun 2004
Posts: 14
06-16-2004 11:40
No I'm not much of a coder. I didn't realize such things. Seems like it'd be a very useful command though. Seems kinda silly that there is no way to impliment it as is.

-Kaneda
Moleculor Satyr
Fireflies!
Join date: 5 Jan 2004
Posts: 2,650
06-16-2004 18:22
You can actually emulate this at the moment.

Create a 'timer' variable that keeps track of when something occured. You can keep multiple ones for multiple threads.

Set a Timer event to happen every 0.1 seconds, or 0.5 seconds, or 1.0 seconds, or however often you want your script to check on the status of the multiple threads.

Set different if() events to trigger in the event of a certain amount of time passing between the variable's time and the present time. (Say you want something to happen every five seconds, you see if(variable + 5seconds >= PresentTime).)

Have the variables reset to the present time every time the event fires.

Voila. Multiple timered events. I generally use llGetAndResetTime and it's similar functions when I want only one or two 'threads'.
_____________________
</sarcasm>