Hints & Tips: Those darned scripts!

Hints & Tips: Those darned scripts!

Before I begin this post I need to add a caveat: I am by no means an expert on scripting in Second Life. This post comprises mainly a few things I have learned over the course of my three years in SL. If you are knowledgable in this area and spot any glaring errors then please do drop a comment. Yelling at me and calling me a ‘script nazi’ (among other things) will achieve nothing, whereas constructive help (preferably with links that will help both me and my readers to understand the issue better) is always welcome :)

Have you ever had trouble teleporting? I don’t mean the usual ‘teleports are down’ issues; I mean sudden and random inability to get anywhere at all, which inexplicably goes away after a thumb-twiddling session at home where you change your look in some way or another. Or are your teleports slow and your subsequent movement around SL bogged down (well, even more so than usual)?

The culprit is most likely some scripted item you’re wearing. More pointedly, it’s probably a script-resize item you’re wearing. The first thing to try when your TPs are failing is to remove/replace any high-prim script-resize item that you may be wearing. On the whole, these tend to be: hair, jewellery, and footwear. Unless SL itself is experiencing problems, you’ll find this usually fixes most no-TP and slow TP issues.

Hop behind the cut to find out why this is the case, to find out why this could potentially be very important to you very soon, and to find out what you can do to mitigate the effect that it has on you.

Bear with me here. I know the first half of this post is a bit wall-o-text, but it’s worth paying attention to!

So why are script-resize scripts so bad? Well, not all of them are. Some of the very new ones (created in the later part of 2010) use a thing called a linkset resizer (which I’m not going to go into great detail about here). In short: the linkset resizer script is a single script that commands all of the linked prims in a set to resize (obvious, from the name, right?) Linkset resizer scripted items are the only resize-scripted items that are fine to wear in the light of what I’ll be discussing in this post. The ‘bad guys’ that we need to single out and deal with are the older resize-scripted items with a script in every single prim.

Why is that bad? Well, each time you arrive in a sim all of those scripts have an effect on that sim, which needs to register how many scripts are running in it. Ever notice that a sim ‘freezes’ whenever someone teleports in, so that you can’t move for several seconds? That’s exactly what’s happening there. A sim can usually handle several people in it wearing resize scripts, but if lots of them teleport in one after the other (for example, after a sale notice has gone out to a group) then the sim can begin to buckle under the sudden arrival of all those scripts (as well as all of the other things it has to register, such as textures and where each person’s attachments are, etc), and hey presto: you’re wading through molasses.

Noticing a link between that and the reason why your teleports may be failing or extremely slow? Yup: if you’re wearing script resize hair that contains 250 prims (with a script in each prim) then you’re dragging a lot of scripts around with you. Let me borrow the words of Pussycat Catnap, from her Getting Started in Second Life post:

The resize script is fairly small, typically 64kbs. But the hair is made by linking together 100 to 300 strands of hair. In the typical resize script, one copy of the script is needed per object. So that 64kb script suddenly becomes a 6.4mb to 19.2mb burden that must be checked every 10th of a second or so, 100 to 300 times, to see if anything is happening with it, sometimes by each person in the area if it was coded poorly enough…

No wonder your TPs are failing! So what’s to be done?

Well, the first thing you can do is get hold of a Script Impact Checker. Chalice Yao kindly wrote a script and instructions for making your own checker, here on the SLU forums. If you don’t want to make your own, I’ve done it for you. You can find free one and two avatar Script Impact Checkers at the Del Mar Store. The one-person checker is just two prims and the two-person checker is three prims. (Store owners can get a higher-prim free version for many more avatars, plus free full-perm copies of the linkset resizer from Ann Otoole’s store, Unique Needs.)

Once you have the checker, rez it in your home and stand close enough to it that you can see the floating text above it. You’ll see your own name, followed by the number of scripts you are wearing (this includes scripted HUDs on your viewer screen, not just scripts on your avatar’s body) and the script memory useage. Before we go any further, let me tell you why the amount and memory useage of scripts could be very important in the future…

