Difference between revisions of "User:Fred Gandt/Scripts/Continued 1"

From Second Life Wiki
Jump to navigation Jump to search
(→‎L$ Gift Giver ( V2 ): a bit reformatting and renaming of variable names to improve readability, added resets to second state)
(Same)
Line 17: Line 17:
All my scripts are written for compilation as '''[[Mono|MONO]]'''
All my scripts are written for compilation as '''[[Mono|MONO]]'''


=== More Pages ===
=== More Pages ===  


'''[[User:Fred_Gandt#Direct_Links_to_Scripts | Direct Links To All Individual Scripts]]'''
'''[[User:Fred_Gandt#Direct_Links_to_Scripts | Direct Links To All Individual Scripts]]'''
Line 54: Line 54:


{{Anchor|L$ Gift Giver}}
{{Anchor|L$ Gift Giver}}
=== L$ Gift Giver ( V3 ) ===
=== L$ Gift Giver ( V2 ) ===


'''TAKE CARE WITH THIS ONE. IT WILL DEDUCT L$ FROM YOUR ACCOUNT ONCE YOU GRANT PERMISSIONS.'''
'''TAKE CARE WITH THIS ONE. IT WILL DEDUCT L$ FROM YOUR ACCOUNT ONCE YOU GRANT PERMISSIONS.'''
Line 60: Line 60:
The script will give a gift of the stated amount of L$ to whoever touches the object it is in. The money will be deducted from the object owner's account. Only one gift will be given to each agent and only if the total amount given since the last time permissions were granted has not been maxxed. Once the amount given is equal to the total stated, the script will enter a quiet state and wait to be reset.
The script will give a gift of the stated amount of L$ to whoever touches the object it is in. The money will be deducted from the object owner's account. Only one gift will be given to each agent and only if the total amount given since the last time permissions were granted has not been maxxed. Once the amount given is equal to the total stated, the script will enter a quiet state and wait to be reset.


<lsl>
<lsl>// V2 //
// version 3


integer total = 100; // Total amount the script is allowed to give away.


integer amountOfLindenDollarsPerGift = 1;
integer gift = 1; // Amount to give per gift.
integer totalAmountOfLindenDollarsToGiveAway = 100;


/////////////////////////////////////////////


// _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
key owner; // Used to store the owners UUID.
//  _/_/_/_/_/_/_/ ~!~ DO NOT CHANGE ANYTHING BELOW ~!~ _/_/_/_/_/_/_/_/_/_/_/_/
//  _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
 
 
key ownerKey;


integer amountOfLindenDollarsAlreadyGivenAway;
integer perms; // Used to store if permissions were granted.


list keysOfAvatarsThatHaveBeenGivenAGift;
integer given; // Used to count the total amount given.


list agents = []; // Used to store the UUIDs of the agents who have had a gift.


default
default
{
{
     on_rez(integer start_param)
     on_rez(integer param)
     {
     {
         llResetScript();
         llResetScript(); // Clear all lists and reset all variables. This action will also clear the permissions.
     }
     }
     changed(integer change)
     changed(integer change)
     {
     {
         if (change & CHANGED_OWNER)
         if(change & CHANGED_OWNER) // If the script or object changes ownership the script will not be able
            llResetScript();
        llResetScript();           // to deduct cash from the previous owners account.
     }
     }
     state_entry()
     state_entry()
     {
     {
         ownerKey = llGetOwner();
         owner = llGetOwner(); // Store the owners key.
 
         llRequestPermissions(owner, PERMISSION_DEBIT); // !! THIS MEANS IT WILL TAKE YOUR MONEY !!
         llRequestPermissions(ownerKey, PERMISSION_DEBIT);
     }
     }
     run_time_permissions(integer perm)
     run_time_permissions(integer perm)
     {
     {
         if (perm & PERMISSION_DEBIT)
         if(perm & PERMISSION_DEBIT) // Have we got the permissions we requested?
            llOwnerSay("Ready now!");
        perms = TRUE; // Store the result of success.
         else
         else
            llRequestPermissions(ownerKey, PERMISSION_DEBIT);
        llRequestPermissions(owner, PERMISSION_DEBIT); // If not we ask for them again.
     }
     }
 
     touch_start(integer nd)
     touch_start(integer num_detected)
     {
     {
         key touchingAvatarKey = llDetectedKey(0);
         while(nd && (given < total) && perms) // Have we got permissions? Have we given less than the total allowed?
        integer perm = llGetPermissions();
 
    //  stop when the avatar has already been given a gift
        if (~llListFindList(keysOfAvatarsThatHaveBeenGivenAGift, [touchingAvatarKey]))
            return;
 
    // stop when no more money left
        if (totalAmountOfLindenDollarsToGiveAway <= amountOfLindenDollarsAlreadyGivenAway)
         {
         {
             state NO_MORE_MONEY_LEFT;
             key agent = llDetectedKey(--nd); // grab the UUID of the touching agent.
            return;
            if(llListFindList(agents, [agent]) == -1) // Have we already given a gift to this agent?
        }
            {
 
                agents += [agent]; // Add the agent to the list.
    // stop when permissions have not been granted
                llGiveMoney(agent, gift); // Give the gift to the agent who touched us.
        if (!(perm & PERMISSION_DEBIT))
                if((given += gift) == total) // Increment the amount given by the amount just given and check if we have maxxed out yet.
        {
                state maxxed_out; // If maxxed out, go to a state with no touch_ event so we are not repeatedly messaged.
            llInstantMessage(touchingAvatarKey, "Sorry, this device has not been granted permissions to work correctly.");
            }
            return;
        }
 
    // stop when not enough memory left to store new keys
        if (llGetFreeMemory() < 2000)
        {
            llInstantMessage(ownerKey, "Memory limit has been reached. Deactivating now...");
            state NO_MORE_MONEY_LEFT;
            return;
        }
 
        keysOfAvatarsThatHaveBeenGivenAGift += [touchingAvatarKey];
        llGiveMoney(touchingAvatarKey, amountOfLindenDollarsPerGift);
        amountOfLindenDollarsAlreadyGivenAway += amountOfLindenDollarsPerGift;
 
    // check how much money left
        if (totalAmountOfLindenDollarsToGiveAway <= amountOfLindenDollarsAlreadyGivenAway)
        {
            state NO_MORE_MONEY_LEFT;
    //     return;
         }
         }
     }
     }
}
}
 
