What is this?
The below is a document that was included with the Second Life client and is kept here for historical documentation. For a more accurate and updated LSL reference see http://lslwiki.net.
Linden Scripting Language Reference
Table of Contents
touch_start(integer total_number)
touch_end(integer total_number)
collision_start(integer total_number)
collision(integer total_number)
collision_end(integer total_number)
land_collision_start(vector position)
land_collision(vector position)
land_collision_end(vector position)
listen(integer channel, string name, key id, string message)
control(key name, integer levels, integer edges)
at_target(integer number, vector targetpos, vector ourpos)
at_rot_target(integer number, rotation targetrot, rotation ourrot)
money(key giver, integer amount)
email(string time, string address, string subject, string body, integer remaining)
run_time_permissions(integer permissions)
link_message(integer sender_num, integer num, string str, key id)
This document is broken down into three major sections: Introduction, User’s Manual, and Reference Manual. The Introduction provides a high level review of the Linden Scripting Language (LSL) and how it is used within Linden World. The User’s Manual provides a more detailed review of the syntax and functionality of LSL and provides sample code. The Reference Manual provides detailed information on the underlying code and data structures, byte code format, and execution model. This document assumes that the reader has a working knowledge of programming and is familiar with a high level language like Java or C.
LSL was designed with the following goals in mind:
·Provide a robust method for users to add behavior to objects in Linden World
·Provide a simple interface to exchange scripts and to modify tuning values
·Provide a powerful language for advanced users
·Ensure that user scripts cannot crash a simulator or greatly reduce simulator performance
LSL is a Java-like language incorporating several extensions. It sticks to the well known C/Java syntactic style, but allows tuning variables to be exposed via a GUI to allow users with no programming knowledge to modify scripts. Much like faces or textures, this will allow an economy to evolve around well written scripts.
Multiple scripts may also be attached to the same object, allowing a style of small, single-function scripts to evolve. This leads to scripts that perform specific functions (“hover”, “follow”, etc.) and allows them to be combined to form new behaviors.
The text of the script is compiled into an executable byte code, much like Java. This byte code is then run within a virtual machine on the simulator. Each script receives a time slice of the total simulator time allocated to scripts, so a simulator with many scripts would allow each individual script less time rather than degrading its own performance. In addition, each script executes within its own chunk of memory, preventing scripts from writing into protected simulator memory or into other scripts, making it much harder for scripts to crash the simulator.
The following LSL code opens a door when the user speaks the magic word. It handles the concepts of user chats, exposure of global tuning variables, and calls library functions.
// exposed global variables accessible via GUI
// the phrase the user will use
string gMagicPhrase = "Shazamm!";
// how fast the door opens
float gOpenTime = 1.0;
// global variables that aren’t exposed
integer gSteps = 20; // the door moves through 20 steps
vector gOffset = <0.0, 0.0, 0.10>; // 2 meters of total motion
// states the script can be in
// all scripts start in the default state
default
{
// setup to listen only for magic phrase
state_entry()
{
llSay(0, "To open me, say " + gMagicPhrase);
// listen on chat channel 0 for the magic phrase from anyone
llListen(0, "", "", gMagicPhrase);
}
// handle chat messages that we’re listening for
listen(integer channel, string name, key id, string message)
{
integer i;
vector basepos = llGetPos();
// loop through the steps, adjusting the door
for (i = 0; i < gSteps; i++)
{
// set the object's position
llSetPos(basepos + i*gOffset);
llSleep(0.1);
}
// now, flip the offset vector to move us back down
gOffset *= -1;
}
}
The key elements of this example are:
·The default state. All scripts must have a default state, which is the state that scripts start out in.
·The state_entry and chat event handlers. LSL uses an event execution model, meaning that events cause specific pieces of code to execute. In this script, the state_entry event is executed at script start when we enter the default state.
·Library function calls. Any function that begins with “ll” is a library function call. In this example, llListen tells the script to listen for the magic words. If those words are heard, the chat event is executed.
·The overall syntax (bracing and keywords) is
very similar to Java/C.
User’s Manual
LSL is loosely based on Java/C syntax with significant changes as detailed below.
Below is an example LSL script:
// global variable that isn’t exposed
vector gStartPosition;
// global functions that can be called from any state
make_physical_and_spin(vector torque)
{
// double the torque because we want to
vector double_torque = 2.0*torque;
llSetTorque(double_torque, FALSE);
}
// state sections
// default state – all scripts must have a default state
default
{
// when a state is transitioned to, the state_entry event is raised
state_entry()
{
// Make physical so it can move
llSetStatus(STATUS_PHYSICS, TRUE);
// get the base stating position
gStartPosition = llGetPos();
// Move to 2 meters above the start position
gStartPosition.z += 2.0;
llMoveToTarget(gStartPosition, 0.5);
// transition to spin state
state SpinState;
}
// when a state is transitioned out of, the state_exit event is raised
state_exit()
{
// set critical damping to keep us on our stating location, with time constant of 0.5 seconds
llMoveToTarget(gStartPosition, 0.5);
}
}
// SpinState is a user defined state
state SpinState
{
state_entry()
{
// say hello on channel 0
llSay(0, "Starting to spin");
// call global function
make_physical_and_spin(<0.1, 0.1, 0.0>);
}
}
The LSL file is broken up as follows:
LSL variables are case sensitive, made up of letters, numbers, and underscores, and must start with a letter or underscore.
Global variables and functions are accessible from anywhere in the file. Global variables are declared much like Java or C, although only one declaration may be made per line:
vector gStartPosition;
Global variables may also be initialized if desired, although uninitialized global and local variables are initialized to legal zero values:
vector gStartPosition = <10.0,10.0,10.0>;
Global functions are also declared much like Java/C, with the exception that no “void” return value exists. Instead, if no return value is needed, just don’t specify one:
make_physical_and_spin(vector torque)
{
// double the torque because we want to
vector double_torque = 2.0*torque;
llSetState(STATUS_PHYSICS, TRUE);
llApplyTorque(double _torque);
}
Local variables are scoped below their declaration within the block of code they are declared in and may be declared within any block of code. Thus the following code is legal and will work like C:
Integer test_function()
{
// Test vector that we can use anywhere in the function
vector test = <1,2,3>;
integer j;
for (j = 0; j < 10; j++)
{
// This vector is a different variable than the one declared above
// This IS NOT good coding practice
vector test = <j, j, j>;
}
// this test fails
if (test == <9,9,9>)
{
// never reached
}
}
All scripts must have a default state, which is the state the script starts in. States contain event handlers that are triggered by the LSL virtual machine. States must have at least one event handler, but can choose which handlers to use. Some handlers, like listen, require that the script call a library function to setup information that determines when the event happens.
The example code sets the global variable gStartPosition within the state_entry event handler, which is set when the script begins execution.
default
{
// when a state is transitioned to, the state_entry event is raised
state_entry()
{
// get the base stating position
gStartPosition = llGetPos();
// transition to spin state
state SpinState;
}
// when a state is transitioned out of, the state_exit event is raised
state_exit()
{
// set critical damping to keep us on our stating location, with time constant of 0.5 seconds
llMoveToTarget(gStartPosition, 0.5);
}
}
The command state SpinState changes the state to the SpinState state and raises the state_exit event, causing that handler to be called.
The user state SpinState works like the default state.
state SpinState
{
state_entry()
{
// say hello on channel 0
llSay(0, gHello);
// call global function
make_physical_and_spin(<10.0, 10.0, 0.0>);
}
}
LSL uses Java/C++ style single line comments:
// Name and Description
LSL supports the following basic types:
·integer
Signed, 32-bit integer value
·float
32-bit floating point value
·string
A sequence of characters
“\” functions as an escape character, so use “\n” to enter a carriage return into a string, “\t” to enter a 4 space tab, “\\” to enter a backslash, “\”” to enter a double quote, and “\” followed by any other character to enter that character. Note that the C conventions of \ooo and \xhh are not supported.
·key
A unique identifier that can used to reference objects in Linden World
·vector
3 floats that can be acted on together
Members are accessed via .x, .y. or .z.
4 floats that represent a rotation
Members are accessed via .x, .y., .z, or .w.
·list
A heterogeneous list of the other data types
Lists are created via comma separated lists of the other data types enclosed by “[“ and “]”.
string StringVar = "Hello, Carbon Unit";
list MyList = [ 1234, ZERO_ROTATION, StringVar ];
Give this list:
[ 1234, <0,0,0,1>, "Hello, Carbon Unit" ]
Lists may be combined with other lists or variables to form larger lists:
MyList = 3.14159 + MyList;
This would give the list:
[ 3.14159, 1234, <0,0,0,1>, "Hello, Carbon Unit" ]
MyList = MyList + MyList ;
[ 3.14159, 1234, <0,0,0,1>, "Hello, Carbon Unit", 3.14159, 1234, <0,0,0,1>, "Hello, Carbon Unit" ]
Library function are used to copy data from lists, sort lists, copy/remove sublists.
LSL supports a wide range of arithmetic operations between its basic types using Java/C syntax.
float foo_float = 4.0;
integer foo_int = 4;
vector foo_vector = <1,1,1>;
rotation foo_rotation = <1,0,0,0>;
// scale up vector
foo_vector = foo_int * foo_vector;
// rotate vector by rotation
foo_vector = foo_vector * foo_rotation;
// mix integer and floats
foo_float = foo_float * foo_int;
Type conversion can either occur implicitly or explicitly. Explicit type casts are accomplished using C syntax:
float foo_float = 1.0;
integer foo_int =(integer)foo_float;
LSL only supports two implicit type casts: integer to float and string to key.
LSL supports the following explicit casts:
·Integer to String
·Float to Integer
·Float to String
·Vector to String
·Rotation to String
·Integer to List
·Float to List
·Key to List
·String to List
·Vector to List
·Rotation to List
·String to Integer
·String to Float
·String to Vector
·String to Rotation
LSL supports several C/Java loop structures.
The LSL for loop operates like the Java/C loop structure except that variables may not be declared within the for command:
integer j;
integer count = 10;
for (j = 0; j < count; j++)
{
// do stuff here
}
The LSL do-while loop operates like the Java/C loop structure:
integer j;
integer count = 10;
do
{
// do stuff here and increment j
} while (j < count);
The LSL while loop operates like the Java/C loop structure:
integer j;
integer count = 10;
while (j < count)
{
// do stuff here and increment j
}
LSL supports if and if-else conditional statements.
The LSL if statements operates just like the Java/C versions:
integer small = 1;
integer big = 10;
if (small < big)
{
// we get here!
}
The LSL if-else statements operates just like the Java/C versions:
integer small = 1;
integer big = 10;
if (small < big)
{
// we get here!
}
else
{
// we don’t get here
}
LSL supports a jump statement within functions or event handlers.
@Label;
// do stuff
jump Label;
This new firework script work similarly to the original. Note that this script requires that sounds names “whoosh” and “boom” be in the object it is attached to, as well as textures “smoke” and “spark.”
// new and improved firework
// global variable for timing when the firework explodes
float gTotalTime = 0.0;
// how often do we put out little smoke poofs
float gPoofInterval = 0.1;
// what direction are we flying
vector gDirection;
// all scripts start in the default state
default
{
state_entry()
{
llSay(0, "Touch me to launch!");
llSetStatus(STATUS_PHYSICS, TRUE);
}
// if an avatar touches us and then let's go this event is triggered
touch_end(integer num)
{
// only launch if we're physical
if (llGetStatus(STATUS_PHYSICS))
{
// we'll use the timer callback to make smoke poofs, fly upwards, and blowup
// use a long initial delay for dramatic effect
llSetTimerEvent(1.0);
// get our up vector and create a strong upwards impulse to pop us upwards
gDirection = <0.0, 0.0, 1.0> * llGetMass() * 15.0;
llApplyImpulse(gDirection, TRUE);
llSetTorque(<0.0,0.0,2.0>, TRUE);
// make a continuous sound of us flying updards
llLoopSound("whoosh", 2.0);
// make a puff of smoke to show our launch
llMakeExplosion(20, 1.0, 2, 5.0, 0.2, "smoke", <0.0, 0.0, 0.0>);
}
}
// called every gPoofInterval seconds
timer()
{
// again, get our up vector to apply thrust along
gDirection = <0.0, 0.0, 1.0> * llGetMass() * 20.0 * gTotalTime;
// also apply a torque to make it rotate along the vertical axis
llSetForceAndTorque(gDirection, <0.0,0.0,5.0>, TRUE);
// bump up the time
gTotalTime += gPoofInterval;
// do we need to explode?
if (gTotalTime > 3.0)
{
// Turn off the continuous sound
llStopSound();
// Make an explosion sound
llTriggerSound("boom", 2.0);
// The explosion arguments are number of particles, scale of particles,
// speed of particles, lifetime of paricles, how directional the particles are,
// with a smaller number being more directional, and the UUID of the texture used
llMakeExplosion(40, 1.0, 20.0, 2.0, 1.0, "poof", <0.0, 0.0, 0.0>);
// Kill ourself
llDie();
}
else
{
// we'll use the timer callback to make smoke poofs, fly upwards, and blowup
llSetTimerEvent(gPoofInterval);
// make a small smoke poof
llMakeExplosion(10, 1.0, 2, 5.0, 0.2, "smoke", <0.0, 0.0, 0.0>);
}
}
}
This script illustrates how to make a script that reacts to money being given to it and gives money to a user.
// A simple gambling script
// all scripts start in the default state
default
{
// tell people what to do
state_entry()
{
// Need to ask owner for permission to debit account
key owner = llGetOwner();
llRequestPermissions(owner, PERMISSION_DEBIT);
// The first argument in the llSay library function says what channel to use
// Only channel 0 is audible by avatars
llSay(0, "Give me money!");
}
// being given money triggers this callback
money(key name, integer amount)
{
// Currently the type cast doesn't bind correctly, so extra parenthesis are needed
// to properly typecast in arithmetic expressions
// This is also a way to see what your UUID is
llSay(0, "Thanks " + ((string)name) + " for the " + ((string)amount) + " L$!");
// This gambling script has a 1 in 10 chance of winning but only pays 5 to 1, which
// isn't very good odds
if (llFrand(1.0) > 0.9)
{
llSay(0, "You WIN " + ((string)(amount * 5)));
// the llGiveMoney library call allows you to remotely transfer money to another user
llGiveMoney(name, amount * 5);
}
}
}
This combination of scripts create a cannonball that explodes when it hits the ground, blocker bricks that explode when cannonballs hit them, a cannon that fires cannon balls, and a fuse that causes the cannon to fire. The cannonball needs to be saved into your inventory so that its UUID can be used in the cannon script. Be aware that since the cannonball explodes when in contact with the ground, you’ll need to place it on an object that you’ve dragged into the air. The cannon, cannon ball, and blocker bricks will need the sound “boom” and the texture “poof” and the fuse will need texture “poof.” The cannon will also need the object cannon ball in it’s inventory.
// cannon script
// Global variable that provides for a minimum delay between shots
float gReloadTime = 1.0;
// A global function that creates an explosion, a sound, and then kills itself
die()
{
// The sound arguments are UUID of the sound, volume of the sound,
// whether the sound is continuous or not, and whether to cancel the sound or not
llTriggerSound("boom", 2.0);
// The explosion arguments are number of particles, scale of particles,
// speed of particles, lifetime of paricles, how directional the particles are,
// with a smaller number being more directional, and the UUID of the texture used
llMakeExplosion(60, 1.0, 10.0, 2.0, 1.0, "poof", <0.0, 0.0, 0.0>);
llDie();
}
// all scripts start in the default state
default
{
// setup when script first starts running
state_entry()
{
// make sure the object is physical so that the llMoveToTarget library call works
llSetStatus(STATUS_PHYSICS, TRUE);
// setup listen callback for chat channel 1 and the text "fire"
integer num = llListen(1, "","","fire");
// fix us on the position where we are
vector pos = llGetPos();
// the 0.1 in the MoveToTarget call makes the object move there quickly
llMoveToTarget(pos, 0.1);
}
// if an avatar moves the cannon, relock to that point
touch_end(integer num)
{
// because only we only be moving to one target at a time, this call replaces the previous one
vector pos = llGetPos();
llMoveToTarget(pos, 0.1);
}
// this listen event will be triggered by chat text of "fire" on channel 1
listen(integer chan, string name, key id, string text)
{
// trigger a sound and make a smoke poof to indicate firing
llTriggerSound("boom", 2.0);
llMakeExplosion(10, 1.0, 2.0, 5.0, 0.2, "poof", <0.0, 0.0, 0.0>);
// determine where we're going to fire the cannonball
rotation rot = llGetRot();
// extract our "up" direction from our rotation
vector direction = llRot2Up(rot);
// create a small offset so that the cannonball isn't created inside the cannon
vector pos = llGetPos();
pos += direction;
// generate a velocity of 30 meters/second
direction *= 30.0;
// create the cannonball
// the llRexObject arguments are the owner's UUID, the object to rez-ed UUID, the position to rez the object,
// the velocity of the object, and the rotation of the object
llRezObject("cannon ball", pos, direction, <0,0,0,1>, 0);
// put the cannon to sleep until reload time is over
llSleep(gReloadTime);
}
// if a cannonball hits us, blow up
collision_start(integer total_num)
{
// only blow up if it's a cannonball
key test = llDetectedKey(0);
if (test ==(key)"cannonball")
die();
}
}
// cannon ball
// A global function that creates an explosion, a sound, and then kills itself
die()
{
llTriggerSound("boom", 2.0);
llMakeExplosion(80, 1.0, 13.0, 2.2, 1.0, "poof", <0.0, 0.0, 0.0>);
llDie();
}
// all scripts start in the default state
default
{
// make sure that we are physical so that we fly through the air when created
state_entry()
{
llSetStatus(STATUS_PHYSICS, TRUE);
}
// when we hit the ground, explode and die
land_collision_start(vector pos)
{
die();
}
}
// fuse script
float gScale = 1.0;
// all scripts start in the default state
default
{
touch_end(integer total_num)
{
llSetTimerEvent(0.2);
llMakeSmoke(10, 0.2, 3.0, 3.0, 0.10, "poof", <0,0,0>);
llSleep(0.5);
}
timer()
{
vector scale = llGetScale();
scale.z = gScale;
gScale -= 0.05;
llSetScale(scale);
llMakeSmoke(2, 0.2, 3.0, 3.0, 0.10, "poof", <0,0,0>);
if (gScale < 0.2)
{
llSay(1, "fire");
gScale = 1.0;
scale.z = gScale;
llSetScale(scale);
llSetTimerEvent(0.0);
}
}
}
// blockerbrick
// A global function that creates an explosion, a sound, and then kills itself
die()
{
// The sound arguments are UUID of the sound, volume of the sound,
// whether the sound is continuous or not, and whether to cancel the sound or not
llTriggerSound("boom", 2.0);
// The explosion arguments are number of particles, scale of particles,
// speed of particles, lifetime of paricles, how directional the particles are,
// with a smaller number being more directional, and the UUID of the texture used
llMakeExplosion(20, 1.0, 10.0, 2.0, 1.0, "poof", <0.0, 0.0, 0.0>);
// Kill ourself
llDie();
}
// all scripts start in the default state
default
{
// if a cannonball hits us, explode
collision_start(integer total_num)
{
string test = llDetectedName(0);
if (test == "cannon ball")
die();
}
}
The following events may be handled within states.
The state_entry event occurs whenever a new state is entered, including program start, and is always the first event handled. No data is passed to handler.
The state_entry event occurs whenever the state command is used to transition to another state. It is handled before the new state’s state_entry event.
This event is raised when a user first touches the object the script is attached to. The number of touching objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions.
This event is raised while a user is touching the object the script is attached to. The number of touching objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions.
This event is raised when a user stops touching the object the script is attached to. The number of touching objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions.
This event is raised when another object begins to collide with the object the script is attached to. The number of detected objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions. (Collisions are also generated if a user walks into an object.)
This event is raised while another object is colliding with the object the script is attached to. The number of detected objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions. (Collisions are also generated if a user walks into an object.)
This event is raised when another object stops colliding with the object the script is attached to. The number of detected objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions. (Collisions are also generated if a user walks into an object.)
This event is raised when the object the script is attached to begins to collide with the ground.
This event is raised when the object the script is attached to is colliding with the ground.
This event is raised when the object the script is attached to stops colliding with the ground.
This event is raised at regular intervals set by the llSetTimerEvent library function.
This event is raised whenever a chat message matching the constraints passed in the llListen command is heard. The name and key of the speaker and the message are passed. Channel 0 is the public chat channel that all avatars see as chat text. Channels 1 – 2,147,483,648 are private channels that aren’t sent to avatars but other scripts can listen for.
This event is raised whenever objects matching the constraints of the llSensor command are detected. The number of detected objects is passed to the script. Information on those objects may be gathered via the llDetected* library functions.
This event is raised when sensors are active (via the llSensor library call) but are not sensing anything.
Once a script has the ability to grab control inputs from the avatar, this event will be used to pass the commands into the script.
When a script comes within a defined range of a target position (defined by llTarget library call) this event is raised.
When a target is set (via the llTarget library call) but the script is outside the specified range this event is raised.
When a script comes within a defined angle of a target rotation (defined by llRotTarget library call) this event is raised.
When a target is set (via the llRotTarget library call) but the script is outside the specified angle this event is raised.
User giver has given an amount of Linden dollars to the object.
An email sent to the object this script was attached to was waiting on the dataserver. The remaining tells how many more emails are waiting.
Scripts need permission from either the owner or the avatar they wish to act on before they perform certain functions, such as debiting money from their owner’s account, triggering an animation on an avatar, or capturing control inputs. The llRequestPermissions library function is used to request these permissions and the various permissions integer constants can be supplied. The integer returned to this event handler contains the current set of permissions flags, so if permissions == 0 then no permissions are set.
Triggered when various events change the object. Test change with CHANGED_INVENTORY, CHANGED_COLOR, CHANGED_SHAPE, CHANGED_SCALE, CHANGED_TEXTURE, or CHANGED_LINK.
Triggered whenever a object with this script is attached or detached from an avatar. If it is attached, attached is the key of the avatar it is attached to, otherwise attached == NULL_KEY.
Triggered whenever a object with this script starts moving.
Triggered whenever a object with this script stops moving.
Triggered whenever a object is rez-ed from inventory or by another object. The start_param is the start parameter passed by llRezObject.
Triggered when object receives a link message via LLMessageLinked library function call.
Triggered when object rez-es in another object from its inventory.
Triggered when the requested data is returned to the script. Data may be requested by the llRequestAgentData, the llRequestInventoryData, and the llGetNotecardLine function calls.
LSL2 supports many arithmetic operations by default.
The assignment operator, =, is used by all types. The equals, ==, and not equals, !=, operators are also used by all types. The various inequality operators, <, >, <=, >=, are defined for integer and float types.
LSL2 supports +, -, *, /, %, &&, ||, !, ~, %, | , and ^. All operations have the same meanings as their C counterparts.
LSL2 supports the following integer constants:
·Boolean values: TRUE and FALSE
·Status flags (can be or’ed together) for llSetStatus and llGetStatus library calls:
STATUS_PHYSICS controls whether the object can move physically
STATUS_PHANTOM controls whether the object collides or not STATUS_ROTATE_X,
STATUS_ROTATE_Y, and
STATUS_ROTATE_Z control whether the object can rotate around the specific axis or not
STATUS_BLOCK_GRAB controls whether the object can be grabbed STATUS_SANDBOX controls whether the object can cross region boundaries and move more than 20 meters from its creation point
STATUS_DIE_AT_EDGE controls whether the object is returned to the owner’s inventory if it wanders off the edge of the world
·Object type description (can be or’ed together) for sensor library calls: AGENT, ACTIVE, PASSIVE, and SCRIPTED
·Permissions constants (can be or’ed together):
PERMISSION_DEBIT, PERMISSION_TAKE_CONTROLS, PERMISSION_REMAP_CONTROLS, PERMISSION_TRIGGER_ANIMATION, PERMISSION_ATTACH, PERMISSION_RELEASE_OWNERSHIP, PERMISSION_CHANGE_LINKS, PERMISSION_CHANGE_JOINTS, PERMISSION_CHANGE_PERMISSIONS
·Inventory constants used for managing object’s inventory:
INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_NOTECARD, INVENTORY_BODYPART
·Attachment constants for attaching to avatars via llAttachToAvatar:
ATTACH_CHEST
ATTACH_HEAD
ATTACH_LSHOULDER
ATTACH_RSHOULDER
ATTACH_LHAND
ATTACH_RHAND
ATTACH_LFOOT
ATTACH_RFOOT
ATTACH_BACK
ATTACH_PELVIS
ATTACH_MOUTH
ATTACH_CHIN
ATTACH_LEAR
ATTACH_REAR
ATTACH_LEYE
ATTACH_REYE
ATTACH_NOSE
ATTACH_RUARM
ATTACH_RLARM
ATTACH_LUARM
ATTACH_LLARM
ATTACH_RHIP
ATTACH_RULEG
ATTACH_RLLEG
ATTACH_LHIP
ATTACH_LULEG
ATTACH_LLLEG
ATTACH_BELLY
ATTACH_RPEC
ATTACH_LPEC
·Attachment constants for llModifyLand:
LAND_LEVEL, LAND_RAISE, LAND_LOWER, LAND_SMALL_BRUSH, LAND_MEDIUM_BRUSH, LAND_LARGE_BRUSH
·Link constants for llSetLinkColor, llMessageLinked:
LINK_SET, LINK_ROOT, LINK_ALL_OTHERS, LINK_ALL_CHILDREN
·Control constants for use in llTakeControls and in the control event handler:
CONTROL_FWD Tests for avatar forward control
CONTROL_BACK Tests for avatar back control
CONTROL_LEFT Tests for avatar move left control
CONTROL_RIGHT Tests for avatar move right control
CONTROL_ROT_LEFT Tests for avatar rotate left control
CONTROL_ROT_RIGHT Tests for avatar rotate right control
CONTROL_UP Tests for avatar up control
CONTROL_DOWN Tests for avatar down control
CONTROL_LBUTTON Tests for avatar left button control
CONTROL_ML_LBUTTON Tests for avatar left button control with the avatar in mouse look
·Change constants are passed into the changed event handler:
CHANGED_INVENTORY test for changed object inventory
CHANGED_COLOR tests for changed object color
CHANGED_SHAPE tests for changed object shape (box to cylinder, for example)
CHANGED_SCALE tests for changed object scale
CHANGED_TEXTURE tests for changed object texture or texture offset, scale or rotation
CHANGED_LINK tests for linking of delinking
·List type constants are used to determine the type of list members:
TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_KEY, TYPE_VECTOR, TYPE_ROTATION, TYPE_INVALID
·llGetAgentInfo return values:
AGENT_FLYING if the agent is flying
AGENT_ATTACHMENTS if the agent has attachments
AGENT_SCRIPTED if the agent has scripted attachments
LSL2 supports +, -, *, and /. All operations have the same meanings as their C counterparts.
LSL2 supports the following floating point constants:
·PI 3.14159265
·TWO_PI 6.28318530
·PI_BY_TWO 1.57079633
·DEG_TO_RAD 0.01745329
·RAD_TO_DEG 57.2957795
·SQRT2 1.41421356
LSL2 supports +, -, *, and %, with * defining the vector dot product and % the vector cross product. Vectors may also be multiplied by integers and floats to scale them, and rotations to rotate them.
LSL2 supports +, -, and *.
LSL2 supports + for concatenation.
LSL2 supports one key constant which acts as an invalid key:
·NULL_KEY
float llSin(float theta);
Returns the sine of theta radians.
float llCos(float theta);
Returns the cosine of theta radians.
float llTan(float theta);
Returns the tangent of theta radians.
float llAtan2(float y, float x);
Returns the arctangent2 of y, x.
float llSqrt(float val);
Returns the square root of val. If val < 0.0 return 0.0 and raise a math runtime error.
float llSqrt(float base, float exp);
Returns base raised to exp.
integer llAbs(integer val);
Returns the absolute value of val.
float llFabs(float val);
Returns the absolute value of val.
float llFrand(float mag);
Returns a pseudo-random number between [0, mag).
integer llFloor(float val);
Returns largest integer value <= val.
integer llCeil(float val);
Returns largest integer value >= val.
integer llRound(float val);
Returns val rounded to the nearest integer.
float llVecMag(vector vec);
Returns the magnitude of vec.
vector llVecNorm(vector vec);
Returns vec normalized.
float llVecDist(vector a, vector b);
Returns the distance from a to b.
vector llRot2Euler(rotation rot);
Returns the Euler Angle representation of rot.
rotation llEuler2Rot (vector vec);
Returns the rotation represented by Euler Angle vec.
rotation llAxes2Rot (vector fwd, vector left, vector up);
Returns the rotation represented by coordinate axes fwd, left, and up.
vector llRot2Fwd (rotation rot);
Returns the forward axis represented by rot.
vector llRot2Left (rotation rot);
Returns the left axis represented by rot.
vector llRot2Up (rotation rot);
Returns the up axis represented by rot.
rotation llRotBetween (vector a, vector b);
Returns the rotation needed to rotate a to b.
llWhisper(integer channel, string text);
Whisper text on channel. Channel 0 is the public chat channel that all avatars see as chat text. Channels 1 – 2,147,483,648 are private channels that aren’t sent to avatars but other scripts can listen for.
llSay(integer channel, string text);
Say text on channel. Channel 0 is the public chat channel that all avatars see as chat text. Channels 1 – 2,147,483,648 are private channels that aren’t sent to avatars but other scripts can listen for.
llShout(integer channel, string text);
Shout text on channel. Channel 0 is the public chat channel that all avatars see as chat text. Channels 1 – 2,147,483,648 are private channels that aren’t sent to avatars but other scripts can listen for.
integer llListen(integer channel, string name, key id, string msg);
Sets a listen event callback for msg on channel from name (name, id and/or msg can be empty) and returns an identifier that can be used to deactivate or remove the listen. Channel 0 is the public chat channel that all avatars see as chat text. Channels 1 – 2,147,483,648 are private channels that aren’t sent to avatars but other scripts can listen for.
llListenControl(integer number, integer active);
Makes a listen event callback active or inactive.
llListenRemove(integer number);
Removes a listen event callback.
llSensor(string name, key id, integer type, float range, float arc);
Performs a single scan for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name and/or id can be empty or 0). A range of 0.0 does perform a scan.
llSensorRepeat(string name, key id, integer type, float range, float arc, float rate);
Sets a callback for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name and/or id can be empty or 0) and repeats every rate seconds. Passing a range of 0.0 cancels the sensor.
llSensorRemove();
Removes the sensor.
string llDetectedName(integer number);
Returns the name of detected object number (returns empty string if number is not valid sensed object).
key llDetectedKey(integer number);
Returns the key of detected object number (returns invalid key if number is not valid sensed object).
key llDetectedOwner(integer number);
Returns the key of detected object’s owner number (returns invalid key if number is not valid sensed object).
integer llDetectedType(integer number);
Returns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of detected object (returns 0 if number is not valid sensed object). Note that the return value is a bit field, so comparisons need to be an AND check, ie:
integer type = llDetectedType(0);
if (type & AGENT)
{
// do stuff
}
vector llDetectedPos(integer number);
Returns the position of detected object number (returns <0,0,0> if number is not valid sensed object).
vector llDetectedVel(integer number);
Returns the velocity of detected object number (returns <0,0,0> if number is not valid sensed object).
vector llDetectedGrab(integer number);
Returns the grab offset of detected object number (returns <0,0,0> if number is not valid sensed object).
rotation llDetectedRot(integer number);
Returns the rotation of detected object number (returns <0,0,0,1> if number is not valid sensed object).
integer llDetectedLinkNumber(integer number);
Returns the link position (0 for a non-linked object, 1 for the root of a linked object, 2 for the first child, &c) of the triggered event for touches.
llDie();
Delete the object that the script is attached to.
float llGround(vector offset);
Returns the ground height at the object position + offset.
float llCloud(vector offset);
Returns the cloud density at the object position + offset.
vector llWind(vector offset);
Returns the wind velocity below the object position + offset.
llSetStatus(integer status, integer value);
Sets status to value.
integer llGetStatus(integer status);
Gets value of status.
llSetScale(vector scale);
Sets the scale.
vector llGetScale(key name);
Gets the scale.
llSetColor(vector color, integer face);
Sets the color. If face == ALL_SIDES, set the color to all faces.
vector llGetColor(integer face);
Gets the color.
llSetAlpha(float alpha, integer face);
Sets the alpha. If face == ALL_SIDES, set the alpha to all faces.
float llGetAlpha(integer face);
Gets the alpha.
llSetTexture(string texture, integer face);
Sets the texture from object inventory of face. If face == ALL_SIDES, set the texture to all faces.
string llGetTexture(integer face);
Gets the texture of face if in object inventory.
llScaleTexture(float scale_s, float scale_t, integer face);
Sets the texture s and t scales of face. If face == ALL_SIDES, scale the texture to all faces.
llOffsetTexture(float offset_s, float offset_t, integer face);
Sets the texture s and t offsets of face. If face == ALL_SIDES, set the texture offsets for all faces.
llRotateTexture(float rot, integer face);
Sets the texture rotation of face. If face == ALL_SIDES, rotate the texture of all faces.
llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate);
Animates a texture by setting the texture scale and offset. Mode is a mask, consisting of:
ANIM_ON – texture animation is on.
LOOP – loop the texture animation.
REVERSE – play animation in reverse direction.
PING_PONG – play animation going forwards, then backwards.
SMOOTH – slide in the X direction, instead of playing separate frames.
ROTATE – Animate texture rotation instead.
SCALE – Animate the texture scale instead.
Only ONE texture animation can be active at a time. You can only do traditional animation, ROTATE, or SCALE at a time, you can’t combine masks.
In the case of ROTATE or SCALE, sizex and sizey are ignored, and start and length are used as the start and length values of the animation. For rotation, start and length are in radians.
face is which face to animate. If face == ALL_SIDES, all textures on the object are animated. You can only have one texture animation on an object, calling llSetTextureAnim more than once on an object will reset it.
sizex and sizey describe the layout of the frames within the texture. sizex is how many horizontal frames, sizey is how many vertical frames.
start is the frame number to begin the animation on. Frames are numbered from left to right, top to bottom, starting at 0.
length is the number of frames to animate. 0 means to animate all frames after the start frame.
rate is the frame rate to animate at. 1.0 means 1 frame per second, 10.0 means 10 frames/second.
llSetPos(vector pos);
Sets the position (if the script isn't physical). If the object is a child, the position is treated as root relative and the linked set is adjusted.
vector llGetPos();
Gets the position.
vector llGetLocalPos();
Gets the local position of a child object.
llSetRot(rotation rot);
Sets the rotation (if the script isn't physical). If the object is a child, the rotation is treated as root relative and the linked set is adjusted.
rotation llGetRot();
Gets the rotation.
rotation llGetLocalRot();
Gets the local rotation of a child object.
llSetText(string text, vector color, float alpha)
Sets text that floats above object to text, using specified color and alpha.
llSetForce(vector force, integer local);
Sets the force, in local coordinates if local == TRUE (if the script is physical).
vector llGetForce();
Gets the force (if the script is physical).
integer llTarget(vector position, float range);
Set positions within range of position as a target and return an ID for the target.
llTargetRemove(integer tnumber);
Remove target number tnumber.
integer llRotTarget(rotation rotation, float error);
Set rotations within error of rotation as a rotational target and return an ID for the target.
llRotTargetRemove(integer tnumber);
Remove rotational target number tnumber.
llMoveToTarget(vector target, float tau);
Critically damp to target in tau seconds (if the script is physical). Good tau values are greater than 0.2. A tau of 0.0 stops the critical damping.
llMoveToTarget();
Stops critically damped motion.
llApplyImpulse(vector force, integer local);
Applies the impulse, in local coordinates if local == TRUE (if the script is physical).
llApplyRotationalImpulse(vector force, integer local);
Applies the rotational impulse, in local coordinates if local == TRUE (if the script is physical).
llSetTorque(vector torque, integer local);
Sets the torque, in local coordinates if local == TRUE (if the script is physical).
vector llGetTorque();
Gets the torque (if the script is physical).
llSetForceAndTorque(vector force, vector torque, integer local);
Sets the force and torque, in local coordinates if local == TRUE (if the script is physical).
vector llGetVel();
Gets the velocity.
vector llGetAccel();
Gets the acceleration.
vector llGetOmega();
Gets the omega.
float llGetTimeOfDay();
Gets the time in seconds since LindenWorld midnight.
float llGetWallclock();
Gets the time in seconds since simulator timezone midnight.
float llGetTime();
Gets the time in seconds since creation.
llResetTime();
Sets the time to zero.
float llGetAndResetTime();
Gets the time in seconds since creation and sets the time to zero.
llPlaySound(key sound, float volume);
Plays a sound once, attached to an object (the sound follows object movement). Only one sound may be attached to an object currently, and attaching a new sound (or calling llStopSound will stop the previously attached sound. A second call to llPlaySound with the same key will not restart the sound, but the new volume will be used, which allows control over the volume of already playing sounds. To restart the sound from the beginning, call llStopSound() before calling llPlaySound() again.
llLoopSound(key sound, float volume);
Similar to llPlaySound, llLoopSound plays a sound attached to an object, but will continuously loop that sound until llStopSound() or llPlaySound() is called. Only one sound may be attached to an object currently, and a second call to llLoopSound with the same key will not restart the sound, but the new volume will be used, which allows control over the volume of already playing sounds. Setting the volume to 0 is not the same as calling llStopSound; a sound with 0 volume will continue to loop. To restart the sound from the beginning, call llStopSound() before calling llLoopSound() again.
llTriggerSound(key sound, float volume);
Plays a transient sound NOT attached to an object (the sound plays from a stationary position located at the center of the object at the time of the trigger.) There is no limit to the number of llTrigger sounds which can be generated by an object, and calling llTriggerSound does not affect the attached sounds created by llPlaySound and llLoopSound. This is very useful for things like collision noises, explosions, etc. There is no way to stop or alter the volume of a sound triggered by llTriggerSound.
llTriggerSoundLimited(string sound, float volume, vector tne, vector bsw);
Plays a transient sound NOT attached to an object (the sound plays from a stationary position located at the center of the object at the time of the trigger) with its audible range limited by the axis aligned bounding box defined by tne (top-north-east) and bsw (bottom-south-west) corners. There is no limit to the number of llTrigger sounds which can be generated by an object, and calling llTriggerSound does not affect the attached sounds created by llPlaySound and llLoopSound. This is very useful for things like collision noises, explosions, etc. There is no way to stop or alter the volume of a sound triggered by llTriggerSound.
llStopSound();
Stops a currently playing attached sound (started with llPlaySound or llLoopSound). Has no effect on sounds started with llTriggerSound
llPreloadSound(string sound);
Preloads sound from object inventory on viewers.
llAdjustSoundVolume(float volume);
Adjusts the volume of the currently playing attached sound (started with llPlaySound or llLoopSound). Has no effect on sounds started with llTriggerSound.
llSetSoundQueueing(integer queue);
Sets whether successive calls to llPlaySound, llLoopSound etc. attached sounds only) interrupt the playing sound (FALSE, the default behavior) or wait until the current playing sound reaches its end (TRUE). The queue is one level deep.
llLoopSoundMaster(key sound, float volume);
Behaviour is identical to llLoopSound, with the addition of marking the source as a “Sync Master”, causing “Slave” sounds to sync to it. If there are multiple masters within a viewer’s interest area, the most audible one (a function of both distance and volume) will win out as the master. However, the use of multiple masters within a small area is unlikely to produce the desired effect.
llLoopSoundSlave(key sound, float volume);
Behaviour is identical to llLoopSound, unless there is a “Sync Master” present. If a Sync Master is already playing the Slave sound will begin playing from the same point the master is in its loop (syncronizing the loop points of both sounds). If a Master is started when the Slave is already playing, the Slave will skip to the correct position to sync with the Master.
llPlaySoundSlave(key sound, float volume);
Behaviour is identical to llPlaySound, unless there is a “Sync Master” present. If a Sync Master is already playing the Slave sound will not be played until the Master hits its loop point and returns to the beginning. llPlaySoundSlave will play the sound exactly once; if it is desired to have the sound play every time the Master loops, either use llLoopSoundSlave with extra silence padded on the end of the sound or ensure that llPlaySoundSlave is called at least once per loop of the Master.
string llGetSubString(string src, integer start, integer end);
Returns the indicated substring. Start and end are inclusive, so 0, length – 1 would capture the entire string and 0,0 would capture the first character. Using negative numbers for start and/or end causes the index to count backwards from the length of the string, so 0,-1 would capture the entire string. If start is larger than end the sub string is the exclusion of the entries, so 6,4 would give the entire string except for the 5th character.
string llDeleteSubString(string src, integer start, integer end);
Removes the indicated substring and returns the result. Start and end are inclusive, so 0, length – 1 would delete the entire string and 0,0 would delete the first character. Using negative numbers for start and/or end causes the index to count backwards from the length of the string, so 0,-1 would delete the entire string. If start is larger than end the sub string is the exclusion of the entries, so 6,4 would delete the entire string except for the 5th character.
string llInsertString(string dst, integer position, string src);
Inserts src into dst at position and returns the result.
string llToUpper(string src);
Converts src to all upper case and returns the result.
string llToLower(string src);
Converts src to all lower case and returns the result.
integer llStringLength(string src);
Returns the number of characters in the src.
llGiveMoney(key destination, integer amount);
Transfer amount of money from script owner to destination. Requires the PERMISSION_DEBIT runtime permission.
llMakeExplosion(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);
Make a round explosion of particles using texture from the object’s inventory.
llMakeFountain(integer particles, float scale, float velocity, float lifetime, float arc, integer bounce, string texture, vector offset, float bounce_offset);
Make a fountain of particles using texture from the object’s inventory.
llMakeSmoke(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);
Make smoky particles using texture from the object’s inventory.
llMakeFire(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector offset);
Make fire particles using texture from the object’s inventory.
llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param);
Creates object’s inventory object at position pos with velocity vel and rotation rot.
llSetTimerEvent(float sec);
Triggers a timer event every sec seconds. Passing in 0.0 seconds stops further timer events.
llSleep(float sec);
Puts script to sleep for sec seconds.
llLookAt(vector target, F32 strength, F32 damping);
Cause object name to point it's forward axis towards target. Good strength values are around ½ the mass of the object and good damping values are less than 1/10th of the strength. Asymmetrical shapes require smaller damping. Strength of 0.0 cancels the look at.
llLookAt(rotation rot, F32 tau, F32 strength);
Cause object name to rotate to rot. Good strength values are around ½ the mass of the object and good damping values are less than 1/10th of the strength. Asymmetrical shapes require smaller damping. Strength of 0.0 cancels the look at.
llStopLookAt();
Stop causing object name to point at a target.
llCollisionFilter(string name, key id, integer accept);
If accept == TRUE, only accept collisions with objects name and id (either is optional), otherwise with objects not name or id.
llTakeControls(integer controls, integer accept, integer pass_on);
If (accept == (controls & input)), send input to object. If pass_on send to avatar also.
llReleaseControls(key avatar);
Stop taking inputs from avatar.
llAttachToAvatar(key avatar, integer attachment);
Attach to avatar at point attachment. Requires the PERMISSION_ATTACH runtime permission.
llDetachFromAvatar(key avatar);
Drop off of avatar.
key llGetOwner();
Returns the owner of the object.
llInstantMessage(key user, string message);
IMs message to the user.
llEmail(string address, string subject, string message);
Sends email to address with subject and message.
llGetNextEmail(string address, string subject);
Get the next waiting email with appropriate address and/or subject (if blank they are ignored).
key llGetKey();
Get the key for the object the script is attached to.
llSetBuoyancy(float buoyancy);
Set the objects buoyancy (0 is none, < 1.0 sinks, 1.0 floats, > 1.0 rises).
llSetHoverHeight(float height, integer water, float tau);
Critically damps to a height (either above ground or above ground and water if water == TRUE).
llStopHover();
Stop hovering to a height.
llMinEventDelay(float delay);
Set the minimum time between events being handled.
llStartAnimation(string anim);
Start animation anim for avatar that owns object. The following strings are used:
“hold_R_bazooka”, “hold_R_handgun”,”hold_R_rifle”
Holds the appropriately shaped weapon in the right hand. Automatically switches to the aims (below) when user enters mouse look
“aim_R_bazooka”, “aim_R_handgun”, “aim_R_rifle”
Aims the appropriately shaped weapon along the direction the avatar is looking
“away”
Flops over in "away from keyboard" state
“backflip”
Performs a backflip
“bow”
Bows at waist
“brush”
Brushes dirt from shirt
“clap”
Applauds
“courtbow”
Bows with a courtly flourish
“crouch”
Crouches in place
“crouchwalk”
Walks in place while crouching
“dance1”, “dance2”, “dance3”, “dance4”, “dance5”, “dance6”, “dance7”, “dance8”
Various dance maneuvers
“falldown”
Freefall falling animation
“female_walk”
Walks with hip sway
“fly”
Flies forward
“flyslow”
Flies forward at a less agressive angle
“hello”
Waves
“hold_throw_R”
Hold object in right hand, prepared to throw it
“hover”
Hovers in place
“hover_down”
Pretends to hover straight down
“hover_up”
Pretends to hover straight up
“jump”
Midair jump position
“kick_roundhouse_R”
Roundhouse kick with right leg
“land”
Lands after flying
“prejump”
Prepares to jump
“punch_L”
Punch with left hand
“punch_R”
Punch with right hand
“punch_onetwo”
Punch with one hand then the other
“run”
Runs in place
“salute”
Salutes with right hand
“sit”
Sits on object at knee height
“sit_ground”
Sits down on ground
“slowwalk”
Walks in place slowly
“smoke_idle”
Leans on imaginary prop while holding cigarette
“smoke_inhale”
Leans on imaginary prop and smokes a cigarette
“smoke_throw_down”
Leans on imaginary prop, throws down a cigarette, and stamps it out
“snapshot”
Pantomimes taking a picture
“soft_land”
Stumbles a bit as if landing
“stand”
Stands in place
“standup”
Falls on face and stands up
“stride”
Legs extended as if stepping off of a ledge
“sword_strike_R”
Strike with sword in right hand
“talk”
Head moves as if talking
“target”
Right arm points where avatar is looking (used automatically with aim anims)
“throw_R”
Throws object in right hand
“tryon_shirt”
Turns around and models a new shirt
“turnleft”
Pretends to turn left
“turnright”
Pretends to turn right
“type”
Makes typing motion
“uphillwalk”
Walks uphill in place
“walk”
Walks in place
“whisper”
Whispers behind hand
“whistle”
Whistles with hands in mouth
“yell”
Shouts between cupped hands
llStopAnimation(string anim);
Stop animation anim for avatar that owns object.
llPointAt(vector pos);
Make avatar that owns object point at pos.
llStopPointAt();
Stop avatar that owns object pointing.
llTargetOmega(vector axis, float spinrate, float gain);
Attempt to spin at spinrate with strength gain. A gain of 0.0 cancels the spin.
integer llGetStartParameter();
Get the start parameter passed to llRezObject.
integer llRequestPermissions(key avatar, integer perm);
Ask avatar to allow the script to do perm (NB: Debit, ownership, link, joint, and permission requests can only go to the object's owner).
key llGetPermissionsKey()
Return avatar that permissions are enabled for. NULL_KEY if not enabled.
integer llGetPermissions();
Return what permissions have been enabled. To use:
integer perm = llGetPermissions();
if ((perm & PERMISSION_DEBIT) == PERMISSION_DEBIT)
{
// code goes here
}
integer llGetPermissions();
Returns what number in a link set the script is attached to (0 means no link, 1 the root, 2 for first child, &c.
llSetLinkColor(integer linknumber, vector color, integer face);
Returns what number in a link set the script is attached to (0 means no link, 1 the root, 2 for first child, &c.). If face == ALL_SIDES, set the color for all faces. If linknumber == ALL_SIDES, set color on all objects in link set.
llCreateLink(key target, integer parent);
Attempt to link object script is attached to and target (requires permission PERMISSION_CHANGE_LINKS be set). If parent == TRUE, object script is attached to is the root.
llBreakLink(integer linknum);
Delinks the object with the given link number (requires permission PERMISSION_CHANGE_LINKS be set).
llBreakAllLinks();
Delinks all objects in the link set (requires permission PERMISSION_CHANGE_LINKS be set).
key llGetLinkKey(integer linknum);
Get the key of linknumber in link set.
string llGetLinkName(integer linknum);
Get the name of linknumber in link set.
integer llGetInventoryNumber(integer type);
Get the number of items of type (INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_LANDMARK, INVENTORY_CLOTHING, INVENTORY_NOTECARD, or INVENTORY_BODYPART) in the object's inventory.
string llGetInventoryName(integer type, integer number);
Get the name of the inventory item number of type.
llGiveInventory(key destination, string inventory);
Give the named inventory item to the keyed avatar or object in the same simulator as the giver. If the recipient is an avatar, the avatar then follows the normal procedure of accepting or denying the offer. If the recipient is an object, the same permissions apply as if you were dragging inventory onto the object by hand, ie if llAllowInventoryDrop(TRUE) has been called on the object, any other object can pass objects to its inventory.
llRemoveInventory(string inventory);
Remove the named inventory item from the object inventory.
llSetScriptState(string name, integer run);
Control the state of a script on the object.
float llGetEnergy();
Returns how much energy is in the object as a percentage of maximum.
llSetText(string text, vector color, float alpha);
Set text floating over object.
llSetText(string text, vector color, float alpha);
Set text floating over object.
llPassTouches(integer pass);
If pass == TRUE, touches are passed from children on to parents.
llPassCollisions(integer pass);
If pass == TRUE, collisions (both land and object) are passed from children on to parents.
key llRequestAgentData(key id, integer data);
Requests data about agent id. When data is available the dataserver event will be raised. The only request currently implemented is request 1, which returns a “1” if the agent is online, “0” otherwise.
key llRequestInventoryData(string name);
Requests data from object's inventory object. When data is available the dataserver event will be raised. The only request currently implemented is to request data from landmarks, where the data returned is in the form “<float, float, float>” which can be cast to a vector. This position is in region local coordinates.
llSetDamage(float damage);
Sets the amount of damage that will be done to an object that this object hits. Object will be killed.
llTeleportAgentHome(key id);
Teleport agent on the owner's land to agent’s home location.
llModifyLand(integer action, integer size);
Modify land with action (LAND_LEVEL, LAND_RAISE, LAND_LOWER)\non size (LAND_SMALL_BRUSH, LAND_MEDIUM_BRUSH, LAND_LARGE_BRUSH).
llCollisionSound(string impact_sound, float impact_volume);
Suppress default collision sounds, replace default impact sounds with impact_sound (empty string to just suppress).
llCollisionSprite(string impact_sprite);
Suppress default collision sprites, replace default impact sprite with impact_sprite (empty string to just suppress).
string llGetAnimation(key id);
Get the currently playing animation for avatar id.
llResetScript();
Resets the script.
llMessageLinked(integer linknum, integer num, string str, key id);
Sends num, str, and id to members of the link set(LINK_SET sends to all objects, LINK_ALL_OTHERS to all other objects, LINK_ALL_CHILDREN to all children.
llPushObject (key id, vector impulse, vector ang_impulse, integer local);
Applies impulse and angular impulse to object id.
llPassCollisions(integer pass);
If pass == TRUE, collisions are passed from children on to parents (default is FALSE).
llGetScriptName();
Returns the script name.
integer llGetNumberOfSides();
Returns the number of sides.
rotation llAxisAngle2Rot(vector axis, float angle);
Returns the rotation generated angle about axis.
vector llRot2Axis(rotation rot);
Returns the rotation axis represented by rot.
float llRot2Angle(rotation rot);
Returns the rotation angle represented by rot.
float llAcos(float val);
Returns the arccosine in radians of val.
float llAsin(float val);
Returns the arcsine in radians of val.
float llAngleBetween(rotation a, rotation b);
Returns angle between rotation a and b.
key llGetInventoryKey(string name);
Returns the key of the inventory name.
llAllowInventoryDrop(integer add);
If add == TRUE, users without permissions can still drop inventory items onto object.
vector llGetSunDirection();
Returns the sun direction on the simulator.
vector llGetTextureOffset(integer side)
Returns the texture offset of side in the x and y components of a vector.
vector llGetTextureScale(integer side);
Returns the texture scale of side in the x and y components of a vector.
float llGetTextureRot(integer side);
Returns the texture rotation of side;
integer llSubStringIndex(string source, string pattern);
Finds index in source where pattern first appears (returns length of source if not found).
key llGetOwnerKey(key id);
Find the owner of id.
vector llGetCenterOfMass();
Get the object's center of mass.
list llListSort(list src, integer stride, integer ascending).
Sort the list into blocks of stride in ascending order if ascending == TRUE. Note that sort only works between same types.
integer llGetListLength(list src);
Get the number of elements in the list.
integer llList2Integer(list src, integer index);
Copy the integer at index in the list.
float llList2Float(list src, integer index);
Copy the float at index in the list.
string llList2String(list src, integer index);
Copy the string at index in the list.
key llList2Key(list src, integer index);
Copy the key at index in the list.
vector llList2Vector(list src, integer index);
Copy the vector at index in the list.
rotation llList2Rot(list src, integer index);
Copy the rotation at index in the list.
list llList2List(list src, integer start, integer end);
Copy the slice of the list from start to end from the list. Start and end are inclusive, so 0, length – 1 would copy the entire list and 0,0 would capture the first list entry. Using negative numbers for start and/or end causes the index to count backwards from the length of the list, so 0,-1 would capture the entire list. If start is larger than end the list returned is the exclusion of the entries, so 6,4 would give the entire list except for the 5th entry.
list llDeleteSubList(list src, integer start, integer end);
Remove the slice from the list and return the remainder. Start and end are inclusive, so 0, length – 1 would delete the entire list and 0,0 would delete the first list entry. Using negative numbers for start and/or end causes the index to count backwards from the length of the list, so 0,-1 would delete the entire list. If start is larger than end the list deleted is the exclusion of the entries, so 6,4 would delete the entire list except for the 5th list entry.
integer llGetListEntryType(list src, integer index)
Returns the type of the index entry in the list\n(TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_KEY, TYPE_VECTOR, TYPE_ROTATION, or TYPE_INVALID if index is off list.
string llList2CSV(list src);
Create a string of comma separated values from list.
list llCSV2List(string src);
Create a list from a string of comma separated values.
list llListRandomize(list src, integer stride);
Returns src randomized into of blocks of size stride.
list llList2ListStrided(list src, integer start, integer end, integer stride);
Copy the strided slice of the list from start to end.
list llListInsertList(list dest, list src, integer pos);
Returns the list created by inserting src into dest at pos.
integer llListFindList(list src, list test);
Returns the position of the first instance of test in src (-1 if test isn’t in src).
string llGetObjectName();
Returns the name of the object script is attached to.
llSetObjectName(string name);
Sets the objects name.
string llGetDate();
Gets the date as mm/dd/yyyy.
integer llEdgeOfWorld(vector pos, vector dir);
Returns TRUE if the line along dir from pos hits the edge of the world in the current simulator and returns FALSE if that edge crosses into another simulator.
integer llGetAgentInfo(key id);
Gets information about agent ID. Returns AGENT_FLYING, AGENT_ATTACHMENTS, and/or AGENT_SCRIPTED.
string llKey2Name(key id);
If object id is in the simulator, return the name of the object.
llEjectFromLand(key pest)
Ejects pest from land that you own.
list llParseString2List(string src, list separators, list spacers)
Breaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each). So, if you had made the call:
llParseString2List(“Parsethisnow! I dare:you to.”, [“this“, “!”, “ “], [“:”]);
You would get the list:
[“Parse”, “now”, “I”, “dare”, “:”, “you”, “to”
integer llOverMyLand(key id)
Returns TRUE if id is over land owner of object owns, FALSE otherwise.
key llGetLandOwnerAt(vector pos)
Returns the key of the land owner, NULL_KEY if public.
key llGetNotecardLine(string name, integer line)
Returns line line of notecard name via the database event. If the requested line is past the end of the notecard the database event will return the constant EOF.
vector llGetAgentSize(key id)
If the agent is in the same sim as the object, returns the size of the avatar.
integer llSameGroup(key id)
Returns TRUE if ID is in the same sim and has the same active group, otherwise FALSE.
llUnSit(key id)
lIf agent identified by id is sitting on the object the script is attached to or is over land owned by the objects owner, the agent is forced to stand up.
llGroundSlope(vector v)
Returns the ground slope below the object position + v.
llGroundNormal(vector v)
Returns the ground normal below the object position + v.
llGroundContour(vector v)
Returns the ground contour below the object position + v.
.