Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Sim freindly scripts and objects question

Jesse Barnett
500,000 scoville units
Join date: 21 May 2006
Posts: 4,160
08-26-2006 09:14
I asked this question in the scripting forum but then I thought about getting feedback from one of the LL tech people:

Sim freindly scripts and objects question

--------------------------------------------------------------------------------

I am sloooowly getting better at scripting (pat on back). I am up at the noobie level now. heehee. But this also means I have more scripted objects on my parcel. It seems a waste to leave scripts running all the time. So which of the following would be better for simulator resources:

1)Leave the scripts running all the time.

2)Build listeners into the scripts to sense my presence and turn on.

3)Make each object touch on/off to activate the script.

4)Create one object touch activated that will turn on all the scripts

5)Create one object that listens for my presence and will turn on all the scripts

6)None of the above. Alternative suggestion.

7)OMG Jesse is a dumbass for even asking questions like these and wasting the forum resources :-O

A related question is on Objects. I don't care about my build if I am not in the sim. Is it better to do one of the above with objects? Leave them rezzed all the time or derez them if I am not there? If it would be better to derez them then that would open some new possiblities for this 512 land owner. I could then create a garden at ground level using a hundred or so prims to enjoy but then if I went up to to my build in the sky the garden would derez and my house would appear.
Andrew Linden
Linden staff
Join date: 18 Nov 2002
Posts: 692
08-27-2006 19:28
Option 3 probably has the lowest lag potential, but as far as I can tell in most forms it is a subset of option 1. The scripts have to be 'running' in order to detect touch events.

Options 3 isn't bad if the quiescent state of the scripts only have non-polling event handlers. By non-polling, I mean only touch events that require active outside intervention (touch, collision, add-to-contents), not events that require constant polling (listen, timer, sensor).

Lots of listeners (options 2, 4, and 5) will contribute to lag, especially if the listeners are promiscuous, that is if they listen for anybody saying anything on channel 0. You can make listeners more efficient by having them listen for specific words, speakers, messages, and/or non-zero channels.

Lots of scanners will contribute to lag (possibly option 2, depending on how you 'detect presence'). If you scan periodically with lengthy llSleep()'s in between each scan then option 2 might not be so bad.