state maxxed_out
state NO_MORE_MONEY_LEFT
{
{
    on_rez(integer start_param)
    {
        llResetScript();
    }
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
     state_entry()
     state_entry()
     {
     {
         llInstantMessage(ownerKey, "I have given away all the money. "
         llInstantMessage(owner, "The total amount this object can give away has been given." + // Contact the owner.
                    + "Please reset my scripts to allow "
                                "\nTo allow more to be given the script must be reset.");
                    + "money being given away again.");
     }
     }
 
}</lsl>
    touch_start(integer num_detected)
    {
        touchingAvatarKey = llDetectedKey(0);
 
        llInstantMessage(touchingAvatarKey, "Device has been disabled.");
    }
}
</lsl>


=== Linked Multi-Prim Drawers (2 scripts) ( V4 ) ===
=== Linked Multi-Prim Drawers (2 scripts) ( V4 ) ===
Line 211: Line 153:
==== Drawer Script ====
==== Drawer Script ====


<lsl>
<lsl>// V4 //
// version 5
// this script needs to be named "Linkypooz"


// This script needs to be named "Linkypooz".
vector open_pos;
vector open_pos;
vector closed_pos;
vector closed_pos;


rotation open_rot;
rotation open_rot;
rotation closed_rot;
rotation closed_rot;
 
key ownerKey;
integer OPEN;
integer doorIsOpen;
 
key owner;
integer my_response_num;
integer my_response_num;
integer my_link_num;
integer my_link_num;
 
Drawer()
Drawer()
{
{
    doorIsOpen = !doorIsOpen;
     if(OPEN)
 
    llSetPrimitiveParams([PRIM_POSITION, closed_pos, PRIM_ROTATION, (closed_rot / llGetRootRotation())]);
     if (doorIsOpen)
//  {
        llSetLinkPrimitiveParamsFast(LINK_THIS,
            [PRIM_POSITION, closed_pos,
            PRIM_ROTATION, (closed_rot / llGetRootRotation())]);
//  }
     else
     else
//  {
    llSetPrimitiveParams([PRIM_POSITION, open_pos, PRIM_ROTATION, (open_rot / llGetRootRotation())]);
        llSetLinkPrimitiveParamsFast(LINK_THIS,
    OPEN = (!OPEN);
            [PRIM_POSITION, open_pos,
            PRIM_ROTATION, (open_rot / llGetRootRotation())]);
//  }
}
}
 
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         ownerKey = llGetOwner();
         owner = llGetOwner();
         closed_pos = llGetLocalPos();
         closed_pos = llGetLocalPos();
         closed_rot = llGetLocalRot();
         closed_rot = llGetLocalRot();
Line 255: Line 192:
         my_response_num = ((integer)llGetSubString(llGetLinkName(my_link_num), 7, -1));
         my_response_num = ((integer)llGetSubString(llGetLinkName(my_link_num), 7, -1));
     }
     }
 
     touch_start(integer nd)
     touch_start(integer num_detected)
     {
     {
         key id = llDetectedKey(0);
         if(llDetectedKey(0) == owner)
 
        if (id == owner)
         {
         {
             if(my_link_num != 1)
             if(my_link_num != 1)
Line 266: Line 200:
                 open_pos = llGetLocalPos();
                 open_pos = llGetLocalPos();
                 open_rot = llGetLocalRot();
                 open_rot = llGetLocalRot();
                 llSetLinkPrimitiveParamsFast(LINK_THIS,
                 llSetLocalRot(closed_rot);
                    [PRIM_POSITION, closed_pos,
                llSetPos(closed_pos);
                    PRIM_ROTATION, (closed_rot / llGetRootRotation())]);
 
                 state normal;
                 state normal;
             }
             }
             else
             else
//          {
            llRemoveInventory(llGetScriptName());
                llRemoveInventory(llGetScriptName());
//          }
         }
         }
     }
     }
}
}
state normal
state normal
{
{
Line 286: Line 215:
         llOwnerSay("/me is active!");
         llOwnerSay("/me is active!");
     }
     }
 
     touch_start(integer nd)
     touch_start(integer num_detected)
     {
     {
         llMessageLinked(LINK_SET, my_response_num, "", NULL_KEY);
         llMessageLinked(LINK_SET, my_response_num, "", "");
     }
     }
 
     link_message(integer sender, integer num, string str, key id)
     link_message(integer sender_num, integer num, string str, key id)
     {
     {
         if(num == my_response_num)
         if(num == my_response_num)
            Drawer();
        Drawer();
     }
     }
}
}</lsl>
</lsl>


==== Script Delivery Script ====
==== Script Delivery Script ====
Line 598: Line 524:


{{Anchor|Touch Texture Getter}}
{{Anchor|Touch Texture Getter}}
==== Touch Texture Getter ( V3 ) ====
==== Touch Texture Getter ( V2 ) ====


