Stopping LSL scripts running in the wrong object


I’ve been dusting off a very old project in Second Life and giving it a fresh coat of pixels (details to follow) where I wanted to use llRemoteLoadScriptPin to load scripts into objects as I rez them. It would however cause odd things to happen if these scripts ran in the object doing the rezzing, so here’s how I stop them:

default 
{
    state_entry()
    {
        // Check whether we should be running...
        integer disable_marker = llGetInventoryType("DisableScripts");
        if(disable_marker != INVENTORY_NONE)
        {
            state disabled;
        }

        // ... the real code
    }
}

state disabled
{
    state_entry()
    {
        llSetScriptState(llGetScriptName(), FALSE);
        // Nothing else in this state so it shouldn't matter if the
        // script doesn't stop immediately
    }
}

So the script magically stops running if I put it in any object that contains a notecard with the name DisableScripts, which seems to work pretty well.

Advertisement

Simple Second Life building exercise


I’ve been working on a simple building exercise again recently. The basic idea is to give a taster of all the elements involved when building in Second Life, from prims to simple scripts, in the form of a trail with instructions on how to build a futuristic chair. Hopefully after completing the exercise people will be able to get more out of other much more detailed resources available, like the Ivory Tower of Prims, and (if all went well) a working chair! I have only just had the chance to work on a few of the suggestions I received after trying the trail out on a few guinea pigs at a recent hackday and I hope to get a bit more done at the weekend. If you pass through the IBM Sandbox and find the trail out there while I attempt to get it finished off, I would be very interested to know if you have any comments or suggestions.

Building Trail