User:Fred Gandt/Scripts/Continued 1

From Second Life Wiki
Jump to navigation Jump to search
FG jpg.jpg

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

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)

Functions for specific tasks (hardly any content yet)

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

Limited Use L$ Gift Giver ( V1 )

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

I was asked to make it this way. It was designed to be rezzed for short periods of time.

IF TOO MANY AGENTS USE IT THE MEMORY WILL RUN OUT AND IT WILL FAIL.

<lsl>// V1 //

key owner; // Global variable to store the owner UUID (key)

integer perms; // Global to store the condition of the request for permissions.

integer count; // Global counter.

list visitors; // This stores the keys of all the agents who take the gift. They will be allowed only one gift.

integer ammount = 1; // Change this figure to the required ammount to give away (e.g. 5). Then drop in your object.

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_end(integer nd)
   {
       do // Loop through the detected touchers to cover the rare cases when
       {  // more than one agent touches the object at the same time.
           key toucher = llDetectedKey(count);
           if(llListFindList(visitors, [toucher]) == -1) // Check if the agent has touched us before by searching the list for a match.
           {
               if(perms) // Check if we have permissions.
               {
                   llGiveMoney(toucher, ammount); // Ker-ching!!
                   visitors += [toucher]; // That's all buster! NEXT!!
               }
           }
       }
       while((++count) < nd); // Increment the counter and loop while it is less than the number of touchers detected.
       count = 0; // Reset the counter.
   }

}</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, "Since 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 ( V17 )

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>// V17 //

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.

string MultiStringReplace(string src, list thisnthats) {

   integer index = 0;
   integer lc = -1;
   integer ll = llGetListLength(thisnthats);
   do
   {
       string this = llList2String(thisnthats, (++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 {

   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 --> " + llGetSubString(body, (llSubStringIndex(body, "<title>") + 7),
                                                                                       (llSubStringIndex(body, "</title>") - 1)) + 
                                           "\n\nTIME --> " + llGetSubString(dnt, -5, -1) + ", " + (llGetSubString(dnt, 0, -7) + " (UTC)") +
                                           "\n\nLATEST --> " + MultiStringReplace(latest, [" [...]",    "...",
                                                                                           "”",   "\"",
                                                                                           "“",   "\"",
                                                                                           "’",   "'",
                                                                                           ">",     ">",
                                                                                           "&",     "&"]) +
                                           "\n\nVISIT --> " + llGetSubString(feed_url, 0, -6));
                   llSetObjectName(my_proper_name);
               }
           }
           else
           {
               llSleep(30.0);
               iq = llHTTPRequest(feed_url, [], "");
           }
       }
   }

}</lsl>

Touch Texture Setter ( V2 )

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

<lsl>// V2 //

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

integer tc;

key owner;

default {

   state_entry()
   {
       owner = llGetOwner();
   }
   touch_end(integer nd)
   {
       while(nd)
       {
           if(llDetectedKey(--nd) == owner)
           {
               tc = 0;
               llSetTexture(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 ( V3 )

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>// V3 //

/////////////////////////////////////////////////////////////////// //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 name = llList2String(agent_anim_set, (((integer)msg) - 1));
                   if(llGetInventoryType(name) == INVENTORY_ANIMATION)
                   {
                       if(playing != "")
                       llStopAnimation(playing);
                       playing = name;
                       if(agent != NULL_KEY)
                       llStartAnimation(name);
                   }
                   else
                   {
                       if(agent != NULL_KEY)
                       llInstantMessage(agent, "\"" + 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)

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