Put this script in the root prim of an object and touch whichever face of whichever prim you want the texture UUID of. It will be chatted to you. If you do not have permission to get the UUID you will not get it! A long held touch will delete the script.
Put this script in the root prim of an object and touch whichever face of whichever prim you want the texture UUID of. It will be chatted to you. If you do not have permission to get the UUID you will not get it! A long held touch will delete the script.


<lsl>
<lsl>// V2 //
//  version 3
   
 
integer tc;
integer tc;
 
key owner;
key owner;
 
default
default
{
{
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
            llResetScript();
    }
     state_entry()
     state_entry()
     {
     {
         owner = llGetOwner();
         owner = llGetOwner();
     }
     }
 
     touch_end(integer nd)
     touch_end(integer num_detected)
     {
     {
         key id = llDetectedKey(0);
         while(nd)
        integer link = llDetectedLinkNumber(0);
        integer face = llDetectedTouchFace(0);
 
        if (id == owner)
         {
         {
             tc = FALSE;
             if(llDetectedKey(--nd) == owner)
            list prim_params = llGetLinkPrimitiveParams(link, [PRIM_TEXTURE, face]);
            {
 
                tc = 0;
            llOwnerSay( llList2String(prim_params, 0) );
                llOwnerSay(llList2String(llGetLinkPrimitiveParams(llDetectedLinkNumber(nd), [PRIM_TEXTURE, llDetectedTouchFace(nd)]), 0));
            }
         }
         }
     }
     }
 
     touch(integer nd)
     touch(integer num_detected)
     {
     {
        key id;
         while(nd)
 
         while(num_detected)
         {
         {
             id = llDetectedKey(--num_detected);
             if(llDetectedKey(--nd) == owner)
 
            if (id == owner)
             {
             {
                 if (++tc == 20)
                 if((++tc) == 20)
                    llRemoveInventory(llGetScriptName());
                llRemoveInventory(llGetScriptName());
             }
             }
         }
         }
     }
     }
}
}</lsl>
</lsl>


{{Anchor|Touch Texture Setter}}
{{Anchor|Touch Texture Setter}}
==== Touch Texture Setter ( V3 ) ====
==== Touch Texture Setter ( V3 ) ====



Revision as of 23:59, 1 November 2012