It has been mooted for some time that Linden Lab will be introducing script limits, both for parcels of land and for avatars. Simplified, this means landowners may be able to set the maximum script amount and memory useage that will be allowed into their land per avatar, and if you exceed that amount… well, you could get booted straight home, or your scripted items may simply stop working altogether until you enter a parcel of land that has a greater per-avatar script number and memory allocation. Of course, these script limits may not come to pass, since there have been murmurings about them for almost two years without anything seeming to have happened, but the fact remains that even if they don’t come, lowering the amount of scripts you’re wearing will still help you, in that your TPs will be faster and not fail quite so often!

What’s a good average number of scripts? Here’s Chalice Yao:

As for how much memory a region has to allocate for scripts, if I recall correctly the number was 300mb. If your target amount of avatars in a region is 100, the guideline should be 2mb per avatar max, as that’d divide those 300mb in a 2/3 fashion to avatars..which is fair as they tend to use more memory than the scripts scattered in the sim. If the target amount is 50 avatars, 4mb should work.

And Chalice Yao again:

…simple guidelines I put up for myself personally when wearing/getting stuff:

Green happy happy joy joy state:
0-50 or less scripts
0-2MB of memory

Meh, could definitely be better, I ought to check how to reduce or get alternatives:
51-100 or less scripts
2-5MB of memory

The less the better of course. You will find that the average you get in some sims is above that 100 script mark, but it’s a mistake to just kick people out. Notify them, point out their usage, and actually help them identify the cause and problem attachments…the vast majority of people simple don’t remotely know how much scripts they wear, or memory they use. Often enough they are shocked to learn that their boots carry 200+ scripts, and afterwarsd flip out in glee when their TPs are much faster.

Now think back to Pussycat Catnap’s words:

The resize script is fairly small, typically 64kbs. But the hair is made by linking together 100 to 300 strands of hair. In the typical resize script, one copy of the script is needed per object. So that 64kb script suddenly becomes a 6.4mb to 19.2mb burden

19.2mb into 4mb ain’t gonna go, is it?

OK, so here is Mar. She’s put on some script resize jewellery (with scripts in each prim), and script resize shoes. (She should really have put on some script resize hair, just so you could see how bad things could potentially be. I may just do that at the end of the post, to show a before and after!) She’s also wearing a heavily-scripted Vista AO (animation override), the full version of Mystitool, and her own one-script sim lag HUD:

Altogether she is wearing 593 scripts with a total memory useage of 15,776k (or almost 16mb)! Slightly stunned by that? She really should have worn script-resize hair, too, y’know ;)

OK, so we need to get rid of some of those scripts. First, Mar made copies of her shoes (in case she ever needed to resize them to fit a different shape) and then she deleted the resize scripts from them. That brought her down to 525 scripts (removing 68 scripts) and 11,424k (11.4mb). That’s a bit better:

OK, the jewellery is next, and since this is high-prim stuff, this is where you’ll see the difference. You would notice a similar kind of difference with high-prim hair that contains resize scripts, too. So, Mar made some backup copies of her necklace, earrings, and bracelet and then deleted the scripts inside them. And WOW!

Total number of scripts now? Just 69 (which means the jewellery contained 456 scripts!) and a script memory useage of 4,128k (4mb). That’s one heck of a difference, but it’s still skating close to that allocation amount given above, so what else can we do?

OK, let’s remove the full version of Mystitool and switch it out for the freebie version. The full (paid-for) version has lots of fancy bells and whistles, but the main things I use it for are: radar, quick access to LMs, instant-rez posing stand, and flight assist. All of those (with the exception of the LM access) are also available in the free version, which contains far fewer scripts. The freebie Mystitool is available at Mystical Cookie’s store in Blumfeld:

So I’m using the freebie Mystitool, plus my own LM HUD (tutorial here) – or, if you keep your inventory well-organised, then the list of LMs in your Map View should work just as well!

UPDATE: These MystiTool totals will now be even lower, as Mystical Cookie has completely re-written the MystiTool to be much more script-economical. Thanks, Mystical!

So let’s see our total now:

