User:Fred Gandt/Scripts/Continued 4
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
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 (content constantly updating)
Even More Free Scripts (content constantly updating)
Even More More Free Scripts (content constantly updating)
Even More More More Free Scripts (this page)
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...)
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
Text Scroller (3 Scripts) ( V1 )
A simple text display unit that scrolls text from right to left (like those LED signs) in a continuous loop. Touch to start and stop the scrolling. It is not very sophisticated.
Create The Object
- Create a fresh new prim and drop this script onto/into it. The prim will form the shape needed plus change the texturing etc. (you can do what you like to the texturing afterwards).
<lsl> // version 3
default {
state_entry() { llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_SIZE, <0.5, 0.01, 0.25>, PRIM_ROTATION, ZERO_ROTATION, PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.375, 0.875, 0.0>, 0.0, ZERO_VECTOR, <1.0, 1.0, 0.0>, ZERO_VECTOR, PRIM_TEXTURE, ALL_SIDES, "5748decc-f629-461c-9a36-a35a221fe21f", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0, PRIM_COLOR, ALL_SIDES, <1.0, 0.65, 0.1>, 1.0, PRIM_FULLBRIGHT, ALL_SIDES, TRUE, PRIM_GLOW, ALL_SIDES, 0.05]);
llRemoveInventory(llGetScriptName()); }
} </lsl>
- When the script has worked its magic, Snap the prim to the grid with a grid size of .5 meters.
- Shift-Drag-Copy the prim, snapping each to the grid positively along the X axis until you have 10 prims in a continuous strip.
You can actually make the object as long or short as you like. 1 prim will work. 100 prims will work (although large linksets have been a problem for link_messages in the past). Just follow the same basic build plan.
- Select each of the prims from the end that has the greatest X axis position, one at a time (negatively along the X axis) until ALL are selected.
- Link the set.
Display Script
- Check "Edit Linked parts" and select one prim at a time, dropping this script in each.
- DO NOT CREATE A FRESH SCRIPT IN EACH PRIM. DROP THE SAME SCRIPT FROM YOUR INVENTORY INTO EACH PRIM.
<lsl>// V1 //
string font = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890(){}[]<>|\\/.,;:'!?\"£$%^&*_+-=~#@ "; // A accurate representation of the characters featured on the texture used to display the text.
vector GetOffset(string s) {
if(s == "") // If there is no text s = " "; // Use a space integer i = llSubStringIndex(font, s); // Find the character if(i == -1) // If we can't find it i = 94; // Use a space return <(-0.45 + ((i % 10) * 0.1)), (0.45 - (llRound(i / 10) * 0.1)), 0.0>;
} // Return the offset needed to display the correct section of the texture by doing the mathematics *coughs*
integer me; // Used to store the Link number
integer my_ss_5; // Used to store the index of the feed text we display on face 5
integer my_ss_6; // Used to store the index of the feed text we display on face 6
default {
state_entry() { me = llGetLinkNumber(); my_ss_6 = ((me - 1) * 2); // Whatever link we are (in a correctly built object) establish the index to grab my_ss_5 = (my_ss_6 + 1); // And also grab the next } link_message(integer sender, integer num, string msg, key id) { llSetLinkPrimitiveParamsFast(me, [17, 5, id, <0.1, 0.1, 0.0>, GetOffset(llGetSubString(msg, my_ss_5, my_ss_5)), 0.0, 17, 6, id, <0.1, 0.1, 0.0>, GetOffset(llGetSubString(msg, my_ss_6, my_ss_6)), 0.0]); } // Set the texture to the correct offset to display the correct characters
}</lsl>
Control Script
One possible way amongst many to feed the text to the script is by notecard. That is the way I set this script. As such, you need a notecard in the root containing the text you wish to display. One notecard will be read. If you add more notecards (without altering the script) it will read the first it finds alphabetically.
- There is a caveat regarding the length of the lines of text in the notecard. If the line is longer then 255 bytes the dataserver will return the first 255 bytes of the line.
- This example - taken from one of Shakespeare's Hamlet's soliloques (To be, or not to be...) is too long by the red lettering -
- "For who would bear the whips and scorns of time, th'oppressor's wrong, the proud man's contumely, the pangs of despised love, the law's delay, the insolence of office, and the spurns that patient merit of th'unworthy takes, when he himself might his quietus make with a bare bodkin?"
- Add your text notecard to the root.
- Drop this script into the root.
<lsl>// V1 //
integer count; // Used to keep track of itterations
integer length; // A measure of string length
string text = " "; // Adding this creates a gap between beginning and end of text
integer NCC; // NoteCardCount for tracking which line to read
string NC; // NoteCard name
integer on; // Are we on or off?
default {
state_entry() { NC = llGetInventoryName(INVENTORY_NOTECARD, 0); // Establish the name of our NC llGetNotecardLine(NC, NCC); // Ask for the first line } dataserver(key q, string data) { if(data != EOF) // If the data is useful { text += (data + " "); // Store it llGetNotecardLine(NC, (++NCC)); // And get the next line } else // If not useful we are at the end of the NC { length = llStringLength(text); // Establish the length of our text // The number 19 is 1 less than the number of faces (2 per prim) that display text. Change that number accordingly if... // ...you have a larger or smaller number of prims in your object. llMessageLinked(-1, 0, llGetSubString("Touch start scroll.", count, (count + 19)), "b6349d2d-56bf-4c18-4859-7db0771990a5"); } // Message the display scripts that we are ready to function } timer() { if(count == length) // If we have gone full circle count = 0; // Start again llMessageLinked(-1, 0, llGetSubString(text, count, (count + 19)), "b6349d2d-56bf-4c18-4859-7db0771990a5"); ++count; // Message the display scripts with a chunk of text } touch_end(integer nd) { if(on) // Are we running? llSetTimerEvent(0.0); // Stop the timer else // No? llSetTimerEvent(0.15); // Start the timer on = (!on); // Remember what we did } changed(integer change) { if(change & CHANGED_INVENTORY) // If the inventory has changed the NC may have llResetScript(); // So reset the script to read the new card }
}</lsl>
It should set the text to read "Touch Start Scroll.". If you get something else, you haven't followed these instructions.
The Charsheet Texture
I am a scriptor, not a texturizerer. I created a very simple Charsheet (Character Sheet) to get you going but, it isn't very good *grins*. You will probably want to replace it.
- The texture MUST be 10 characters by 10 characters (you may have empty spaces so, 56 chars is fine so long as the grid is the full 100 spaces).
- Unlike the texture I have supplied...ALL the chars should be perfectly evenly spaced and not spreading into the neighboring spaces.
This is the texture supplied. You don't need to copy this. The script already has the UUID in it.
The display scripts contain a string that is in the exact same order the chars are read from top left to bottom right (row by row, not column by column).
- HAVING THE SAME ORDER OF CHARS IN THE TEXTURE AND STRING IS VITAL
The order you choose is entirely up to you as long as the strings in ALL the display scripts match the order of chars in the texture.
- Don't forget to include a blank grid space on your 10 x 10 texture for a space "character". There also needs to be an empty space (in the correct place) in the scripts.
- In the display script strings there are two characters that must be treated unusually. The \ and the " must have a \ placed before them.
- Example "ABCabc123.,:\"\\/| " Note the included space and the way the \ and " have a \ before them.
Sell To Group Only ( V2 )
This is a simple GROUP ONLY vendor script. It can be used to GIVE FREE items to group only too.
- THIS SCRIPT WILL ASK FOR DEBIT PERMISSIONS. THEY MUST BE GRANTED FOR THE SCRIPT TO FUNCTION. L$ WILL BE TAKEN FROM THE OBJECT OWNERS ACCOUNT.
- The debit permissions are required for making refunds in the event of an over or under payment or a payment being made by a non group member.
<lsl>// V2 //
integer cost = 0; // The cost of the contents of this object (A whole round number (No decimal places)).
// If this is set to zero, the object will act as a group only freebie giver, however... // ...it will still ask for permissions to debit.
string folder_name = "Folder"; // The Name of the folder in which to give the contents.
integer offer_group_join = TRUE; // Set TRUE or FALSE to offer group membership link on failed purchase attempt.
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////// YOU NEED NOT CHANGE ANYTHING BELOW THIS POINT ///////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
list contents_list = [];
string group_name;
key group_key;
key owner;
default {
on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } state_entry() { llSetClickAction(CLICK_ACTION_TOUCH); llRequestPermissions((owner = llGetOwner()), PERMISSION_DEBIT); } run_time_permissions(integer perm) { if(perm & PERMISSION_DEBIT) { integer in = llGetInventoryNumber(INVENTORY_ALL); integer count; string name; do { if((name = llGetInventoryName(INVENTORY_ALL, count)) != llGetScriptName()) contents_list += [name]; } while((++count) < in); if(llGetListLength(contents_list)) { if((group_key = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]), 0)) == NULL_KEY) { llOwnerSay("You NEED to set this object to a group in order to have it sell contents ONLY to that group." + "\nThis script is resetting. You will need to grant debit permissions again." + "\n!! ONLY DO THAT AFTER SETTING THIS OBJECT TO THE DESIRED GROUP !!"); llResetScript(); } else llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], ""); } else { llOwnerSay("There are no contents. This object cannot sell thin air. There is no air in SL." + "\nPlease add the contents to sell." + "\n!! ONLY RE-GRANT PERMISSIONS WHEN ALL CONTENTS ARE ADDED !!"); } } else { llOwnerSay("You MUST grant permissions for this script to function."); llRequestPermissions(owner, PERMISSION_DEBIT); } } http_response(key q, integer status, list metadata, string body) { if(status == 200) { llOwnerSay("This object is set to the group - " + (group_name = llGetSubString(body, (llSubStringIndex(body, "<title>") + 7), (llSubStringIndex(body, "</title>") - 1))) + "\nOnly members of that group will be able to buy this objects contents." + "\nContents for sale - \n" + llDumpList2String(contents_list, "\n") + "\nPrice is " + ((string)cost) + "L$"); if(cost) { llSetClickAction(CLICK_ACTION_PAY); llSetPayPrice(PAY_HIDE, [cost, PAY_HIDE, PAY_HIDE, PAY_HIDE]); state shoptastic; } else state freebietastic; } else { llOwnerSay("HTTP Request failed. Trying again in 45 seconds. Please wait."); llSleep(45.0); llHTTPRequest("http://world.secondlife.com/group/" + ((string)group_key), [], ""); } }
} state freebietastic {
on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } touch_start(integer nd) { while(nd) { key id = llDetectedKey(--nd); if(llSameGroup(id)) llGiveInventoryList(id, folder_name, contents_list); else { string msg = ""; if(offer_group_join) msg = "\nYou can join this group by clicking this - \nsecondlife:///app/group/" + ((string)group_key) + "/about"; llRegionSayTo(id, 0, "Sorry, this vendor is set to give only to " + group_name + " group members." + msg); } } }
} state shoptastic {
on_rez(integer param) { llResetScript(); } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); } money(key id, integer amount) { if(llSameGroup(id)) { if(amount >= cost) { if(amount > cost) llGiveMoney(id, (amount - cost)); llGiveInventoryList(id, folder_name, contents_list); } else if(amount < cost) { llGiveMoney(id, amount); llRegionSayTo(id, 0, "Sorry, you paid to little.\nThe cost is " + ((string)cost) + "L$"); } } else { llGiveMoney(id, amount); string msg = ""; if(offer_group_join) msg = "\nYou can join this group by clicking this - \nsecondlife:///app/group/" + ((string)group_key) + "/about"; llRegionSayTo(id, 0, "Sorry, this vendor is set to sell only to " + group_name + " group members." + msg); } }
}</lsl>
Basic Smooth Sliding Door ( V1 )
Sliding door that glides smoothly from closed to open and back with an auto timer.
- DO NOT LINK TO HOUSE (even though it is quite funny).
<lsl>// V1 //
vector target = <1.5, 0.1, 0.0>; // Play about to get the result you want. // Each of the 3 floats represents X, Y, Z region axis in meters.
float time = 10.0; // Time for auto close. Set to zero to disable.
//////////////////////////////////////////////////////////////////
integer t;
integer open;
vector pos;
Door() {
vector targ; if(!open) { targ = (pos + target); llSetTimerEvent(time); } else { llSetTimerEvent(0.0); targ = (pos); } open = (!open); t = llTarget(targ, 0.04); llMoveToTarget(targ, 0.75); llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE);
}
default {
on_rez(integer param) { llResetScript(); } state_entry() { llSetStatus(STATUS_BLOCK_GRAB, TRUE); llSetStatus(STATUS_PHYSICS | STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z | STATUS_PHANTOM, FALSE); pos = llGetPos(); } touch_start(integer nd) { Door(); } at_target(integer num, vector tpos, vector opos) { llTargetRemove(t); llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, FALSE); llSetPos(tpos); } timer() { llSetTimerEvent(0.0); Door(); }
}</lsl>
Link-Set Texture Configuration ( V2 )
For example - We have a piece of furniture with 5 frame prims and 4 cushion prims.
- You want the frame to have 4 texture options -
- Dark Wood
- Light Wood
- Aluminium
- Shiny Black
- And the cushions have 4 texture options -
- Pink Damasque
- Green Twill
- Black Fur
- Crimson Velour
You want these options to be available to choose from -
- Dark Wood frame with Crimson Velour cushions.
- Light Wood frame with Pink Damasque cushions.
- Aluminium frame with Green Twill cushions.
- Shiny Black frame with Black Fur cushions.
- Dark Wood frame with Pink Damasque cushions.
- Light Wood frame with Green Twill cushions.
- Aluminium frame with Black Fur cushions.
- Shiny Black frame with Crimson Velour cushions.
- Dark Wood frame with Green Twill cushions.
- Light Wood frame with Black Fur cushions.
- Aluminium frame with Crimson Velour cushions.
- Shiny Black frame with Pink Damasque cushions.
Put this script in any prim in the set. If you put it in the root prim, the whole object will become touchable. This may be undesirable. If the script is in any other prim in the set, only that prim will be touchable (unless you have other touch active scripts in the object). The script responds to its owner only. It will reset if the owner changes so that the new owner can control it.
- Set the object manually to one of the texturing configurations.
- Set your Viewer Preferences > Text Chat > Chat Options > Show Timestamp in Local Chat to OFF (uncheck that option).
- Click the prim with this script in it.
- A dialog will appear, click the "Config" button.
- A load of data will be chatted to you.
- Copy from your local chat history all the text between "!!!!!!!!!!----CONFIGURATION START----!!!!!!!!!!" & "!!!!!!!!!!----CONFIGURATION END----!!!!!!!!!!". Don't include those two lines. Since this is local chat (and the script is cleaner without automatic removal) you'll need to check there is no unwanted chat mixed up in the object data chat.
- Paste that text into an otherwise clean Notecard (no other text in the card).
- Name it. The Notecard name needs to be short enough to be the name of that configuration option when offered on a dialog button.
- Set the object manually to another of the texturing configurations.
- Repeat these steps until all the configurations (Maximum of 12) are stored to Notecards.
Once all the Notecards are saved and named, drop them all into the same prim contents as the script. That's it. Now when the prim is clicked a dialog will appear offering the options, taking the names for each option from the Notecards the script finds.
- To add new configurations after adding Notecards to the prim, you'll need to remove the Notecards already in the contents and add them again after creating the new Notecards. In other words, If the prim has any Notecards in it, it will offer the options. If the prim has no Notecards in it, it will offer the "Config" button.
- The change from one configuration to another can be very slow (depending on the number of prims and the number of faces of each prim etc).
- This slowness is a trade off. The main advantages are -
- The script doesn't use a vast amount of memory ("Memory use is bad, M'kay?").
- There are not loads of scripts. Just one script for the whole object.
- Dramatically different texturing is as simple to apply as slight changes.
- This isn't designed for dynamic effect. It is for simply changing decoration. Speed is hardly important when changing the color of an arm chair after all.
- This slowness is a trade off. The main advantages are -
All texture parameters are catered for. Every individual face separately.
- Texture
- UUID
- Repeats
- Offsets
- Rotations
- Color
- Alpha
- Mapping
- Default or Planar
- Shiny
- High, Medium, Low or None
- Bump Mapping
- All the bumpy options are recorded
- Fullbright
- Glow
This is early days for this idea (I may possibly rework it sometime) and there are limits. The amount of data that can be stored to a Notecard being one of them. Very large prim-count objects with complex prims (hollowed and path cut boxes having up to 9 faces for example) may create too much data to be stored to one Notecard. Sorry bout that.
<lsl>// V2 //
SpewConfig(integer nol) {
llSetObjectName(""); llOwnerSay("/me /n!!!!!!!!!!----CONFIGURATION START----!!!!!!!!!!"); integer ln = 1; do { list s = []; list p = []; integer c = 0; integer f = 0; integer l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [17, -1]))); do { llOwnerSay("/me " + llDumpList2String([17, (f++)] + llList2List(s, c, (c + 3)), ",")); c += 4; } while(c < l); c = 0; f = 0; l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [18, -1]))); do { llOwnerSay("/me " + llDumpList2String([18, (f++)] + llList2List(s, c, (c + 1)), ",")); c += 2; } while(c < l); c = 0; f = 0; l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [19, -1]))); do { p += [19, (f++)] + llList2List(s, c, (c + 1)); c += 2; } while(c < l); llOwnerSay("/me " + llDumpList2String(p, ",")); p = []; c = 0; f = 0; l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [20, -1]))); do p += [20, (f++)] + llList2List(s, c, c); while((++c) < l); llOwnerSay("/me " + llDumpList2String(p, ",")); p = []; c = 0; f = 0; l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [22, -1]))); do p += [22, (f++)] + llList2List(s, c, c); while((++c) < l); llOwnerSay("/me " + llDumpList2String(p, ",")); p = []; c = 0; f = 0; l = llGetListLength((s = llGetLinkPrimitiveParams(ln, [25, -1]))); do p += [25, (f++)] + llList2List(s, c, c); while((++c) < l); llOwnerSay("/me " + llDumpList2String(p, ",")); llOwnerSay("/me LINK"); } while((++ln) <= nol); llOwnerSay("/me !!!!!!!!!!----CONFIGURATION END----!!!!!!!!!!\n"); llSetObjectName(my_name);
}
list TypeCast(list p) {
list P = []; list c = []; integer int = 0; integer count = 0; integer length = llGetListLength(p); do { if((int = ((integer)llList2String((c = llCSV2List(llList2String(p, count))), 0))) == 17) { P += [int, ((integer)llList2String(c, 1)), ((key)llList2String(c, 2)), ((vector)llList2String(c, 3)), ((vector)llList2String(c, 4)), ((float)llList2String(c, 5))]; } else if(int == 18) { P += [int, ((integer)llList2String(c, 1)), ((vector)llList2String(c, 2)), ((float)llList2String(c, 3))]; } else { integer l = (llGetListLength(c) - 1); integer i = -1; if(int == 19) { do { ++i; P += [int, ((integer)llList2String(c, (++i))), ((integer)llList2String(c, (++i))), ((integer)llList2String(c, (++i)))]; } while(i < l); } else if((int == 20) | (int == 22)) { do { ++i; P += [int, ((integer)llList2String(c, (++i))), ((integer)llList2String(c, (++i)))]; } while(i < l); } else if(int == 25) { do { ++i; P += [int, ((integer)llList2String(c, (++i))), ((float)llList2String(c, (++i)))]; } while(i < l); } } } while((++count) < length); return P;
}
key iq;
key owner;
integer lis;
integer link;
integer nclc;
list params = [];
string my_name = "";
integer channel = -4756297; // The channel for dialog coms. Keep it negative and in the millions.
string present = "Default"; // The name of your default configuration NC
default {
state_entry() { owner = llGetOwner(); my_name = llGetObjectName(); } touch_start(integer nd) { if(llDetectedKey(0) == owner) { integer inn = llGetInventoryNumber(INVENTORY_NOTECARD); if(inn) { list ncn = []; while(inn) ncn += [llGetInventoryName(INVENTORY_NOTECARD, (--inn))]; llListenRemove(lis); lis = llListen(channel, llKey2Name(owner), owner, ""); llDialog(owner, ("\n\nChoose your texture configuration.\nThe present configuration is - \"" + present + "\""), ncn, channel); llSetTimerEvent(60.0); } else { // Could just jump right to it but, this stops accidental activation. llListenRemove(lis); lis = llListen(channel, llKey2Name(owner), owner, "Config"); llDialog(owner, "\n\nClick \"Config\" when the objects texturing is set.", ["Config"], channel); llSetTimerEvent(10.0); } } } timer() { llSetTimerEvent(0.0); llListenRemove(lis); llOwnerSay("The listen has been removed by timer."); } dataserver(key q, string data) { if((q == iq) && (data != EOF)) { if((data = llStringTrim(data, STRING_TRIM)) != "LINK") params += [data]; else { llSetLinkPrimitiveParamsFast((++link), TypeCast(params)); params = []; } iq = llGetNotecardLine(present, (++nclc)); } } listen(integer chan, string name, key id, string msg) { llSetTimerEvent(0.0); llListenRemove(lis); if(msg == "Config") SpewConfig(llGetObjectPrimCount(llGetKey())); else { params = []; link = 0; iq = llGetNotecardLine((present = msg), (nclc = 0)); } } changed(integer change) { if(change & (CHANGED_OWNER | CHANGED_INVENTORY)) llResetScript(); }
}</lsl>
Zippadeedoodah (Teleporter)
These are those "sit & go" type prim based teleporters that you might use to get from the ground to a skybox (or similar). It uses a function that uses almost no memory compared with and as opposed to another popular function performing a similar task.
- Add the destination as a comma separated string of three numbers to the description of the prim the script is in (ideally the root).
- E.g. 36,128,4000.5
- The numbers represent the X,Y and Z coordinates of the destination on the region the scripted object is on.
When you sit on the object the operation happens automatically.
- Thanks to Strife Onizuka for helping improve this function (and my knowledge).
Temp Rez Version ( V7 )
This version is a one way, self deleting type. E.g. An object containing this script could be rezzed by a sign when touched allowing visitors to use the rezzed teleporter to be taken directly to areas of a region/parcel. Since the sign could be just 1 prim providing multiple destinations and each rezzed teleporter is both temporary and phantom the savings on both prim count and server stress are obvious.
<lsl>// V7 //
Zippadeedoodah(vector dest) // Feed in the destination vector. {
integer l_num = (!!llGetLinkNumber()); // Establish the link number of the root. list params = [6, dest]; // Create the parameters for llSetPrimParamsFast. // Loop while the distance between the root and dest is greater than 0.001 meter. while(llVecDist(llGetRootPosition(), dest) > 0.001) llSetLinkPrimitiveParamsFast(l_num, params); // Each iteration attempt to move to dest.
}
default {
on_rez(integer param) { llSetClickAction(CLICK_ACTION_SIT); // Makes the prim "Click to sit". llSetLinkPrimitiveParamsFast(-1, [PRIM_TEMP_ON_REZ, TRUE, // Make the object temporary. PRIM_PHANTOM, TRUE]); // And phantom. // Makes the object less intensive for the region. Also makes a smoother llUnSit. } changed(integer change) { if(change & CHANGED_LINK) // If an avatar sits on the object they become one of the links. { integer links = 0; // Create an integer type variable if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims())) // Check if there are more links than prims. { llSetLinkPrimitiveParamsFast(-1, [PRIM_TEMP_ON_REZ, TRUE]); // Make the object temporary. Zippadeedoodah(((vector)("<" + llGetObjectDesc() + ">"))); // Call the function to transport us. llUnSit(llGetLinkKey(links)); // When we arrive, Un-Sit the key that is not a prim. llDie(); // Delete the object. } } }
}</lsl>
Permanent Version ( V9 )
This version drops the user off at the destination then either waits for the set time or goes straight back home to be reused.
<lsl>// V9 //
float time = 3600.0; // The time in seconds to wait before returning to home position.
// If set to zero, the return home for the object will be immediate.
/////////////////////////////////////////////////////////////////////////////////////////
Zippadeedoodah(vector dest) // Feed in the destination vector. {
integer l_num = (!!llGetLinkNumber()); // Establish the link number of the root. list params = [6, dest]; // Create the parameters for llSetPrimParamsFast. // Loop while the distance between the root and dest is greater than 0.001 meter. while(llVecDist(llGetRootPosition(), dest) > 0.001) llSetLinkPrimitiveParamsFast(l_num, params); // Each iteration attempt to move to dest.
}
vector home; // Used to store the home position.
default {
state_entry() { home = llGetRootPosition(); // Establish where our home pos is. // For this reason, Reset the script when the home position of the object is chosen. llSetClickAction(CLICK_ACTION_SIT); // Makes the prim "Click to sit". llSetStatus(STATUS_PHANTOM, TRUE); // Makes the object less intensive for the region. } // Also makes a smoother llUnSit. changed(integer change) { if(change & CHANGED_LINK) // If an avatar sits on the object they become one of the links. { integer links = 0; // Create an integer type variable if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims())) // Check if there are more links than prims. { vector Dest; // Create a vector type variable. if(llVecDist(llGetRootPosition(), (Dest = ((vector)("<" + llGetObjectDesc() + ">")))) > 0.0015) { // Check if the object is near destination. If not, go there. Zippadeedoodah(Dest); // Call the function to transport us. llUnSit(llGetLinkKey(links)); // When we arrive, Un-Sit the key that is not a prim. if(((integer)time)) llSetTimerEvent(time); // Start a timer. else Zippadeedoodah(home); // Go back home. } else llUnSit(llGetLinkKey(links)); // Un-Sit the key that is not a prim. } } } timer() { llSetTimerEvent(0.0); // Cancel the timer. Zippadeedoodah(home); // Go back home. }
}</lsl>
More Scripts...
Free Scripts (content constantly updating)
More Free Scripts (content constantly updating)
Even More Free Scripts (content constantly updating)
Even More More Free Scripts (content constantly updating)
Even More More More Free Scripts (this page)
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