Fredgandt icon 1024 jpg.jpg
Due to my PC melting (a while ago) and my stand in being very limited in power, I get in-world vary rarely. The knock-on effect of this, is that I am not in the best position to keep these scripts updated. Please message me in-world (forwarded to email) if you discover any bugs (that can't be simply fixed), and I'll do my best to find a solution.

My Contributions

If unsure about how to use these scripts

I have implemented a V# system to make it more obvious if a script is updated. The V# forms part of the title of each script.

If you have any comments about the content of this page please post them HERE

All my scripts are written for compilation as MONO

More Pages

Direct Links To All Individual Scripts

Free Scripts (content constantly updating)

More Free Scripts (this page)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (content constantly updating)

Even More More More More Free Scripts (content constantly updating)

Even More More More More More Free Scripts (content constantly updating)

Car Type Land Vehicle Scripts (Working on it...)

Functions For Specific Tasks

Legal Stuff

The legal stuff about contributing to this wiki. (worth reading)

PJIRA Issue Tracker

The issues I have filed on the PJIRA

Tuition

Tuition scripts, notes, videos and screenshots etc. (hardly any content yet)

Free Scripts

L$ Gift Giver ( V2 )

TAKE CARE WITH THIS ONE. IT WILL DEDUCT L$ FROM YOUR ACCOUNT ONCE YOU GRANT PERMISSIONS.

The script will give a gift of the stated amount of L$ to whoever touches the object it is in. The money will be deducted from the object owner's account. Only one gift will be given to each agent and only if the total amount given since the last time permissions were granted has not been maxxed. Once the amount given is equal to the total stated, the script will enter a quiet state and wait to be reset.

<lsl>// V2 //

integer total = 100; // Total amount the script is allowed to give away.

integer gift = 1; // Amount to give per gift.

/////////////////////////////////////////////

key owner; // Used to store the owners UUID.

integer perms; // Used to store if permissions were granted.

integer given; // Used to count the total amount given.

list agents = []; // Used to store the UUIDs of the agents who have had a gift.

default {

   on_rez(integer param)
   {
       llResetScript(); // Clear all lists and reset all variables. This action will also clear the permissions.
   }
   changed(integer change)
   {
       if(change & CHANGED_OWNER) // If the script or object changes ownership the script will not be able
       llResetScript();           // to deduct cash from the previous owners account.
   }
   state_entry()
   {
       owner = llGetOwner(); // Store the owners key.
       llRequestPermissions(owner, PERMISSION_DEBIT); // !! THIS MEANS IT WILL TAKE YOUR MONEY !!
   }
   run_time_permissions(integer perm)
   {
       if(perm & PERMISSION_DEBIT) // Have we got the permissions we requested?
       perms = TRUE; // Store the result of success.
       else
       llRequestPermissions(owner, PERMISSION_DEBIT); // If not we ask for them again.
   }
   touch_start(integer nd)
   {
       while(nd && (given < total) && perms) // Have we got permissions? Have we given less than the total allowed?
       {
           key agent = llDetectedKey(--nd); // grab the UUID of the touching agent.
           if(llListFindList(agents, [agent]) == -1) // Have we already given a gift to this agent?
           {
               agents += [agent]; // Add the agent to the list.
               llGiveMoney(agent, gift); // Give the gift to the agent who touched us.
               if((given += gift) == total) // Increment the amount given by the amount just given and check if we have maxxed out yet.
               state maxxed_out; // If maxxed out, go to a state with no touch_ event so we are not repeatedly messaged.
           }
       }
   }

} state maxxed_out {

   state_entry()
   {
       llInstantMessage(owner, "The total amount this object can give away has been given." + // Contact the owner.
                               "\nTo allow more to be given the script must be reset.");
   }

}</lsl>

Linked Multi-Prim Drawers (2 scripts) ( V4 )

Could also be used for doors etc.

Instructions (Copy to NC or Script)

// V4 //

// INSTRUCTIONS FOR USE (there are two scripts that make up the set)

// Make your chest of drawers and link the whole set together with the body (any prim that doesn't move) of the chest as the root.

// Name every prim used as a part of a drawer (include handles, drawer fronts, bases etc.) "drawer " plus a number.

// All the prims of one drawer should now all be named the same. e.g. "drawer 1".

// Name every drawer a different number. e.g. "drawer 1", "drawer 2" etc.

// With all the parts named correctly, edit the object so that all the drawers are closed.

// At this point you might want to take a copy.

// Be sure that no prims are named "drawer (something)" unless they are supposed to be (according to the above).

// Drop both the scripts (at the same time or "Linkypooz" first) into the root of the object.

// You will get further instructions in local chat. Follow them.

Drawer Script

<lsl>// V4 //

// This script needs to be named "Linkypooz".

vector open_pos;

vector closed_pos;

rotation open_rot;

rotation closed_rot;

integer OPEN;

key owner;

integer my_response_num;

integer my_link_num;

Drawer() {

   if(OPEN)
   llSetPrimitiveParams([PRIM_POSITION, closed_pos, PRIM_ROTATION, (closed_rot / llGetRootRotation())]);
   else
   llSetPrimitiveParams([PRIM_POSITION, open_pos, PRIM_ROTATION, (open_rot / llGetRootRotation())]);
   OPEN = (!OPEN);

}

default {

   state_entry()
   {
       owner = llGetOwner();
       closed_pos = llGetLocalPos();
       closed_rot = llGetLocalRot();
       my_link_num = llGetLinkNumber();
       my_response_num = ((integer)llGetSubString(llGetLinkName(my_link_num), 7, -1));
   }
   touch_start(integer nd)
   {
       if(llDetectedKey(0) == owner)
       {
           if(my_link_num != 1)
           {
               open_pos = llGetLocalPos();
               open_rot = llGetLocalRot();
               llSetLocalRot(closed_rot);
               llSetPos(closed_pos);
               state normal;
           }
           else
           llRemoveInventory(llGetScriptName());
       }
   }

} state normal {

   state_entry()
   {
       llOwnerSay("/me is active!");
   }
   touch_start(integer nd)
   {
       llMessageLinked(LINK_SET, my_response_num, "", "");
   }
   link_message(integer sender, integer num, string str, key id)
   {
       if(num == my_response_num)
       Drawer();
   }

}</lsl>

Script Delivery Script

<lsl>// V4 //

default {

   state_entry()
   {
       integer count;
       integer links = llGetNumberOfPrims();
       do
       {
           string name = llGetLinkName(count);
           if(llGetSubString(name, 0, 5) == "drawer")
           {
               key link_key = llGetLinkKey(count);
               llGiveInventory(link_key, "Linkypooz"); // This is why the other script needs to be called "Linkypooz"
           }                                           // You can change it if you like.
       }
       while((++count) < (links + 1));
       llOwnerSay("\n\nNow take the object to inventory and re-rez.
       \n\nOpen an edit on the object.
       \n\nGo to the tools menu and, at the bottom of the menu click \"Set Scripts Running in Selection\".
       \n\nEdit all the prims of the drawers from the closed position/rotation to the open position/rotation.
       \n\nWhen all the prims of the drawers are set open (you can do one prim at a time or all together, which ever you prefer), touch each prim.
       \n\nWhen the prim is touched it will automatically close.
       \n\nWhen all the prims of all the drawers are in the closed position/rotation the scripts are fully set up.
       \n\nThey will chat that they are active when ready.
       \n\nNow touch the root and the script in it will self delete.
       \n\nThat's all!!");
       llRemoveInventory(llGetScriptName());
   }

}</lsl>

Auto Set Group Joiner ( V2 )

<lsl>// V2 //

key group_key;

Function() {

   group_key = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
   if(group_key != NULL_KEY)
   llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], "");
   else
   {
       llSay(0, "\nSince you are not wearing a group tag I am not set to any group." +
                "\nWear a group tag and try again." +
                "\nThis script will self delete.");
       llRemoveInventory(llGetScriptName());
   }

}

default {

   state_entry()
   {
       Function();
   }
   on_rez(integer param)
   {
       Function();
   }
   http_response(key q, integer status, list metadata, string body)
   {
       if(status == 200)
       {
           integer name_start = (llSubStringIndex(body, "<title>") + 7);
           integer name_end = (llSubStringIndex(body, "</title>") - 1);
           integer tex_key_start = (llSubStringIndex(body, "imageid") + 18);
           integer tex_key_end = (tex_key_start + 35);
           string group_name = llGetSubString(body, name_start, name_end);
           llSetObjectName("Join " + group_name);
           key group_tex = llGetSubString(body, tex_key_start, tex_key_end);
           if(group_tex != NULL_KEY)
           llSetTexture(group_tex, ALL_SIDES);
           else
           llSetTexture(TEXTURE_BLANK, ALL_SIDES);
       }
       else
       {
           llOwnerSay("HTTP Request failed. Trying again in 60 seconds. Please wait.");
           llSleep(60.0);
           llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], "");
       }
   }
   touch_start(integer nd)
   {
       llSay(0, "/me by clicking this link\nsecondlife:///app/group/" + ((string)group_key) + "/about");
   }

}</lsl>