Much better! We’re down to 34 scripts (having removed a further 35) and 1,926k (just under 2mb) of memory. At this level of scripts and memory useage you will definitely notice your TPs speeding up and failing a lot less. But… well, you know me. I like a challenge ;) I’m going to see if I can go lower.

In fact, I know I can, because there’s still that complex Vista AO on Mar’s HUD. The older AOs have less of a script impact, but because the new ones are created to attach to any point and have ‘fly-out’ menus that need to be able to work in any direction, they contain a lot more scripts. We’re getting pretty advanced here, and I’ll give you a tutorial on editing your AO very soon, but Mar pulled all of the animations from her Vista AO and put them into a free, seamless sit ZHAO-II. (A seamless sit ZHAO-II knows when you’re sitting on a poseball and automatically overrides your AO sit in favour of the poseball animation. This ZHAO-II also has the ‘sit anywhere’ feature that is incorporated into Viewer 2, but which users of older viewers such as 1.23 don’t have.)

That pulls the scripts down even further:

We’re now at 27 scripts (having removed another 14) and 1,632k (1.6mb). But, you guessed it: we can go even lower! Because the animations in her Vista AO are copyable, Mar also pulled them into a free classic ZHAO-II (without seamless sit, so you need to remember to switch off the AO when sitting on a poseball. It also doesn’t have the ‘sit anywhere’ feature). And here are her final numbers:

20 scripts (having removed a final 7 more) and 1,088k (just over 1mb) of script memory useage. And, if you’re using a third party viewer which has an AO built into it, you could bring your script total down even further by copying your animations into that instead.

Let’s go back to our initial numbers and compare them:

Remember, you don’t need to go as far as stripping your AO right down if you don’t want to. This is not a must-do thing, but it’s a good idea to check out some of your high-prim items, such as jewellery and hair, and see if you can lessen the load both for the sims you’re teleporting into, and especially for yourself!

Further info

How to delete resize scripts. It goes without saying that you should make backups of the scripted versions of whatever it is you’re working with, first of all! And only use this script deletion tutorial once you’ve resized the items to fit your avatar.

A note for newbies here: clicking ‘delete’ on that menu won’t delete the whole object; only the resize scripts inside it!


But you’re always telling me to reduce my inventory! How is making backups of everything I remove the scripts from going to do that?!

I know, tell me about it :( The best thing that I can suggest is to archive your backups somehow. Let’s say you have several hairstyles by one creator. Archive all of your scripted backups from that creator in one prim called something like Archive: scripted backups from [ name of hair store ] and then place those archive prims in a special ‘Scripted Hair Backups’ folder in the Hair section of your inventory. Or, if you have lots of fatpacks then make an archive prim for each fatpack and then archive all of those by store. It’s complex and fiddly and a pain in the butt, I know, but you can do it!

OK, I’ve removed all of my HUDs. My hair, jewellery, and shoes are all no-script, but that script checker is still telling me I’m wearing a couple of scripts. Where are they?

Are you wearing invisiprims with or in your shoes? Invisiprims are (as the name suggests) invisible prims that hide your avatar’s flesh, and are commonly used with many shoes to make them compatible with older viewers that don’t support the alpha layer feature that’s available in Viewer 2 and other third party viewers. Invisiprims are only invisible because they’re scripted, so I’ll bet that’s where your random scripts are. The only way you can get rid of them is to switch to a viewer that supports alpha layers. (Tip: If you’re on an alpha-supporting viewer but your footwear was made before alpha layers came into use and doesn’t include them, then snag the free pack of alpha layers that Imnotgoing Sideways is offering on SL Marketplace. If you need alpha layers for anywhere else, such as hands etc, try this free pack by Shady Accessories.)

C’mon, Linden Lab will never introduce script limits! Why should I bother with this nonsense?

You don’t have to bother with it at all. Just remember where you saw the post when your TPs next start failing ;)

Further reading

SLU forums: Script Load and clothing resizers

SLU forums: Educate me on script limits, please?

SLU forums: Simple sensor-based Avatar script-count/memory lister (script)

Second Life Commerce Forums: To all merchants selling scripted objects

Ann Otoole’s blog: Secrets of Second Life Lag

