Return Ring

Madi Perth

Member
Joined
Jul 12, 2020
Messages
66
SL Rez
2013
Don't you love it when someone takes a build with a 100+ prims and stuffs it back in your inventory as one fat ass mess that you have to rez and sort out? This happened to me several times now so I wrote this tool. Basically, drop this script in something, a 2m circle for instance, and any thing you put in the middle will be returned to your inventory one at a time. Making it easier to sort out.

C-like:
/*
* Copyright (c) 2022 Madi Perth (Madi Melodious).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/


/*
* Instructions
*
* Place the script into a normal prim, for the purpose of development and easi of use
* I found a 1.8 meter circle to be convenient.  Once the script is running and
* return permissions granted; place any compound object in the center of the circle,
* and touch the prim the script is in.  The script will script will scan the
* compound object and return each unlinked object one at a time.   Once the
* process of returning is complete it will Instant Message the toucher with a
* message that it has completed the return process.   Particle show indicates
* the script is working.
*
* Once the return process is complete you will find the objects in your lost and found.
* I have found that its best to start with a fresh login and watch so your Recent tab
* in your Inventory will be empty.
*
* Limitations
*
* There is a 2.5 second delay built in to the process so returned object are not
* clumped back together in your inventory.  Returning large collections of items
* can be time consuming.  You do not have to remain in the same Region for the
* Return process to complete.
*
* You are also limited by the number of prims available on parcel, of course.
*
* There are other limitations set by the llReturnObjectsByID() function of LSL.
* Those limitations can be found on the wiki page,
* http://wiki.secondlife.com/wiki/LlReturnObjectsByID.
*
* There is also a vaguely defined throttle limit on the number of items that
* can be returned per region per hour.  Once this limit is reached the script
* will sleep for one hour, and attempt to complete the process after this time.
* It will cycle in and out of the sleep cycle till its job is completed and
* all items are returned.
*/


integer detected_items;
key userID;


particles_control(integer ONOFF)
{
    /* Thank you Firestorm particle editor */
    if(ONOFF)
    {
        llParticleSystem(
        [
            PSYS_SRC_PATTERN,PSYS_SRC_PATTERN_EXPLODE,
            PSYS_SRC_BURST_RADIUS,1,
            PSYS_SRC_ANGLE_BEGIN,0.9,
            PSYS_SRC_ANGLE_END,3,
            PSYS_SRC_TARGET_KEY,llGetKey(),
            PSYS_PART_START_COLOR,<0.500000,1.000000,1.000000>,
            PSYS_PART_END_COLOR,<1.000000,0.000000,0.000000>,
            PSYS_PART_START_ALPHA,1,
            PSYS_PART_END_ALPHA,1,
            PSYS_PART_START_GLOW,0,
            PSYS_PART_END_GLOW,0,
            PSYS_PART_BLEND_FUNC_SOURCE,PSYS_PART_BF_SOURCE_ALPHA,
            PSYS_PART_BLEND_FUNC_DEST,PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA,
            PSYS_PART_START_SCALE,<0.500000,0.500000,0.000000>,
            PSYS_PART_END_SCALE,<0.300000,0.300000,0.000000>,
            PSYS_SRC_TEXTURE,"216cab90-9df7-0c6b-4b25-4dce8ba4763b",
            PSYS_SRC_MAX_AGE,0,
            PSYS_PART_MAX_AGE,5,
            PSYS_SRC_BURST_RATE,0.3,
            PSYS_SRC_BURST_PART_COUNT,15,
            PSYS_SRC_ACCEL,<0.000000,0.000000,0.000000>,
            PSYS_SRC_OMEGA,<0.000000,0.000000,0.000000>,
            PSYS_SRC_BURST_SPEED_MIN,0,
            PSYS_SRC_BURST_SPEED_MAX,0,
            PSYS_PART_FLAGS,
                0 |
                PSYS_PART_EMISSIVE_MASK |
                PSYS_PART_INTERP_COLOR_MASK |
                PSYS_PART_INTERP_SCALE_MASK
        ]);
      }
    else
    {
        llParticleSystem([]);
    }
}




default
{

    state_entry()
    {
        llRequestPermissions(llGetOwner(), PERMISSION_RETURN_OBJECTS);
    }

    touch_start(integer total_number)
    {
        llSensorRepeat("", NULL_KEY, (PASSIVE | ACTIVE), 1, PI, 2);
        userID = llDetectedKey(0);
        particles_control(TRUE);
    }

    run_time_permissions(integer perm)
    {
        if(perm & PERMISSION_RETURN_OBJECTS)
            llOwnerSay("Permissions Granted!");
    }

    no_sensor()
    {
        llInstantMessage(userID, "Return Complete, " + (string)detected_items + " items returned.");
        detected_items = 0;
        llSensorRemove();
        particles_control(FALSE);
    }

    timer()
    {
        llSetTimerEvent(0);
        llSensorRepeat("", NULL_KEY, (PASSIVE | ACTIVE), 1, PI, 2);
        particles_control(FALSE);
    }

    sensor(integer detected)
    {
        integer returnErr;

        llSay(PUBLIC_CHANNEL, llDetectedName(0));
        returnErr = llReturnObjectsByID((list)llDetectedKey(0));

        if(returnErr == ERR_GENERIC)
        {
            llSensorRemove();
            particles_control(FALSE);
            llSay(PUBLIC_CHANNEL, "Something didn't work.");
        }
        else if(returnErr == ERR_PARCEL_PERMISSIONS)
        {
            llSensorRemove();
            particles_control(FALSE);
            llSay(PUBLIC_CHANNEL, "Parcel Permissions do not allow operation.");
        }
        else if(returnErr == ERR_RUNTIME_PERMISSIONS)
        {
            llSensorRemove();
            particles_control(FALSE);
            llSay(PUBLIC_CHANNEL, "Script lacks the propper premission to allow operation.");
        }
        else if(returnErr == ERR_THROTTLED)
        {
            llSay(PUBLIC_CHANNEL, "Task has reached return limit, sleeping for 1 hour.");
            llInstantMessage(userID, "Task has reached return limit, sleeping for 1 hour.");
            llSensorRemove();
            llSetTimerEvent(3600);
        }

        detected_items++;
        llSleep(2.5);
    }
}
 

Free

Chatting with JFK Jr.
VVO Supporter 🍦🎈👾❤
Joined
Sep 22, 2018
Messages
22,913
Location
Moonbase Caligula
SL Rez
2008
Joined SLU
2009
SLU Posts
55565
Cris! Can we get a thread move, pretty please with pickles and sour cream?
 

Madi Perth

Member
Joined
Jul 12, 2020
Messages
66
SL Rez
2013
Oh, there is a code library. I didn' t notice that forum. Chrs can you please move this thread to right forum.