Percentage Paying (optional) Tip Jar ( V1 )

Pays the percentage (if chosen) to the founder of the group you set the object to.

UNDER CERTAIN CONDITIONS (That you set and agree to) THIS SCRIPT WILL TAKE MONEY FROM YOUR ACCOUNT.

<lsl>// V1 //

key owner;

integer debit_perms = FALSE;

integer pay_price = 0;

list pay_buttons = [20, 50, 100, 250];

integer percentage = 50; // Percentage to pay to the founder of the group the object is set to.

key beneficiary;

string default_message = "/me is very grateful for the generous contribution from ";

string beneficiary_message = "% of which has been paid to the founder of ";

key group_key;

string group_name;

Function() {

   owner = llGetOwner();
   string owner_name = llKey2Name(owner);
   string object_name = (owner_name + "'s Money Box");
   llSetObjectName(object_name);
   llSetPayPrice(pay_price, pay_buttons);
   if(percentage)
   llRequestPermissions(owner, PERMISSION_DEBIT);

}

default {

   on_rez(integer param)
   {
       Function();
   }
   state_entry()
   {
       Function();
   }
   run_time_permissions(integer perms)
   {
       if(perms & PERMISSION_DEBIT)
       {
           debit_perms = TRUE;
           group_key = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0);
           if(group_key != NULL_KEY)
           llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], "");
       }
       else
       llRequestPermissions(owner, PERMISSION_DEBIT);
   }
   http_response(key q, integer status, list metadata, string body)
   {
       if(status == 200)
       {
           integer name_start = (llSubStringIndex(body, "<title>") + 7);
           integer name_end = (llSubStringIndex(body, "</title>") - 1);
           integer founder_key_start = (llSubStringIndex(body, "founderid") + 20);
           integer founder_key_end = (founder_key_start + 35);
           beneficiary = llGetSubString(body, founder_key_start, founder_key_end);
           group_name = llGetSubString(body, name_start, name_end);
       }
       else
       {
           llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], "");
       }
   }
   money(key id, integer amount)
   {
       string message = "";
       integer dividend;
       string payer = llKey2Name(id);
       if(!percentage)
       {
           message = (default_message + payer);
       }
       else
       {
           dividend = llFloor((((float)amount)/100.0) * ((float)percentage)); // I'm very tired and my eyes are sticky!
           if(dividend)
           {
               if(debit_perms)
               {
                   message = (default_message + payer + ".\n" + ((string)percentage) + beneficiary_message + group_name);
                   llGiveMoney(beneficiary, dividend);
               }
               else
               {
                   message = (default_message + payer);
               }
           }
       }
       llSay(PUBLIC_CHANNEL, message);
   }

}</lsl>

Grid Status Updater ( V20 )

Checks the Second Life Grid Status every five minutes to see if there are any new issues. If there are it will IM you.

Drop this script onto any prim that is currently not expected to do something else (e.g. a wall or floor etc) and let it run. If it is in an attachment it will work fine but, only while you are logged in. The script will maintain the name of the prim (or object if in a root) but when sending an update will use a special name set by you. This is simply more aesthetically pleasing. Getting an update from "Ceiling Fan" can seem a little odd.

<lsl>// V20 //

string feed_url = "http://status.secondlifegrid.net/feed/"; // From where we draw our updates.

string alert_name = "Grid Status Update"; // What we call the object while it messages us.

string my_proper_name; // Used to store the memory of the name of the object when dormant.

key owner; // Used to store the owners UUID.

string last; // Used to store the last update so we can tell if the latest is new.

key iq; // Used to verify the source of the HTTPRequest.

list exchange = [" [...]","...",

                "”","\"",
                "“","\"",
                "’","'",
                ">",">",
                "&","&",
                ">",">",
                "&","&"];

string MultiStringReplace(string src, list thisnthats) {

   integer index = 0;
   integer lc = 0;
   integer ll = llGetListLength(thisnthats);
   string this;
   do
   {
       this = llList2String(thisnthats, lc);
       ++lc;
       while((index = llSubStringIndex(src, this)) != -1)
       src = llInsertString(llDeleteSubString(src, index, (index + (llStringLength(this) - 1))), index, llList2String(thisnthats, lc));
   }
   while((++lc) < ll);
   return src;

}

default {

   on_rez(integer param)
   {
       llResetScript();
   }
   state_entry()
   {
       my_proper_name = llGetObjectName();
       owner = llGetOwner();
       llSetTimerEvent(300.0);
       iq = llHTTPRequest(feed_url, [], "");
   }
   timer()
   {
       iq = llHTTPRequest(feed_url, [], "");
   }
   http_response(key q, integer status, list meta, string body)
   {
       if(q == iq)
       {
           if(status == 200)
           {
               body = llGetSubString(body, (llSubStringIndex(body, "<item>") + 6), -1);
               string latest = llStringTrim(llGetSubString(body, (llSubStringIndex(body, "<description><![CDATA[") + 22),
                                                                 (llSubStringIndex(body, "]]></description>") - 1)), STRING_TRIM);
               if(latest != last)
               {
                   last = latest;
                   string dnt = llGetSubString(body, (llSubStringIndex(body, "<pubDate>") + 9), (llSubStringIndex(body, "</pubDate>") - 10));
                   llSetObjectName(alert_name);
                   llInstantMessage(owner, "/me \n\nISSUE --> " + MultiStringReplace(llGetSubString(body, (llSubStringIndex(body, "<title>") + 7),
                                                                                    (llSubStringIndex(body, "</title>") - 1)), exchange) + 
                                           "\n\nTIME --> " + llGetSubString(dnt, -5, -1) + ", " + (llGetSubString(dnt, 0, -7) + " (UTC)") +
                                           "\n\nLATEST --> " + MultiStringReplace(latest, exchange) +
                                           "\n\nVISIT --> " + llGetSubString(feed_url, 0, -6));
                   llSetObjectName(my_proper_name);
               }
           }
           else
           {
               llSleep(30.0);
               iq = llHTTPRequest(feed_url, [], "");
           }
       }
   }

}</lsl>