Second Life Wiki – LSL Portal: Linkset Resizer Script

Finally, I had trouble locating some script-resize hair in Mar’s inventory, as she’s cleared a lot of it out! I finally found some, so with some scripted jewellery, scripted shoes, complex AO, full Mystitool, and that scripted hair…

1013 scripts with a total script memory of 22,496k (22.5mb). Now that is why your teleports are lousy!

8 thoughts on “Hints & Tips: Those darned scripts!

  1. Wow, thanks for all this info, Mar!! One thing that dismays me is how much of my “dressy” jewelry is script heavy AND no mod, with no delete option. I have a folder full of jewerly I just can’t wear. And I had a big debate with a jeweler who continues to insist on making things like no mod necklaces with 250 scripts. Shoes, too. I can’t get the scripts out of many of my nicest prim feet shoes. There’s one brand in particular that I know you wear too where each shoe has around 26 non-removable scripts. Luckily there are stores selling products with low-lag options, though it can be a lot of work to find them. And hair is not a big deal….there’s a lot of gorgeous mod hair out there.

    1. One of the main reasons creators do that, AK, is in the mistaken belief that by inserting no-mod scripts into their items, any Copybot thief won’t be able to recreate them. Thinking on from that will give you why those scripts are un-deletable: if they can be deleted, so the reasoning goes, then the items will become Copybot-able.

      Further reading on that matter: http://nexisonline.wordpress.com/2009/12/15/top-10-copybot-myths/

      I know what you mean about the shoes :( What we’ll have to do if the script limits come in and we want to continue wearing them is to de-script everything else, just to keep wearing the shoes. It is do-able (I’m currently working on a small utility HUD that I’ll be giving away which should come in at less than 10 scripts but will cover: radar, sim lag stats, LM giver, script counter, flight assist, and ZHAO-II) but it’s going to be a pain in the butt, regardless. Hopefully, all of those creators will soon cotton on to the linked prim resizer script instead, although for the stuff we already have it’ll be too late.

      1. What really cheeses me off about all the jewelry I have that’s so heavily scripted is that I have never needed a resize script in jewelry. Ever. I have an average sized avatar, and other than needing to move a necklace down/back a little, it just fits. So the jewelry is wasted for nothing.

        I look forward to your utility HUD!!

  2. Thanks for this post! I picked up your script counter and went through a lot of my favorite avs/clothes. Some unhappy discoveries. All of J’s toe shoes – 50 scripts each and no-mod. Grendel’s bird avatars – 200+ scripts and can’t be removed without breaking the avatar. Tekelili hair and jewelry, thankfully, either mod or with a delete script. I wonder what creators of fancy avatars like big dragons and the like will do?

    1. I really don’t know, Galena. It’s one thing to replace resize scripts with the linkset resizer, but when it comes to scripts that actually drive the function of an object (such as an avatar or vehicle or weapon, etc) I’m stumped. One option you have is to recompile the scripts in LSL instead of Mono. LSL scripts use less memory than Mono scripts (an example is the little utility HUD that I’ve been working on. Compiled in LSL it has a memory useage of 128k, but compiled in Mono the memory useage shoots up to 320k). While you’ll still have the same quantity of scripts in the items, they will use up less memory in the simulator (which is hopefully what any putative script limits will operate under), but that’s about all I can think of that you can do :(

  3. OK I’m gonna be blunt. Kalnins has a beautiful boot on sale this weekend, half off. I tried on the demo and did a script count on it….60. In one boot. *cries a little*

    1. I have those boots, AK. In fact, when Kalnins gave out a 50% off card for the New Year I bought up every single pair of shoes and boots that I didn’t already have. So I feel your pain there. I just wish they were modifiable :(

      One good bit of news is that I hopped to Hoorenbeek today and noticed that their latest release of sneakers now uses the linkset resizer script, so I think word is starting to get out to the major creators out there. Hopefully it won’t be long before everyone is using it, and given that it’s completely free (as opposed to costly full-perm resizers made for creators to use in their wares) it’s definitely a more cost-effective option for all creators!

Comments are closed.

Comments are closed.