Forgot? Join

Scripting

LSL Guide

Every script function this grid actually runs, read straight from the region software rather than copied from a wiki — including the wolf* functions that exist only here.

Functions · Constants

wolfCollapse

Wolf Territories
integer wolfCollapse(vector blast_centre, float force, float restore_after)

Breaks the build this script is in into its separate prims in one go (like llBreakAllLinks, no script in every prim), lets them fall as temporary physical rubble with an optional outward blast (force in m/s at blast_centre, region coordinates; 0 = they just fall), and after restore_after seconds (10 to 3600) removes the rubble and puts the build back exactly as it was (its scripts start again from state_entry). Needs PERMISSION_CHANGE_LINKS from the owner; every prim must be copy and modify and every item in it copy for the owner; the owner must be allowed to build there. At most 128 pieces fall (the rest stay where they are), started over a few seconds. A build made of one mesh only topples as one piece. Returns 1, or 0 with wolfGetLastError saying why. Defined on Wolf_Api.wolfCollapse / WolfWreck.

Brings your build down for a show, a game or a disaster scene, and puts it back afterwards. In one go it breaks the build the script is in into its separate prims (like llBreakAllLinks, but you do not need a script in every prim), the pieces become physical rubble and fall, thrown outwards by a blast if you ask for one, and after restore_after seconds the rubble disappears and the build is put back exactly as it was: every prim where it stood, with the same keys and everything inside it. The scripts in the build start again from the beginning. It needs PERMISSION_CHANGE_LINKS from you (the owner). Because the build is put back from a copy, every prim must be copy and modify for you and everything inside it copy; you must be allowed to build on the land; and a group-owned (deeded) build cannot collapse. At most 128 pieces fall (the ones nearest the blast, or the highest ones if there is no blast), started a few at a time over a couple of seconds; any others stay where they are, as do prims too big to be physical, phantom prims and flexi prims. A build that is one single mesh only topples over as one piece. The rubble is always temporary and never stays behind. It works the same on every region, whichever physics engine it runs. If the region restarts while the build is down, the build is simply back after the restart. Returns 1, or 0 with wolfGetLastError saying why. Regions take it up as they restart onto the new release.

Parameters

TypeName What it does
vector blast_centre Where the blast comes from, in region coordinates (llGetPos() is the middle of the build). Not used when force is 0.
float force How hard the pieces are thrown outwards, in metres a second at the blast centre (less further away), 0 to 50. 0 = no blast: the pieces just fall.
float restore_after Seconds until the rubble goes and the build is put back, 10 to 3600 (an hour). wolfRestoreBuilding puts it back sooner.

Example

// Collapsing building - Wolf Territories, wolfCollapse / wolfRestoreBuilding.
//
// Put this script in your build (any prim of it; the root is easiest). Touch it to bring the
// whole build down: it breaks into its separate prims, they fall as rubble with a blast from the
// middle of the build, and two minutes later the rubble goes and the build is put back exactly
// as it was. Touch any piece of the rubble with this script in it to put it back straight away.
//
// Rules the grid keeps:
//  - only you (the owner) can do it, and you grant "link and delink" (PERMISSION_CHANGE_LINKS)
//    the first time;
//  - every prim must be copy and modify for you, and everything inside it copy (the build is put
//    back from a copy);
//  - you must be allowed to build on the land where it stands;
//  - at most 128 pieces fall; the rest stay where they are;
//  - a build that is one single mesh only topples over as one piece;
//  - the rubble is always temporary, and the scripts in the build start again from the beginning
//    when it is put back (so this one asks nothing again: it only asks when you touch it).

float BLAST = 10.0;        // metres a second at the middle; 0.0 = it just falls
float BACK_AFTER = 120.0;  // seconds until it is put back (10 to 3600)

integer down;

bringDown()
{
    if (wolfCollapse(llGetPos(), BLAST, BACK_AFTER))
    {
        down = TRUE;
        llOwnerSay("Down it comes. Back in " + (string)llRound(BACK_AFTER) + " seconds, or touch the rubble.");
    }
    else
        llOwnerSay("It will not collapse: " + wolfGetLastError());
}

default
{
    touch_start(integer n)
    {
        if (llDetectedKey(0) != llGetOwner())
            return;
        if (down)
        {
            if (!wolfRestoreBuilding())
                llOwnerSay("Cannot put it back: " + wolfGetLastError());
            return;
        }
        if (llGetPermissions() & PERMISSION_CHANGE_LINKS)
            bringDown();
        else
            llRequestPermissions(llGetOwner(), PERMISSION_CHANGE_LINKS);
    }

    run_time_permissions(integer perms)
    {
        if (perms & PERMISSION_CHANGE_LINKS)
            bringDown();
    }
}

Just let it fall, no blast, back after a minute

wolfCollapse(llGetPos(), 0.0, 60.0);
Energy 10

Ours alone. Grid features you will not find on any other OpenSimulator grid.

More in Wolf Territories