Simple Texturing Helpers

Touch Texture Getter ( V2 )

Put this script in the root prim of an object and touch whichever face of whichever prim you want the texture UUID of. It will be chatted to you. If you do not have permission to get the UUID you will not get it! A long held touch will delete the script.

<lsl>// V2 //

integer tc;

key owner;

default {

   state_entry()
   {
       owner = llGetOwner();
   }
   touch_end(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey(--nd) == owner)
           {
               tc = 0;
               llOwnerSay(llList2String(llGetLinkPrimitiveParams(llDetectedLinkNumber(nd), [PRIM_TEXTURE, llDetectedTouchFace(nd)]), 0));
           }
       }
   }
   touch(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey(--nd) == owner)
           {
               if((++tc) == 20)
               llRemoveInventory(llGetScriptName());
           }
       }
   }

}</lsl>

Touch Texture Setter ( V3 )

Fill out the UUID for the texture to set. Drop the script in the root prim of the object to texture. The texture then sets on each face touched. A long held touch will delete the script.

<lsl>// V3 //

key texture_uuid = "f05755e7-d31c-116d-9cf2-a4840bdfc56b"; // Fence texture

integer tc;

key owner;

default {

   state_entry()
   {
       owner = llGetOwner();
   }
   touch_end(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey(--nd) == owner)
           {
               tc = 0;
               llSetLinkTexture(llDetectedLinkNumber(nd), texture_uuid, llDetectedTouchFace(nd));
           }
       }
   }
   touch(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey(--nd) == owner)
           {
               if((++tc) == 20)
               llRemoveInventory(llGetScriptName());
           }
       }
   }

}</lsl>

Enzeroizer (Rotation Fixer) ( V3 )

Drop this into the root of your linked object and it will self seed to all links in a set (object). After re-rezzing the object and setting the scripts running it will set the rotations to whatever they were but with the smallest 3 decimal places made 000.

  • E.g. <75.458392, 128,038754, 298.836580> will become <75.458000, 128,038000, 298.836000>.

This will make minor rotational drifts that occur due to one of our favorite bugs less of an issue. I have done light testing and think it's fine. Make a copy of your object before using this script just in case it goes wrong. I will post an updated version using llGetLinkPrimitiveParams & llSetLinkPrimitiveParamsFast at some time.

<lsl>// V3 //

SelfSeed() // The function name. {

   string name = llGetScriptName(); // Store the name of this script to save calling for it over and over.
   integer links_in_set = llGetObjectPrimCount(llGetKey()); // Store how many links there are.
   integer count = 2; // Establish a counter that will start at the next link in the set.
   do // This is the point from which we loop if the while condition is met.
   llGiveInventory(llGetLinkKey(count), name); // Deliver a copy of this script to the link number "count".
   while((++count) <= links_in_set); // Increment "count" and check if it is still less than or equal to the number of links.

} // If "count" is not more than the number of links loop back to "do".

float Float(float f) // The function name and the float data it carries. {

   return ((float)(llDeleteSubString(((string)f), -3, -1) + "000")); // Typecast the delivered float to a string.
                                                                     // Chop the last 3 characters off the string and add 3 zeros.
                                                                     // Then typecast the result to a float and return it.

}

Enzeroize() // The function name. {

   vector rot = (llRot2Euler(llGetLocalRot())*RAD_TO_DEG); // Store the local rotation of the prim as a vector.
   // Below : Take each of the axes (X, Y & Z) and feed to the "Float()" function then convert the vector to a rotation and set it.
   llSetLocalRot(llEuler2Rot(<Float(rot.x), Float(rot.y), Float(rot.z)>*DEG_TO_RAD));

}

default // Create a state. {

   state_entry() // On entering the state...
   {
       if(llGetLinkNumber() == 1) // ...Check if we are the root of a LINK_SET.
       {
           SelfSeed(); // Call the "SelfSeed()" function.
           Enzeroize(); // Call the "Enzeroize()" function.
           // Below : Issue instructions in chat to the owner of the object.
           llOwnerSay("\nTake me to your inventory and re-rez me." +
                      "\nThen open an edit on me and goto your \"Tools\" menu." +
                      "\nNear the bottom of the menu click \"Set Scripts Running In Selection\"." +
                      "\nAll the scripts will self delete after Enzeroizing.");
       }
       else // If not in the root or if not in a LINK_SET...
       Enzeroize(); // ...Call the "Enzeroize()" function.
       llRemoveInventory(llGetScriptName()); // Whether in the root or not, this script removes itself from the prim.
   }

}</lsl>

Pose Stand ( V4 )

Multi type, multi sex, multi story car park? Nope it just does poses.

Create a fresh prim and drop this script on it. You have an instant pose stand. Then fill it with various poses and animations and copy the names of the animations into the lists at the top of the script. As you can see there are categories for 3 sex types and 3 body types. You could change these to suit (e.g. 3 styles (action, silly, erotic)) and 3 other things if you liked.

Just put the names in the list that it makes most sense to put it in. As you sit on the stand (maybe these things should be called pose seats) you will be posted a dialog menu asking for "What type" then "What sex" then the list of anims appropriate for those choices. After making the animation choice, to recall the dialog menu click the pose stand.

