LSL functions you should NEVER call

Creating scripts
Graham Mills
Posts: 1314
Joined: Sun Dec 23, 2012 2:26 pm
Has thanked: 1134 times
Been thanked: 1141 times

Re: LSL functions you should NEVER call

Post by Graham Mills »

Not sure whether it will help here but I saw from HGBiz that there's a move to implement the Phlox script engine used in Inwz.

I noticed in the thread there that there were some adverse comments about llSetTimerEvent as well as llSleep so I thought I would have a look albeit on a limited scale. Firstly, however, I had a look at llSleep. I don't know how useful it is as an observation but my experience with 24 scripts running was that llSleep was OK up to 30 sec but no good thereafter (subsequent commands were not executed). This was true even for a single script so far as a 50 sec sleep was concerned. However, even then the 24 llSleep scripts (mostly 30 sec but including one incremented to 50 sec) failed to interfere with llSetTimerEvent running separately for 70 sec in a further 12 scripts. I didn't confirm the accuracy of the intervals but I suspect it wasn't entirely as one might naively have expected.

I'm not saying that I'd recommend using llSleep but I'd certainly avoid it for intervals longer than 30 sec. Incidentally, it may be that the commenter was referring to 0.9 -- it wasn't clear.
User avatar
Handy Low
Posts: 231
Joined: Fri Nov 08, 2013 3:38 pm
Location: Yorkshire, England
Has thanked: 207 times
Been thanked: 140 times
Contact:

Re: LSL functions you should NEVER call

Post by Handy Low »

The problem with long sleeps is that they can make the event they're in exceed the maximum time allowed for an event. In that case, the event is killed and, as you say, subsequent commands are not executed. This would also happen if, for example, you had a loop that took a long time to execute - it's not a problem with the llSleep() function per se.

I'm not actually sure what the value for the maximum event time is in Kitely, but 30 seconds seems about right.
Handy Low
User avatar
Alexina Proctor
Posts: 97
Joined: Sun Mar 16, 2014 2:32 am
Has thanked: 773 times
Been thanked: 112 times
Contact:

Re: LSL functions you should NEVER call

Post by Alexina Proctor »

Is llSleep() still a problem in the current OS version?
--Alexina Proctor
Co-founder with Prax Maryjasz of Sendalonde Community Library
Library: hop://grid.kitely.com:8002/Wellspring
https://virtualpeers.com/
User avatar
Ilan Tochner
Posts: 6504
Joined: Sun Dec 23, 2012 8:44 am
Has thanked: 4943 times
Been thanked: 4455 times
Contact:

Re: LSL functions you should NEVER call

Post by Ilan Tochner »

Yes Alexina, it is on Xengine (which is what Kitely uses).
These users thanked the author Ilan Tochner for the post:
Alexina Proctor
User avatar
Christine Nyn
Posts: 71
Joined: Sat Mar 07, 2020 10:20 pm
Has thanked: 218 times
Been thanked: 126 times

Re: LSL functions you should NEVER call

Post by Christine Nyn »

The main problem with using llSleep is that it quite literally sleeps. It suspends all operation on that script thread in the simulator but it doesn't free the thread up for other scripts to use as llSetTimerEvent would do. Get a few of those on a sim and the whole thing will grind to a halt as other scripts are denied access to resources that allow them to function. If, as in the OP, the "sleep" is 30 seconds or longer the script will be stopped in any case as it exceeds the standard OS event time-out limit.
These users thanked the author Christine Nyn for the post (total 3):
Ilan TochnerTess JuelAlexina Proctor
Post Reply