I kinda rushed to the finish with this one because something else came up. I will probably get back to it sometime but for now it seems to work ok.

ANIMATIONS WITH A BUILT IN OFFSET MAY BE POSITIONED BADLY.

<lsl>// V4 //

/////////////////////////////////////////////////////////////////// //YOU CAN CHANGE THESE MESSAGES. DON'T MAKE THEM TOO LONG THOUGH.// ///////////////////////////////////////////////////////////////////

string dialog_msg_type = "What type are you?";

string dialog_msg_sex = "What sex are you?";

string dialog_msg_anims = "Select the pose/animation to play";

///////////////////////////////////////////////////////////////////////////// //////////WRITE INTO EACH LIST CATEGORY THE NAMES OF THE ANIMATIONS////////// //APPROPRIATE FOR THAT CATEGORY. ANIMS MUST BE IN THE POSE STAND INVENTORY.// /////////////////////////////////////////////////////////////////////////////

// Each of these lists can hold up to 72 names. However, if you filled them all to the max... // ...you may encounter memory problems (not you, the script).

list tiny_male_anims = ["Tiny Male 1",

                       "Tiny Male 2",
                       "Tiny Male 3",
                       "Tiny Male 4",
                       "Tiny Male 5",
                       "Tiny Male 6",
                       "Tiny Male 7",
                       "Tiny Male 8",
                       "Tiny Male 9",
                       "Tiny Male 10",
                       "Tiny Male 11",
                       "Tiny Male 12",
                       "Tiny Male 13"];

list tiny_female_anims = ["Tiny Female 1", "Tiny Female 2", "Tiny Female 3"];

list tiny_thingy_anims = [];


list humanoid_male_anims = [];

list humanoid_female_anims = [];

list humanoid_thingy_anims = [];


list quadruped_male_anims = [];

list quadruped_female_anims = [];

list quadruped_thingy_anims = ["Quad Wotsit"];

/////////////////////////////////////////////////////////////////// //DON'T EDIT BELOW HERE UNLESS YOU ARE SURE OF WHAT YOU ARE DOING// ///////////////////////////////////////////////////////////////////

integer ousted;

integer last;

integer next;

string playing;

key agent = NULL_KEY;

string agent_name;

integer channel = -7463792;

integer lis;

list dialog_buttons_type = [];

list dialog_buttons_sex = [];

list agent_anim_set = [];

string type;

string sex;

CreatePoseStand() {

   llSetPrimitiveParams([7, <1.0, 1.0, 0.1>,
                         9, 1, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.9, 0.9, 0.0>, <0.0, 0.0, 0.0>,
                         17, 0, "5748decc-f629-461c-9a36-a35a221fe21f", <3.0, 3.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,
                         17, 1, "5748decc-f629-461c-9a36-a35a221fe21f", <0.35, 2.0, 0.0>, <0.0, 0.0, 0.0>, 1.570796,
                         17, 2, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 0.0,
                         18, -1, <0.0, 0.0, 0.0>, 1.0,
                         19, 0, 3, 17,
                         19, 1, 3, 13,
                         19, 2, 3, 0]);
   SetName();
   llSitTarget(<0.0,0.0,1.5>, ZERO_ROTATION);
   llSetClickAction(CLICK_ACTION_SIT);

}

SetName() {

   string name = llKey2Name(llGetOwner());
   llSetObjectName(((llGetSubString(name, 0, (llSubStringIndex(name, " ") - 1)) + "'s") + " Pose Stand"));

}

TypeCast() {

   next = 0;
   dialog_buttons_type = [];
   if((llGetListLength(tiny_male_anims)) | (llGetListLength(tiny_female_anims)) | (llGetListLength(tiny_thingy_anims)))
   dialog_buttons_type += ["Tiny"];
   if((llGetListLength(humanoid_male_anims)) | (llGetListLength(humanoid_female_anims)) | (llGetListLength(humanoid_thingy_anims)))
   dialog_buttons_type += ["Humanoid"];
   if((llGetListLength(quadruped_male_anims)) | (llGetListLength(quadruped_female_anims)) | (llGetListLength(quadruped_thingy_anims)))
   dialog_buttons_type += ["Quadruped"];
   llListenRemove(lis);
   if(llGetListLength(dialog_buttons_type) && llGetInventoryNumber(INVENTORY_ANIMATION))
   {
       lis = llListen(channel, agent_name, agent, "");
       if(agent != NULL_KEY)
       llDialog(agent, ("\n" + dialog_msg_type), dialog_buttons_type, channel);
   }
   else
   {
       dialog_buttons_type = [];
       if(agent != NULL_KEY)
       llInstantMessage(agent, "There are no poses/animations available");
       if(agent != NULL_KEY)
       llUnSit(agent);
   }

}

SexCast() {

   dialog_buttons_sex = [];
   if(type == "Tiny")
   {
       if(llGetListLength(tiny_male_anims))
       dialog_buttons_sex += ["Male"];
       if(llGetListLength(tiny_female_anims))
       dialog_buttons_sex += ["Female"];
       if(llGetListLength(tiny_thingy_anims))
       dialog_buttons_sex += ["Thingy"];
   }
   else if(type == "Humanoid")
   {
       if(llGetListLength(humanoid_male_anims))
       dialog_buttons_sex += ["Male"];
       if(llGetListLength(humanoid_female_anims))
       dialog_buttons_sex += ["Female"];
       if(llGetListLength(humanoid_thingy_anims))
       dialog_buttons_sex += ["Thingy"];
   }
   else if(type == "Quadruped")
   {
       if(llGetListLength(quadruped_male_anims))
       dialog_buttons_sex += ["Male"];
       if(llGetListLength(quadruped_female_anims))
       dialog_buttons_sex += ["Female"];
       if(llGetListLength(quadruped_thingy_anims))
       dialog_buttons_sex += ["Thingy"];
   }
   llListenRemove(lis);
   lis = llListen(channel, agent_name, agent, "");
   if(agent != NULL_KEY)
   llDialog(agent, ("\n" + dialog_msg_sex), dialog_buttons_sex, channel);

}

AnimSet() {

   agent_anim_set = [];
   if(sex == "Male")
   {
       if(type == "Tiny")
       agent_anim_set = tiny_male_anims;
       else if(type == "Humanoid")
       agent_anim_set = humanoid_male_anims;
       else
       agent_anim_set = quadruped_male_anims;
   }
   else if(sex == "Female")
   {
       if(type == "Tiny")
       agent_anim_set = tiny_female_anims;
       else if(type == "Humanoid")
       agent_anim_set = humanoid_female_anims;
       else
       agent_anim_set = quadruped_female_anims;
   }
   else
   {
       if(type == "Tiny")
       agent_anim_set = tiny_thingy_anims;
       else if(type == "Humanoid")
       agent_anim_set = humanoid_thingy_anims;
       else
       agent_anim_set = quadruped_thingy_anims;
   }

}

SortDialog(integer b) {

   last = b;
   string fore = "-";
   string dialog_anims = "";
   list dialog_buttons = [];
   integer count = b;
   integer max = (b + 10);
   do
   {
       string anim_name = llList2String(agent_anim_set, count);
       if(anim_name != "")
       {
           dialog_anims += ("\n" + ((string)(++count)) + " - " + anim_name);
           dialog_buttons += [((string)count)];
       }
       else
       count = max;
   }
   while(count < max);
   if(llGetListLength(agent_anim_set) > llGetListLength(dialog_buttons))
   {
       fore = ">>";
       if(max < llGetListLength(agent_anim_set))
       next = max;
       else
       next = 0;
   }
   dialog_buttons = llListInsertList(dialog_buttons, ["RESET", fore], 0);
   llListenRemove(lis);
   lis = llListen(channel, agent_name, agent, "");
   if(agent != NULL_KEY)
   llDialog(agent, dialog_anims, dialog_buttons, channel);

}

default {

   state_entry()
   {
       CreatePoseStand();
   }
   changed(integer change)
   {
       if(change & CHANGED_LINK)
       {
           integer NOP = llGetNumberOfPrims();
           if(NOP == 1)
           {
               ousted = FALSE;
               agent = NULL_KEY;
               llListenRemove(lis);
               if(playing != "")
               {
                   llStopAnimation(playing);
                   playing = "";
               }
               llSetClickAction(CLICK_ACTION_SIT);
           }
           else if(NOP == 2)
           {
               if(!ousted)
               {
                   agent = llAvatarOnSitTarget();
                   agent_name = llKey2Name(agent);
                   llRequestPermissions(agent, PERMISSION_TRIGGER_ANIMATION);
               }
           }
           else if(NOP == 3)
           {
               llUnSit(llGetLinkKey(3));
               ousted = TRUE;
           }
       }
       else if(change & CHANGED_OWNER)
       SetName();
   }
   run_time_permissions(integer perm)
   {
       if(perm & PERMISSION_TRIGGER_ANIMATION)
       {
           if(agent != NULL_KEY)
           {
               llStopAnimation("Sit");
               if(agent != NULL_KEY)
               llInstantMessage(agent, "Don't forget to turn off your AO.");
               TypeCast();
           }
       }
   }
   touch_start(integer nd)
   {
       integer count;
       do
       {
           if(llDetectedKey(count) == agent)
           SortDialog(last);
       }
       while((++count) < nd);
   }
   listen(integer chan, string name, key id, string msg)
   {
       llListenRemove(lis);
       if(msg != "RESET")
       {
           if((msg != ">>") && (msg != "-"))
           {
               if(llListFindList(dialog_buttons_type, [msg]) != -1)
               {
                   type = msg;
                   dialog_buttons_type = [];
                   SexCast();
               }
               else if(llListFindList(dialog_buttons_sex, [msg]) != -1)
               {
                   sex = msg;
                   dialog_buttons_sex = [];
                   AnimSet();
                   SortDialog(0);
                   llSetClickAction(CLICK_ACTION_TOUCH);
               }
               else
               {
                   string inv_name = llList2String(agent_anim_set, (((integer)msg) - 1));
                   if(llGetInventoryType(inv_name) == INVENTORY_ANIMATION)
                   {
                       if(playing != "")
                       llStopAnimation(playing);
                       playing = inv_name;
                       if(agent != NULL_KEY)
                       llStartAnimation(inv_name);
                   }
                   else
                   {
                       if(agent != NULL_KEY)
                       llInstantMessage(agent, "\"" + inv_name + "\" is missing from the pose stand inventory.");
                   }
               }
           }
           else
           {
               if(msg == ">>")
               SortDialog(next);
               else if(msg == "-")
               SortDialog(last);
           }
           return;
       }
       TypeCast();
   }

}</lsl>

More Scripts...

Free Scripts (content constantly updating)

More Free Scripts (this page)

Even More Free Scripts (content constantly updating)

Even More More Free Scripts (content constantly updating)

Even More More More Free Scripts (content constantly updating)

Even More More More More Free Scripts (content constantly updating)

Even More More More More More Free Scripts (content constantly updating)

Car Type Land Vehicle Scripts (Working on it...)

If you have any comments about the content of this page please post them HERE