Chapter 11. Vehicles
Custom Vehicles can be constructed and controlled using the LSL.
- This chapter will cover the basics of how vehicles work, the
- terms used when describing vehicles, and a more thorough examination
- of the api available.
There are several ways to make scripted objects move
- themselves around. One way is to turn the object into a
- "vehicle". This feature is versatile enough to make things
- that slide, hover, fly, and float. Some of the behaviors that can be
- enabled are:
Each scripted object can have one vehicle behavior that is
- configurable through the llSetVehicleType, llSetVehicleFloatParam,
- llSetVehicleVectorParam,
- llSetVehicleRotationParam,
- llSetVehicleFlags,
- and llRemoveVehicleFlags
- library calls.
These script calls are described in more detail below, but
- the important thing to notice here is that the vehicle behavior
- has several parameters that can be adjusted to change how the
- vehicle handles. Depending on the values chosen the vehicle can
- veer like a boat in water, or ride like a sled on rails.
Setting the vehicle flags allow you to make exceptions to
- some default behaviors. Some of these flags only have an effect
- when certain behaviors are enabled. For example, the
- VEHICLE_FLAG_HOVER_WATER_ONLY will make the vehicle ignore the
- height of the terrain, however it only makes a difference if the
- vehicle is hovering.
Vehicles are a work in progress and will
- likely experience changes in future versions of Second Life.
- Some of the details of vehicle behavior may be changed
- as necessary to ensure stability
- and user safety. In particular, many of the limits and defaults
- described in the appendices will probably change and should not be
- relied upon in the long term.
It is not recommended that you mix vehicle behavior with
- some of the other script calls that provide impulse and forces to
- the object, especially llSetBuoyancy, llSetForce, llSetTorque, and llSetHoverHeight.
While the following methods probably don't cause any
- instabilities, their behavior may conflict with vehicles and cause
- undesired and/or inconsistent results, so use llLookAt, llRotLookAt, llMoveToTarget, and llTargetOmega at your own
- risk.
If you think you have found a bug relating to how vehicle's
- work, one way to submit the problem is to give a copy of the
- vehicle and script to Andrew Linden with comments or a notecard
- describing the problem. Please name all submissions "Bugged
- Vehicle XX" where XX are your Second Life initials. The
- vehicle and script will be examined at the earliest
- convenience.
The terms "roll", "pitch", and
- "yaw" are often used to describe the modes of rotations
- that can happen to a airplane or boat. They correspond to
- rotations about the local x-, y-, and z-axis respectively.
z-axis .
- yaw-axis /|\
- | __. y-axis
- ._ ___| /| pitch-axis
- _||\ \\ |\. /
- \|| \_______\_|__\_/_______
- | _ _ o o o o o o o |\_ ______\ x-axis
- // ./_______,----,__________) / roll-axis
- /_,/ // ./
- /__,/
-
The right-hand-rule, often introduced in beginning physics
- courses, is used to define the direction of positive rotation
- about any axis. As an example of how to use the right hand rule,
- consider a positive rotation about the roll axis. To help
- visualize how such a rotation would move the airplane, place your
- right thumb parallel to the plane's roll-axis such that the thumb
- points in the positive x-direction, then curl the four fingers
- into a fist. Your fingers will be pointing in the direction that
- the plane will spin.
.-.--.--.--. __
- / / / / _ \ / \
- (-(- (- (- ( | _________|______\ axis of
- \.\._\._\._) | | / rotation
- | \:__,---. \|/
- | | + positive
- \ .,_.___.' rotation
- \_ ^ `.__,/
- | /
- | |
-
Many of the parameters that control a vehicle's behavior are
- of the form: VEHICLE_BEHAVIOR_TIMESCALE. A behavior's
- "timescale" can usually be understood as the time for
- the behavior to push, twist, or otherwise affect the vehicle such
- that the difference between what it is doing, and what it is
- supposed to be doing, has been reduced to 1/e of what it was,
- where "e" is the natural exponent (approximately
- 2.718281828). In other words, it is the timescale for exponential
- decay toward full compliance to the desired behavior. When you
- want the vehicle to be very responsive use a short timescale of
- one second or less, and if you want to disable a behavior then set
- the timescale to a very large number like 300 (5 minutes) or
- more. Note, for stability reasons, there is usually a limit to how
- small a timescale is allowed to be, and is usually on the order of
- a tenth of a second. Setting a timescale to zero is safe and is
- always equivalent to setting it to its minimum. Any feature with a
- timescale can be effectively disabled by setting the timescale so
- large that it would take them all day to have any
- effect.
Before any vehicle parameters can be set the vehicle
- behavior must first be enabled. It is enabled by calling llSetVehicleType with any
- VEHICLE_TYPE_*, except VEHICLE_TYPE_NONE which will disable the
- vehicle. See the vehicle type
- constants section for currently available types. More types
- will be available soon.
Setting the vehicle type is necessary for enabling the
- vehicle behavior and sets all of the parameters to its default
- values. For each vehicle type listed we provide the corresponding
- equivalent code in long format. Is is
- important to realize that the defaults are
- not the optimal settings for any of these
- vehicle types and that they will definitely be changed in the
- future. Do not rely on these values to be constant until
- specified.
Should you want to make a unique or experimental vehicle you
- will still have to enable the vehicle behavior with one of the
- default types first, after which you will be able to change any of
- the parameters or flags within the allowed ranges.
Setting the vehicle type does not automatically take
- controls or otherwise move the object. However should you enable
- the vehicle behavior while the object is free to move and parked
- on a hill then it may start to slide away.
We're looking for new and better default vehicle types. If
- you think you've found a set of parameters that make a better car,
- boat, or any other default type of vehicle then you may submit
- your proposed list of settings to Andrew Linden via a script or
- notecard.
A common feature of real vehicles is their tendency to move
- along "preferred axes of motion". That is, due to
- their wheels, wings, shape, or method of propulsion they tend to
- push or redirect themselves along axes that are static in the
- vehicle's local frame. This general feature defines a
- class of vehicles and included in this category a common
- dart is a "vehicle": it
- has fins in the back such that if it were to tumble in the air it
- would eventually align itself to move point-forward -- we'll call
- this alignment effect angular
- deflection.
A wheeled craft exhibits a
- different effect: when a
- skateboard is pushed in some direction it will tend to redirect
- the resultant motion along that which it is free to roll -- we'll
- call this effect
linear deflection.
So a typical Second Life vehicle is an object that
- exhibits linear and/or angular deflection along the
- "preferential axes of motion". The default
- preferential axes of motion are the local x- (at), y- (left), and
- z- (up) axes of the local frame of the
- vehicle's root primitive. The deflection behaviors relate to the
- x-axis (at): linear deflection will tend to rotate its velocity
- until it points along it's positive local x-axis while the
- angular deflection will tend to reorient the vehicle such that
- it's x-axis points in the direction that it is moving. The other
- axes are relevant to vehicle behaviors that are described later,
- such as the
- vertical attractor
- which tries to keep a vehicle's
- local z-axis pointed toward the world z-axis (up). The vehicle
- axes can be rotated relative to the object's actual local axes by
- using the
- VEHICLE_REFERENCE_FRAME
- parameter, however that is an
- advanced feature and is covered in detail in a later section of
- these documents.
Depending on the vehicle it might be desirable to have lots
- of linear and/or angular deflection or not. The speed of the
- deflections are controlled by setting the relevant parameters
- using the llSetVehicleFloatParam
- script call. Each variety of deflection has a
- "timescale" parameter that determines how quickly a
- full deflection happens. Basically the timescale it the time
- coefficient for exponential decay toward full deflection. So, a
- vehicle that deflects quickly should have a small timescale. For
- instance, a typical dart might have a angular deflection
- timescale of a couple of seconds but a linear deflection of
- several seconds; it will tend to reorient itself before it
- changes direction. To set the deflection timescales of a dart
- you might use the lines below:
llSetVehicleFloatParam(VEHICLE_ANGULAR_DEFLECTION_TIMESCALE, 2.0);
-llSetVehicleFloatParam(VEHICLE_LINEAR_DEFLECTION_TIMESCALE, 6.0);
-
Each variety of deflection has an "efficiency"
- parameter that is a slider between 0.0 and 1.0. Unlike the other
- efficiency parameters of other vehicle behaviors, the deflection
- efficiencies do not slide between "bouncy" and
- "damped", but instead slide from "no deflection
- whatsoever" (0.0) to "maximum deflection" (1.0).
- That is, they behave much like the deflection timescales, however
- they are normalized to the range between 0.0 and 1.0.
Once enabled, a vehicle can be pushed and rotated by
- external forces and/or from script calls such as
- llApplyImpulse,
- however linear and angular motors have been built in
- to make motion smoother and easier to control.
- Their directions can be set using the
- llSetVehicleVectorParam
- call. For example, to make the vehicle try to move at 5
- meters/second along its local x-axis (the default look-at
- direction) you would put the following line in your script:
llSetVehicleVectorParam(VEHICLE_LINEAR_MOTOR_DIRECTION, <5, 0, 0>);
-
The motor strength is not the full story, since you can also
- control how fast the motor engages (VEHICLE_LINEAR_MOTOR_TIMESCALE)
- and there is a parameter that causes the motor's effectiveness to
- decay over time (VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE).
Steering the vehicle involves setting the
- VEHICLE_ANGULAR_MOTOR_DIRECTION and related parameters.
- It is also possible to set some flags that allow the angular
- motor slave to your camera view when in mouselook.
For more details about the vehicle motors
- read the sections on the linear
- and angular
- motors below.
The parameters that control the linear motor are:
VEHICLE_LINEAR_MOTOR_DIRECTION
A vector.
- It is the velocity (meters/sec) that the vehicle will
- try to attain. It points in the vehicle's local frame, and has a
- maximum length of 40.
VEHICLE_LINEAR_MOTOR_OFFSET
A vector.
- It is the offset point from the vehicle's center of mass at which
- the linear motor's impulse is applied. This allows the linear motor
- to also cause rotational torque. It is in the vehicle's local
- frame and its maximum length is 100 meters! No need to worry
- about stability -- if the vehicle starts to spin too fast
- (greater than about 4*PI radians per second) then angular
- velocity damping will kick in. The reason the offset is allowed
- to be so large is so that it can compete with the other vehicle
- behaviors such as angular deflection
- and the vertical
- attractor. Some of the other vehicle behaviors may
- drastically reduce the effective torque from the linear motor
- offset, in which case a longer leverage arm may help.
VEHICLE_LINEAR_MOTOR_TIMESCALE
A float. Determines how long it takes for the motor to
- push the vehicle to full speed. Its minimum value is approximately
- 0.06 seconds.
VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE
A float. The effectiveness of the motor will exponentially
- decay over this timescale, but the effectiveness will be reset
- whenever the motor's value is explicitly set. The maximum value
- of this decay timescale is 120 seconds,
- and this timescale is always in effect.
The flags that affect the linear motor are:
Setting the motor speed is not enough to enable all
- interesting vehicles. For example, some will want a car that
- immediately gets up to the speed they want, while others will want
- a boat that slowly climbs up to its maximum velocity. To control
- this effect the VEHICLE_LINEAR_MOTOR_TIMESCALE parameter can be
- used. Basically the "timescale" of a motor is the
- time constant for the vehicle to exponentially accelerate toward
- its full speed.
What would happen if you were to accidentally set the
- vehicle's linear velocity to maximum possible speed and then let
- go? It would run away and never stop, right? Not necessarily: an
- automatic "motor decay" has been built in such that all
- motors will gradually decrease their effectiveness after being
- set.
Each time the linear motor's vector is set its
- "grip"
- immediately starts to decay exponentially with a timescale
- determined by the VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE, such
- that after enough time the motor ceases to have any effect.
- This decay timescale serves two purposes. First, since it
- cannot be set longer than 120 seconds,
- and is always enabled it
- guarantees that a vehicle will not push itself about forever
- in the absence
- of active control (from keyboard commands or some logic loop in
- the script). Second, it can be used to push some vehicles around
- using a simple impulse model. That is, rather than setting the
- motor "on" or "off" depending on whether
- a particular key is pressed "down" or "up"
- the decay timescale can be set short and the motor can be set
- "on" whenever the key transitions from "up"
- to "down" and allowed to automatically decay.
Since the motor's effectiveness is reset whenever the
- motor's vector is set, then setting it to a vector of length zero
- is different from allowing it to decay completely. The first case
- will cause the vehicle to try to reach zero velocity, while the
- second will leave the motor impotent.
The two motor timescales have very similar names, but have
- different effects, so try not to get them confused.
- VEHICLE_LINEAR_MOTOR_TIMESCALE is the time for motor to
- "win", and VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE is the
- time for the motor's "effectiveness" to decay toward
- zero. If you set one when you think you are changing the other
- you will have frustrating results. Also, if the motor's decay
- timescale is shorter than the regular timescale, then the
- effective magnitude of the motor vector will be
- diminished.
The parameters that control the angular motor are:
VEHICLE_ANGULAR_MOTOR_DIRECTION
A vector. It is the angular velocity (radians/sec)
- that the vehicle will try to rotate. It points in the vehicle's
- local frame, and has a maximum value of 4*PI (two revolutions
- per second).
VEHICLE_ANGULAR_MOTOR_TIMESCALE
A float. Determines how long it takes for the motor to
- spin the vehicle to full speed. Its minimum value is approximately
- 0.06 seconds.
VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE
A float. The effectiveness of the motor will exponentially
- decay over this timescale, but the effectiveness will be reset
- whenever the motor's value is explicitly set. The maximum value
- of this decay timescale is 120 seconds,
- and this timescale is always in effect.
Like the linear motor the angular motor can be set explicitly,
- and has magnitude/direction, a timescale, and a decay timescale.
When it comes to actually steering a vehicle there are
- several ways to do it. One way would be for the script to grab
- keyboard input and to explicitly turn the motor on/off based on
- which keys are pressed. When steering this way you probably
- don't want it to turn very far or for very long. One way to do
- it using the angular motor would be to leave the decay timescale
- long, enable a significant amount of angular friction (to
- quickly slow the vehicle down when the motor is turned off) then
- set the angular motor to a large vector on a key press, and set
- it to zero when the key is released. That has the effect of
- making the vehicle unresponsive to external collisions, due to
- the angular friction.
Another way to do it is to set the
- VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE to a short value and push
- the vehicle about with a more impulsive method that sets the
- motor fast on a key press down (and optionally setting the motor
- to zero on a key up) relying on the automatic exponential decay
- of the motor's effectiveness rather than a constant angular
- friction.
Finally, it may be possible to discard the angular motor
- entirely and use the VEHICLE_LINEAR_MOTOR_OFFSET. Whenever the
- offset has a component that is perpendicular to the direction
- of the linear motor the vehicle will rotate as it travels.
- Note, with the incorrect values for offset and strength the
- linear motor effect can easily cause the vehicle to tumble
- and spin uncontrollably, so experiement with small offsets
- first!.
Setting the angular motor to zero magnitude is different
- from allowing it to decay. When the motor completely decays
- it no longer affects the motion of the vehicle, however setting
- it to zero will reset the "grip" of the vehicle and
- will make the vehicle try to achieve zero angular velocity.
-
Many real vehicles bank (roll about their
- forward axis) to effect a turn, such as motorcycles and airplanes.
- To make it easier to build banking vehicles there is
- banking behavior
- available which can be controlled by setting other parameters and is
- described in more detail here.
It is also possible to make a
- vehicle turn in response
- to changing the camera view
- (right now this only works in mouselook).
The vehicle can be instructed to rotate its forward axis
- to point in the same direction as the camera view. This
- is achieved by setting some flags that change how the
- VEHICLE_ANGULAR_MOTOR_DIRECTION is interpreted. When used properly
- this feature has the advantage of being able to provide simple
- and stable steering that is resilient to bad render frame rates
- on the client.
The flags that affect the angular motor are:
VEHICLE_FLAG_MOUSELOOK_STEER
Steer the vehicle using the mouse. Use this flag to make
- the angular motor try to make the vehicle
- turn such that its local x-axis points in the same direction as
- the client-side camera.
VEHICLE_FLAG_MOUSELOOK_BANK
Same as above, but relies on banking. It remaps left-right
- motions of the client camera (also known as "yaw") to rotations about
- the vehicle's local x-axis (also known as "roll").
VEHICLE_FLAG_CAMERA_DECOUPLED
Makes mouselook camera rotate independently of the vehicle.
- By default the client mouselook camera will rotate about
- with the vehicle, however when this flag is set the camera
- direction is independent of the vehicle's rotation.
When using the VEHICLE_FLAG_MOUSELOOK_STEER (or
- VEHICLE_FLAG_MOUSELOOK_BANK) the meaning of the
- VEHICLE_ANGULAR_MOTOR_DIRECTION parameter subtly changes. Instead
- of representing the "angular velocity" of the motor
- the components of the parameter scale the "measured angular
- velocity" (as determined by the rotation between
- the client's camera view direction and the forward-axis of the vehicle)
- to compute the "final angular velocity". That is,
- suppose you set the angular motor to <0, 0, 5>, then moved the
- camera view to be PI/4 radians to the left of the vehicle's forward axis,
- and down PI/8 toward the ground.
- The measured angular velocity would be <0, -PI/8, PI/4>
- radians/second, but the final velocity would be <0, 0, 5*PI/4>...
- the vehicle will turn left, but will not dip its nose down.
- Thus, by setting a component of the VEHICLE_ANGULAR_MOTOR_DIRECTION
- to zero, one can negate the pitch or yaw response of the motor,
- or even scale one to be much more responsive than the other.
-
The VEHICLE_ANGULAR_MOTOR_TIMESCALE still has an effect when
- using mouselook control, and scales the global responsiveness of the
- angular motor. The VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE, on the other
- hand, is ignored when using mouselook controls.
Some vehicles, like boats, should always keep their up-side
- up. This can be done by enabling the "vertical
- attractor" behavior that springs the vehicle's local z-axis
- to the world z-axis (a.k.a. "up"). To take advantage of
- this feature you would set the VEHICLE_VERTICAL_ATTRACTION_TIMESCALE
- to control the period of the spring frequency, and then set the
- VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY to control the damping. An
- efficiency of 0.0 will cause the spring to wobble around its
- equilibrium, while an efficiency of 1.0 will cause the spring to
- reach it's equilibrium with exponential decay.
llSetVehicleVectorParam(VEHICLE_VERTICAL_ATTRACTION_TIMESCALE, 4.0);
-llSetVehicleVectorParam(VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY, 0.5);
-
The vertical attractor is disabled by setting its timescale
- to anything larger than 300 seconds.
Note that by default the vertical attractor will prevent the
- vehicle from diving and climbing. So, if you wanted to make a
- airplane you would probably want to unlock the attractor around the
- pitch axis by setting the VEHICLE_FLAG_LIMIT_ROLL_ONLY bit:
llSetVehicleFlags(VEHICLE_FLAG_LIMIT_ROLL_ONLY);
-
The
vertical attractor feature must be enabled in order for
- the banking behavior to function. The way banking works is this: a
- rotation around the vehicle's roll-axis will produce a angular
- velocity around the yaw-axis, causing the vehicle to turn. The
- magnitude of the yaw effect will be proportional to the
- VEHICLE_BANKING_EFFICIENCY, the angle of the roll rotation, and
- sometimes the vehicle's velocity along it's preferred axis of
- motion.
The VEHICLE_BANKING_EFFICIENCY can vary between -1 and +1. When
- it's positive then any positive rotation (by the right-hand rule)
- about the roll-axis will effect a (negative) torque around the
- yaw-axis, making it turn to the right -- that is the vehicle will
- lean into the turn, which is how real airplanes and motorcycle's
- work. Negating the banking coefficient will make it so that the
- vehicle leans to the outside of the turn (not very
- "physical" but might allow interesting vehicles so why
- not?).
The VEHICLE_BANKING_MIX is a fake (i.e. non-physical)
- parameter that is useful for making banking vehicles do what you
- want rather than what the laws of physics allow. For example,
- consider a real motorcycle... it must be moving forward in order
- for it to turn while banking, however video-game motorcycles are
- often configured to turn in place when at a dead stop -- because
- they're often easier to control that way using the limited
- interface of the keyboard or game controller. The
- VEHICLE_BANKING_MIX enables combinations of both realistic and
- non-realistic banking by functioning as a slider between a banking
- that is correspondingly totally static (0.0) and totally dynamic
- (1.0). By "static" we mean that the banking effect
- depends only on the vehicle's rotation about it's roll-axis
- compared to "dynamic" where the banking is also
- proportional to it's velocity along it's roll-axis. Finding the
- best value of the "mixture" will probably require trial
- and error.
The time it takes for the
- banking behavior to defeat a
- pre-existing angular velocity about the world z-axis is determined
- by the VEHICLE_BANKING_TIMESCALE. So if you want the vehicle to
- bank quickly then give it a banking timescale of about a second or
- less, otherwise you can make a sluggish vehicle by giving it a
- timescale of several seconds.
VEHICLE_LINEAR_FRICTION_TIMESCALE is a vector parameter that
- defines the timescales for the vehicle to come to a complete stop
- along the three local axes of the
- vehicle's reference frame.
- The timescale along each axis is independent of the others.
- For example, a sliding ground car would probably have very little
- friction along its x- and z-axes (so it can easily slide forward
- and fall down) while there would usually significant friction
- along its y-axis:
llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 1000, 3>);
-
Remember that a longer timescale corresponds to a weaker
- friction, hence to effectively disable all linear friction you
- would set all of the timescales to large values.
Setting the linear friction as a scalar is allowed, and has
- the effect of setting all of the timescales to the same
- value. Both code snippets below are equivalent, and both make friction
- negligible:
// set all linear friction timescales to 1000
-llSetVehicleVectorParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, <1000, 1000, 1000>);
-
// same as above, but fewer characters
-llSetVehicleFloatParam(VEHICLE_LINEAR_FRICTION_TIMESCALE, 1000);
-
VEHICLE_ANGULAR_FRICTION_TIMESCALE is also a vector
- parameter that defines the timescales for the vehicle to stop
- rotating about the x-, y-, and z-axes, and are set and disabled in
- the same way as the linear friction.
The vehicle has a built-in buoyancy feature that is
- independent of the llSetBuoyancy call. It
- is recommended that the two buoyancies do not mix! To make
- a vehicle buoyant, set the VEHICLE_BUOYANCY parameter to something
- between -1.0 (extra gravity) to 1.0 (full anti-gravity).
-
The buoyancy behavior is independent of hover, however
- in order for hover to work without a large offset of the
- VEHICLE_HOVER_HEIGHT, the VEHICLE_BUOYANCY should be set to 1.0.
-
It is not recommended that you mix vehicle buoyancy with
- the llSetBuoyancy script call.
- It would probably cause the object to fly up into space.
The hover behavior is enabled by setting the
- VEHICLE_HOVER_TIMESCALE to a value less than 300 seconds; larger
- timescales totally disable it. Most vehicles will work
- best with short hover timescales of a few seconds or less.
- The shorter the timescale, the faster the vehicle will
- slave to is target height. Note, that if the values of
- VEHICLE_LINEAR_FRICTION_TIMESCALE may affect the speed of
- the hover.
Hover is independent of buoyancy, however the
- VEHICLE_BUOYANCY should be set to 1.0, otherwise the vehicle
- will not lift itself off of the ground until the
- VEHICLE_HOVER_HEIGHT is made large enough to counter the
- acceleration of gravity, and the vehicle will never float
- all the way to its target height.
The VEHICLE_HOVER_EFFICIENCY can be thought of as a slider
- between bouncy (0.0) and smoothed (1.0). When in the
- bouncy range the vehicle will tend to hover a little lower than
- its target height and the VEHICLE_HOVER_TIMESCALE will be
- approximately the oscillation period of the bounce (the real
- period will tend to be a little longer than the timescale).
For performance reasons, until improvements are made to the
- Second Life physics engine the vehicles can only hover over the
- terrain and water, so they will not be able to hover above
- objects made out of primitives, such as bridges and houses. By
- default the hover behavior will float over terrain and water,
- however this can be changed by setting some flags:
If you wanted to make a boat you should set the
-
VEHICLE_HOVER_WATER_ONLY flag, or if you wanted to drive a hover
- tank under water you would use the
-
VEHICLE_HOVER_TERRAIN_ONLY flag instead.
- Finally, if you wanted to make a submarine or a balloon you would use the
-
VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT. Note that
- the flags are independent of each other and that setting two
- contradictory flags will have undefined behavior. The flags are
- set using the script call llSetVehicleFlags().
The VEHICLE_HOVER_HEIGHT determines
- how high the vehicle
- will hover over the terrain and/or water, or the global height,
- and has a maximum value of 100 meters. Note that for hovering
- purposes the "center" of the vehicle is its "center of mass"
- which is not always obvious to the untrained eye, and it
- changes when avatar's sit on the vehicle.
The vehicle relies on the x- (at), y- (left), and z- (up)
- axes in order to figure out which way it prefers to move and
- which end is up. By default these axes are identical to the
- local axes of the root primitive of the object, however this
- means that the vehicle's root primitive must, by default, be
- oriented to agree with the designed at, left, and up axes of the
- vehicle. But, what if the vehicle object was already pre-built
- with the root primitive in some non-trivial orientation
- relative to where the vehicle as a whole should move? This is
- where the VEHICLE_REFERENCE_FRAME parameter becomes useful; the
- vehicle's axes can be arbitrarily reoriented by setting this
- parameter.
As an example, suppose you had built a rocket out of a big
- cylinder, a cone for the nose, and some stretched cut boxes for
- the fins, then linked them all together with the cylinder as the
- root primitive. Ideally the rocket would move nose-first,
- however the cylinder's axis of symmetry is its local z-axis while
- the default "at-axis" of the vehicle, the axis it will
- want to deflect to forward under angular deflection, is the local
- x-axis and points out from the curved surface of the cylinder.
- The script code below will rotate the vehicle's axes such that
- the local z-axis becomes the "at-axis" and the local
- negative x-axis becomes the "up-axis":
// rotate the vehicle frame -PI/2 about the local y-axis (left-axis)
-rotation rot = llEuler2Rot(0, PI/2, 0);
-llSetVehicleRotationParam(VEHICLE_REFERENCE_FRAME, rot);
-
Another example of how the reference frame parameter could
- be used is to consider flying craft that uses the vertical
- attractor for stability during flying but wants to use VTOL
- (vertical takeoff and landing). During flight the craft's dorsal
- axis should point up, but during landing its nose-axis should be
- up. To land the vehicle: while the
- vertical attractor
- is in effect, rotate the existing VEHICLE_REFERENCE_FRAME by +PI/2
- about the left-axis, then the vehicle will pitch up such that
- it's nose points toward the sky. The vehicle could be allowed to
- fall to the landing pad under friction, or a decreasing hover
- effect.
Appendix A. Linden Library Functions
Complete listing of the Linden Library function calls
- available in lsl.
integer llAbs
(integer val);
Returns the absolute value of
- val
.
Returns the arccosine in radians of
- val
.
llAddToLandPassList
(key avatar, float hours);
Add avatar
to the land pass list for
- hours
.
llAdjustSoundVolume
(float volume);
Adjusts the volume of the currently playing attached sound
- started with llPlaySound or
- llLoopSound. This function
- Has no effect on sounds started with llTriggerSound.
llAllowInventoryDrop
(integer add);
If add
== TRUE, users that do no have
- object modify permissions can still drop inventory items onto
- object.
float llAngleBetween
(rotation a, rotation b);
Returns the angle in radians between rotations
- a
and b
.
llApplyImpulse
(vector force, integer local);
Applies the impulse
in local
- coordinates if local
== TRUE. Otherwise the
- impulse is applied in global coordinates. This function only works
- on physical objects.
llApplyRotationalImpulse
(vector force, integer local);
Applies a rotational impulse
force in
- local coordinates if local
==
- TRUE. Otherwise the impulse is applied in global coordinates. This
- function only works on physical objects.
Returns the arcsine in radians of
- val
.
float llAtan2
(float y, float x);
returns the arctangent2 of y
,
- x
llAttachToAvatar
(key avatar, integer attachment);
Attach to avatar
at point attachment
.
- Requires the PERMISSION_ATTACH runtime
- permission.
key llAvatarOnSitTarget
(void);
If an avatar is sitting on the sit target, return
- the avatar's key, NULL_KEY otherwise.
- This only will detect avatars sitting on sit targets defined with llSitTarget.
rotation llAxes2Rot
(vector fwd, vector left, vector up);
Returns the rotation represented by coordinate axes
- fwd
, left
, and
- up
.
rotation llAxisAngle2Rot
(vector axis, float angle);
Returns the rotation generated angle
- about axis
.
string llBase64ToString
(string str);
Converts a Base 64 string to a conventional string. If the
- conversion creates any unprintable characters, they are converted to
- spaces.
llBreakLink
(integer linknum);
Delinks the object with the given
- link
number. Requires permission PERMISSION_CHANGE_LINKS
- be set.
list llCSV2List
(string src);
Create a list from a string of comma separated values
- specified in src
.
integer llCeil
(float val);
Returns largest integer value >=
- val
.
llCloseRemoteDataChannel
(key channel);
Closes XML-RPC channel.
float llCloud
(vector offset);
Returns the cloud density at the object position +
- offset
.
llCollisionFilter
(string name, key id, integer accept);
If accept
== TRUE, only accept
- collisions with objects name
and
- id
, otherwise with objects not
- name
or id
. Specify
- an empty string or NULL_KEY to
- not filter on the corresponding parameter.
llCollisionSound
(string impact_sound, float impact_volume);
Suppress default collision sounds, replace default impact
- sounds with impact_sound
found in the
- object inventory. Supply an empty string to suppress collision
- sounds.
llCollisionSprite
(string impact_sprite);
Suppress default collision sprites, replace default impact
- sprite with impact_sprite
found in the
- object inventory. Supply an empty string to just suppress.
float llCos
(float theta);
Returns the cosine of theta
- radians.
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.
list llDeleteSubList
(list src, integer start, integer end);
Remove the slice from the list and return the remainder.
- The 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.
string llDeleteSubString
(string src, integer start, integer end);
Removes the indicated substring and returns the result. The
- 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.
llDetachFromAvatar
(key avatar);
Drop off of avatar
.
vector llDetectedGrab
(integer number);
Returns the grab offset of detected object
- number
. Returns <0,0,0> if number is
- not valid sensed object.
integer llDetectedGroup
(integer number);
Returns TRUE if detected object
- number
is part of same group as
- owner.
key llDetectedKey
(integer number);
Returns the key of detected object
- number
. Returns NULL_KEY if number is not valid sensed
- object.
integer llDetectedLinkNumber
(integer number);
Returns the link position of the triggered event for
- touches. 0 for a non-linked object, 1 for the root of a linked
- object, 2 for the first child, etc.
string llDetectedName
(integer number);
Returns the name of detected object
- number
. Returns empty string if
- number
is not valid sensed object.
key llDetectedOwner
(integer number);
Returns the key of detected number
- object's owner. Returns invalid key if
- number
is not valid sensed object.
vector llDetectedPos
(integer number);
Returns the position 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 llDetectedType
(integer number);
Returns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of
- detected object number
. Returns 0 if
- number
is not valid sensed object. Note
- that number
is a bitfield, so comparisons
- need to be a bitwise and check. eg:
-
integer type = llDetectedType(0);
-if (type & AGENT)
-{
- // ...do stuff with the agent
-}
-
-
vector llDetectedVel
(integer number);
Returns the velocity of detected object
- number
. Returns <0,0,0> if
- number
is not valid sensed object.
llDialog
(key avatar, string message, list buttons, integer channel);
Opens a "notify box" in the top-right corner of the given avatar's screen displaying the message. Up to twelve buttons can be specified in a list of strings. When the player clicks a button, the name of the button is chatted on the specified channel. Channels work just like llSay(), so channel 0 can be heard by everyone. The chat originates at the object's position, not the avatar's position. e.g.
-
LLDialog(who, "Are you a boy or a girl?", [ "Boy", "Girl" ], 4913);
-LLDialog(who, "This shows only an OK button.", [], 192);
-llDialog(who, "This chats so you can hear it.", ["Hooray"], 0);
-
-
Delete the object which holds the script.
string llDumpList2String
(list src, string separator);
Write the list out in a single string using separator between values.
string llEscapeURL
(string url);
Returns the string that is the URL escaped version of url
,
- replacing spaces with %20 etc.
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.
llEjectFromLand
(key pest);
Ejects pest
from land that you
- own.
llEmail
(string address, string subject, string message);
Sends email to address
with
- subject
and
- message
.
rotation llEuler2Rot
(vector vec);
Returns the rotation represented by Euler Angle
- vec
.
Returns the absolute value of
- val
.
integer llFloor
(float val);
Returns largest integer value <=
- val
.
float llFrand
(float mag);
Returns a pseudo-random number between [0,
- mag
).
integer llGetAttached
(void);
Returns the object attachment point or 0 if not attached.
integer llGetAgentInfo
(key id);
Returns information about the given agent
- id
. Returns a bitfield of agent info constants.
vector llGetAgentSize
(key id);
If the agent id
is in the same sim as
- the object, returns the size of the avatar.
float llGetAlpha
(integer face);
Returns the alpha of the given
- face
. If face
is
- ALL_SIDES the value returned is
- the mean average of all faces.
float llGetAndResetTime
(void);
Returns the seconds of elapsed time from an internal timer
- associated with the script. The timer is reset to zero during the
- call. The timer is also reset on rez, simulator restart, script
- reset, and in calls to llResetTime. Use llSetTimerEvent if you want a
- reliable timing mechanism.
string llGetAnimation
(key id);
Returns the currently playing animation for avatar
- id
.
list llGetAnimationList
(key id);
Returns a list of currently playing animations for avatar
- id
.
list llGetBoundingBox
(key object);
Returns the bounding box around object
(including any linked prims)
- relative to the root prim. Returned value is a list of the form:
- [ (vector) min_corner, (vector) max_corner ]
vector llGetCenterOfMass
(void);
Returns the center of mass of the root object.
vector llGetColor
(integer face);
Returns the color of face
as a vector
- of red, green, and blue values between 0 and 1. If
- face
is ALL_SIDES the color returned is the
- mean average of each channel.
Returns the creator of the object which has the script.
Returns the current UTC date as YYYY-MM-DD.
Returns how much energy is in the object as a percentage of
- maximum.
Returns the current force if the script is physical.
integer llGetFreeMemory
(void);
Returns the available heap space for the current script.
vector llGetGeometricCenter
(void);
Returns the geometric center of the linked set the script is attached to.
float llGetGMTclock
(void);
Returns the time in seconds since GMT midnight.
key llGetInventoryCreator
(string name);
Returns the key for the creator of the inventory
- name
.
key llGetInventoryKey
(string name);
Returns the key of the inventory
- name
.
string llGetInventoryName
(integer type, integer number);
Get the name of the inventory item
- number
of type
. Use
- the inventory constants to
- specify the type
.
integer llGetInventoryNumber
(integer type);
Get the number of items of type
in
- the object inventory. Use the inventory constants to specify
- the type
.
integer llGetInventoryPermMask
(string item, integer mask);
Returns the requested permission mask
for the
- specified inventory item. See Permission Mask Constants
- for more information. Example usage:
-
integer JeansPerms = llGetInventoryPermMask("Black Jeans", MASK_NEXT);
-if (JeansPerms & PERM_COPY)
-{
- llSay(0, "The next owner may copy the 'Black Jeans'");
-}
-
integer llGetInventoryType
(string name);
Returns the type of the inventory
- name
. INVENTORY_NONE is returned if no
- inventory matching name
is found. Use the inventory constants to compare
- against the return value.
Get the key for the object which has this script.
key llGetLandOwnerAt
(vector pos);
Returns the key of the land owner at
- pos
or NULL_KEY if public.
key llGetLinkKey
(integer linknum);
Returns the key of linknum
in the link
- set.
string llGetLinkName
(integer linknum);
Returns the name of linknum
in the
- link set.
integer llGetLinkNumber
(void);
Returns what link number in a link set the for the object
- which has this script. 0 means no link, 1 the root, 2 for first
- child, etc.
integer llGetListEntryType
(list src, integer index);
Returns the type of the
- variable at index
in
- src
.
integer llGetListLength
(list src);
Returns the number of elements in
- src
.
vector llGetLocalPos
(void);
Returns the local position of a child object relative to the
- root.
rotation llGetLocalRot
(void);
Returns the local rotation of a child object relative to the
- root.
Returns the mass of the object in Kilograms. Most materials
- in Second Life are less dense than their first life counterparts,
- so the returned mass may be less than you might expect.
float llGetObjectMass
(key id);
Returns the mass of the object specified by id
in Kilograms. Most materials
- in Second Life are less dense than their first life counterparts,
- so the returned mass may be less than you might expect.
llGetNextEmail
(string address, string subject);
Get the next waiting email with appropriate
- address
and/or
- subject
. If the parameters are blank, they
- are not used for filtering.
key llGetNotecardLine
(string name, integer line);
This function fetches line number
- line
of notecard
- name
and returns the data through the dataserver event. The line count
- starts at zero. If the requested line is past the end of the
- notecard the dataserver
- event will return the constant EOF string. The key returned by
- this function is a unique identifier which will be supplied to the
- dataserver event in the
- requested
parameter.
key llGetNumberOfNotecardLines
(string name);
This function reads the number of lines in notecard name
- and returns this information through the dataserver event.
- The key returned by this function is a unique identifier which will be supplied to the
- dataserver event in the requested
- parameter. You will need to cast the returned string to an integer.
integer llGetNumberOfPrims
(void);
Returns the number of prims in the linked set the script is attached to.
key llGetNumberOfSides
(void);
Returns the number of sides of the current which has the
- script.
string llGetObjectDesc
(void);
Returns the description of the object which has the script.
string llGetObjectName
(void);
Returns the name of the object which has the script.
integer llGetObjectPermMask
(integer mask);
Returns the requested permission mask
for the root object the
- task is attached to. See Permission Mask Constants
- for more information. Example usage:
-
integer ObjectPerms = llGetObjectPermMask(MASK_NEXT);
-if (ObjectPerms & PERM_COPY)
-{
- llSay(0, "The next owner may copy this item");
-}
-
Returns the owner of the object.
key llGetOwnerKey
(key id);
Returns the owner of object
- id
.
integer llGetPermissions
(void);
Returns what permissions have been enabled. eg:
-
integer perm = llGetPermissions();
-if((perm & PERMISSION_DEBIT) == PERMISSION_DEBIT)
-{
- // code goes here
-}
-
key llGetPermissionsKey
(void);
Returns avatar that has enabled permissions. Returns NULL_KEY if not enabled.
list llGetPrimitiveParams
(list parameters);
Get primitive parameters specified in parameters
. The
- parameters
are identical to the rules of llSetPrimitiveParams, and the returned list is ordered as such. Most requested parameters do not require a value to be associated, except for texture-related requests (PRIM_TEXTURE, PRIM_COLOR, and PRIM_BUMP_SHINY) which require a side number to be specified as well.
-
- Valid parameters can be found in the Primitive Constants.
- Here is a simple example:
-
llGetPrimitiveParams([PRIM_TYPE, PRIM_MATERIAL, PRIM_COLOR, ALL_SIDES, PRIM_POSITION]);
-
- This would return a list similar to this:
-
[PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0, 1, 0>, 0.0, <0, 0, 0>, <1, 1, 0>, <0, 0, 0>, // PRIM_TYPE
- PRIM_MATERIAL_WOOD, // PRIM_MATERIAL
- 0, <1, 1, 1>, 1.0, // PRIM_COLOR (ALL_SIDES specified, so all 6 sides returned)
- 1, <1, 0, 0>, 0.5,
- 2, <0, 0, 1>, 1.0,
- 3, <0, 1, 0>, 1.0,
- 4, <0, 0, 0>, 0.5,
- 5, <1, 1, 1>, 1.0,
- <37.341, 195.283, 31.239>] // PRIM_POSITION
-
Returns a vector with the south west corner position of the
- current region.
Returns the mean region frames per second.
string llGetRegionName
(void);
Returns the current region name.
float llGetRegionTimeDilation
(void);
Returns the current time dilation as a float between 0 and 1.
vector llGetRootPosition
(void);
Returns the global position of the root object of the object the script is attached to.
rotation llGetRootRotation
(void);
Returns the global rotation of the root object of the object the script is attached to.
string llGetScriptName
(void);
Returns the name of this script.
integer llGetStartParameter
(void);
Returns the start parameter passed to llRezObject or llRezAtRoot. If the object was
- created from agent inventory, this function returns 0.
integer llGetScriptState
(string name);
Resets TRUE if script name
is running
integer llGetStatus
(integer status);
Returns the value of status
. The
- value will be one of the status
- constants.
string llGetSubString
(string src, integer start, integer end);
Returns the indicated substring from
- src
. The 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.
vector llGetSunDirection
(void);
Returns the sun direction on the simulator.
string llGetTexture
(integer face);
Returns the texture of face
if it is
- found in object inventory.
vector llGetTextureOffset
(integer side);
Returns the texture offset of side
in
- the x and y components of a vector.
float llGetTextureRot
(integer side);
Returns the texture rotation of
- side
.
vector llGetTextureScale
(integer side);
Returns the texture scale of side
in
- the x and y components of a vector.
Returns the seconds of elapsed time from an internal timer
- associated with the script. The timer is reset on rez, simulator
- restart, script reset, and in calls to llGetAndResetTime or llResetTime. Use llSetTimerEvent if you want a
- reliable timing mechanism.
float llGetTimeOfDay
(void);
Gets the time in seconds since midnight in Second Life.
string llGetTimestamp
(void);
Returns a timestamp in the format: YYYY-MM-DDThh:mm:ss.ff..fZ.
vector llGetTorque
(void);
Returns the torque if the script is physical.
float llGetWallclock
(void);
Returns the time in seconds since simulator timezone
- midnight. Currently this is PST.
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 has
- been called with TRUE, any other object can pass objects to its
- inventory.
llGiveInventoryList
(key destination, string category, list inventory);
Give the list of named inventory items 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. The offered inventory is then
- placed in a folder named category
in the
- recipients inventory. If the recipient is an object, the same
- permissions apply as if you were dragging inventory onto the
- object by hand, ie if llAllowInventoryDrop has
- been called with TRUE, any other object can pass objects to its
- inventory.If the recipient is an object, the
- category
parameter is ignored.
llGiveMoney
(key destination, integer amount);
Transfer amount
from the script owner
- to destination
. This call will fail if
- PERMISSION_DEBIT has not
- been set.
float llGround
(vector offset);
Returns the ground height at the object position +
- offset
.
vector llGroundContour
(vector offset);
Returns the ground contour at the object position +
- offset
.
vector llGroundNormal
(vector offset);
Returns the ground contour at the object position +
- offset
.
llGroundRepel
(float height, integer water, float tau);
Critically damps to height
if within
- height
* 0.5 of
- level
. The height
- is above ground level if water
is FALSE or
- above the higher of land and water if water
- is TRUE.
vector llGroundSlope
(vector offset);
Returns the ground slope at the object position +
- offset
.
string llInsertString
(string dst, integer position, string src);
Inserts src
into
- dst
at position
and
- returns the result.
llInstantMessage
(key user, string message);
Send message
to the
- user
as an instant message.
string llKey2Name
(key id);
If object id
is in the same
- simulator, return the name of the object.
string llList2CSV
(list src);
Create a string of comma separated values from
- list
.
float llList2Float
(list src, integer index);
Returns the float at index
in the
- list src
.
integer llList2Integer
(list src, integer index);
Returns the integer at index
in the list
- src
.
key llList2Key
(list src, integer index);
Returns the key at index
in the list
- src
.
list llList2List
(list src, integer start, integer end);
Returns the slice of the list from
- start
to end
from
- the list src
as a new list. The
- start
and end
- parameters 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 llList2ListStrided
(list src, integer start, integer end, integer stride);
Copy the strided slice of src
from
- start
to end
.
rotation llList2Rot
(list src, integer index);
Returns the rotation at index
in
- src
.
string llList2String
(list src, integer index);
Returns the string at index
in
- src
.
llList2Vector
(list src, integer index);
Returns the string at index
in
- src
.
integer llListFindList
(list src, list test);
Returns the position of the first instance of
- test
in src
. Returns
- -1 if test
is not in
- src
.
list llListInsertList
(list dest, list src, integer pos);
Returns the list created by inserting
- src
into dest
at
- pos
.
list llListRandomize
(list src, integer stride);
Returns src
randomized into blocks of
- size stride
. If the length of
- src
divided by
- stride
is non-zero, this function does
- not randomize the list.
list llListReplaceList
(list dest, list src, integer start, integer end);
Returns the list created by replacing the segment of dest
from
- start
to end
with src
.
list llListSort
(list src, integer stride, integer ascending);
Returns src
sorted into blocks of
- stride
in ascending order if
- ascending
is TRUE. Note that sort only works in
- the head of each sort block is the same type.
integer llListen
(integer channel, string name, key id, string msg);
Sets a listen event callback for msg
- on channel
from name
- and returns an identifier that can be used to deactivate or remove
- the listen. The name
,
- id
and/or msg
- parameters can be blank to indicate not to filter on that
- argument. Channel 0 is the public chat channel that all avatars
- see as chat text. Channels 1 to 2,147,483,648 are hidden channels
- that are not sent to avatars.
llListenControl
(integer number, integer active);
Make a listen event callback active or inactive. Pass in the
- value returned from llListen
- to the number
parameter to specify which
- event you are controlling. Use boolean values to specify
- active
.
llListenRemove
(integer number);
Removes a listen event callback. Pass in the value returned
- from llListen to the
- number
parameter to specify which event you
- are removing.
llLoadURL
(key avatar_id, string message, string url);
Displays a dialog to user avatar_id
- with message
offering to
- go to the web page at url
. If the user clicks the
- "Go to page" button, their default web browser is launched and
- directed to url
.
The url
must begin with "http:" or
- "https:", other protocols are not currently supported.
- The dialog box shows the name of the object's
- owner so that abuse (e.g. spamming) can be easily reported.
- This function has a 10 second implicit sleep.
Returns the natural logarithm (base e) of
- val
if val
> 0,
- otherwise returns 0.
float llLog10
(float val);
Returns the base 10 log of val
if
- val
> 0, otherwise returns 0.
llLookAt
(vector target, float strength, float damping);
Cause object to point the forward axis toward
- target
. Good
- strength
values are around half the mass of
- the object and good damping
values are less
- than 1/10th of the
- strength
. Asymmetrical shapes require
- smaller damping
. A
- strength
of 0.0 cancels the look at.
llLoopSound
(string sound, float volume);
Similar to llPlaySound, this function 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 at a time. A second call to
- llLoopSound with the same key will not restart the sound, but the
- new volume will be used. This 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.
llLoopSoundMaster
(string 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. The use of multiple
- masters within a small area is unlikely to produce the desired
- effect.
llLoopSoundSlave
(string 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 synchronizing the loop points of both sounds. If a
- Sync Master is started when the Slave is already playing, the
- Slave will skip to the correct position to sync with the
- Master.
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.
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.
llMakeFountain
(integer particles, float scale, float velocity, float lifetime, float arc, string texture, vector 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.
string llMD5String
(string str, integer nonce);
Performs a RSA Data Security, Inc. MD5 Message-Digest
- Algorithm on str
with
- nonce
. The function returns the digest as a
- 32 character hex string. The digest is computed on the string in
- the following format:
-
str
+ ":" + (string)nonce
-
-
llMessageLinked
(integer linknum, integer num, string str, key id);
Sends num
,
- str
, and id
to
- members of the link set. The linknum
- parameter is either the linked number available through llGetLinkNumber or a link constant.
llMinEventDelay
(float delay);
Set the minimum time between events being handled.
llModifyLand
(integer action, integer size);
Modify land with action
on
- size
area. The parameters can be chosen
- from the land constants.
integer llModPow
(integer a, integer b, integer c);
Raise a
to the b
power, modulo c
.
- b
is capped at 0xFFFF (16 bits).
llMoveToTarget
(vector target, float tau);
Critically damp to position 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.
llOffsetTexture
(float offset_s, float offset_t, integer face);
Sets the texture s and t offsets of
- face
. If face
is
- ALL_SIDES this
- function sets the texture offsets for all faces.
llOpenRemoteDataChannel
(void);
Creates a channel to listen for XML-RPC calls.
- Will trigger a remote_data event with type = REMOTE_DATA_CHANNEL and a channel id once it is available.
integer llOverMyLand
(key id);
Returns TRUE if
- id
is over land owned by the object owner,
- FALSE otherwise.
llParcelMediaCommandList
(list command_list);
Controls the playback of movies and other multimedia resources on a land parcel.
- command
can be one of
- PARCEL_MEDIA_COMMAND_STOP,
- PARCEL_MEDIA_COMMAND_PAUSE,
- PARCEL_MEDIA_COMMAND_PLAY,
- PARCEL_MEDIA_COMMAND_LOOP,
- PARCEL_MEDIA_COMMAND_TEXTURE,
- PARCEL_MEDIA_COMMAND_URL,
- PARCEL_MEDIA_COMMAND_TYPE,
- PARCEL_MEDIA_COMMAND_DESC,
- PARCEL_MEDIA_COMMAND_SIZE,
- PARCEL_MEDIA_COMMAND_TIME,
- PARCEL_MEDIA_COMMAND_AGENT,
- PARCEL_MEDIA_COMMAND_UNLOAD, or
- PARCEL_MEDIA_COMMAND_AUTO_ALIGN.
-
You are allowed one movie (or "media" resource) per land parcel.
- The movie will be played by replacing a texture on an object with the
- movie. Users will only see the movie when they are standing on your
- land parcel. Otherwise they will see the static texture.
Most of the QuickTime media formats are supported including:
-
QuickTime movies (.mov)
Streamable stored QuickTime movies (.mov)
Real time QuickTime streams (rtsp://)
MPEG4 movies (.mp4, .mpeg4) (simple profile only)
QuickTime VR scenes and objects (.mov)
Flash movies (.swf) (only non-interative, version 5 and earlier
and many others from http://www.apple.com/quicktime/products/qt/specifications.html
- A good rule of thumb is if it plays in the QuickTime Media Player, it will play in Second Life.
-
You can set up a movie for playback as follows:
-
First, select a texture from your inventory to be the static texture. It should not be a common texture -- a test pattern would be better than the default plywood.
Apply that texture to an object.
Right click on your land and select "About Land..."
Under "Options" use the GUI to select the static texture.
Enter the URL of your movie or media stream.
Create objects you want to click on for PLAY, STOP, PAUSE and LOOP (play forever)
Attach the following script (or similar) to each.
-
default
-{
- touch_start ( integer total_number )
- {
- // This will play the current movie for all agents in the parcel.
- llParcelMediaCommandList( [PARCEL_MEDIA_COMMAND_LOOP] );
- }
-}
-
-Or a more advanced example:
-
float START_TIME = 30.0;
-float RUN_LENGTH = 10.0;
-
-default
-{
- state_entry()
- {
- llParcelMediaCommandList( [
- PARCEL_MEDIA_COMMAND_URL, "http://enter_your.url/here",
- PARCEL_MEDIA_COMMAND_TEXTURE, (key) llGetTexture(0) ] );
- }
-
- touch_start(integer num_detected)
- {
- llParcelMediaCommandList( [
- PARCEL_MEDIA_COMMAND_AGENT, llDetectedKey(0),
- PARCEL_MEDIA_COMMAND_TIME, START_TIME,
- PARCEL_MEDIA_COMMAND_PLAY ] );
- list Info = llParcelMediaQuery([PARCEL_MEDIA_COMMAND_URL, PARCEL_MEDIA_COMMAND_TEXTURE]);
- llSay(0, "Playing '" + llList2String(Info, 0) + "' on texture '" + (string)llList2Key(Info, 1) + "' for agent " + llDetectedName(0));
- llSetTimerEvent(RUN_LENGTH);
- }
-
- timer()
- {
- llParcelMediaCommandList( [ PARCEL_MEDIA_COMMAND_STOP ] );
- llSetTimerEvent(0.0);
- }
-}
-
-
-
-
list llParseString2List
(string src, list separators, list spacers);
Breaks src
into a list, discarding
- anything in separators
, keeping any entry
- in spacers
. The
- separators
and
- spacers
must be lists of strings with a
- maximum of 8 entries 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"]
-
list llParseStringKeepNulls
(string src, list separators, list spacers);
Breaks src
into a list, discarding
- anything in separators
, keeping any entry
- in spacers
. Any resulting null values
- are kept. The separators
and
- spacers
must be lists of strings with a
- maximum of 8 entries each. So, if you had made the call:
-
llParseString2List("!Parsethisthisnow I dare::you to.", ["this", "!", " "], [":"]);
-
- You would get the list:
-
[NULL, "Parse", NULL, "now", "I", "dare", ":", NULL, ":", "you", "to"]
-
llParticleSystem
(list parameters);
Makes a particle system based on the parameter list. The
- parameters
are specified as an ordered list
- of parameter and value. Valid parameters and their expected values
- can be found in the particle system
- constants. Here is a simple example:
-
llParticleSystem([PSYS_PART_FLAGS, PSYS_PART_WIND_MASK,
- PSYS_PART_START_COLOR, <1,0,0>,
- PSYS_SRC_PATTERN, PSYS_SRC_PATTERN_EXPLODE]);
-
llPassCollisions
(integer pass);
If pass
is TRUE, land and object collisions
- are passed from children on to parents.
llPassTouches
(integer pass);
If pass
is TRUE, touches are passed from
- children on to parents.
llPlaySound
(string sound, float volume);
Plays a sound once. The sound will be attached to an object
- and follow object movement. Only one sound may be attached to an
- object at a time, and attaching a new sound or calling llStopSound will stop the
- previously attached sound. A second call to llPlaySound with the
- same sound
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.
llPlaySoundSlave
(string 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.
Make avatar that owns object point at
- pos
.
llPow
(float base, float exp);
Returns base
raised to the
- exp
.
llPreloadSound
(string sound);
Preloads sound
from object inventory
- on nearby viewers.
llPushObject
(key id, vector impulse, vector angular_impulse, integer local);
Applies impulse
and
- angular_impulse
to object
- id
.
llReleaseControls
(key avatar);
Stop taking inputs from avatar
.
llRemoteDataReply
(key channel, key message_id, string sdata);
Send an XML-RPC reply to message_id on channel with payload of string sdata.
llRemoteDataSetRegion
(void);
If an object using remote data channels changes regions, you
- must call this function to reregister the remote data
- channels. You do not need to make this call if your object does
- not change regions or use remote data channels.
llRemoteLoadScript
(void);
Deprecated. Please use llRemoteLoadScriptPin instead.
llRemoteLoadScriptPin
(key target, string name, integer pin, integer running, integer param);
If the owner of the object this script is attached can modify target
, it has the correct pin
and the objects are in the same region, copy script name
onto target
, if running
== TRUE, start the script with param
. If name
already exists on target
, it is replaced.
llRemoveInventory
(string inventory);
Remove the name inventory
item from
- the object inventory.
llRemoveVehicleFlags
(integer flags);
Sets the vehicle flags
to
- FALSE. Valid parameters can be found in the vehicle flags constants
- section.
key llRequestAgentData
(key id, integer data);
This function requests data about agent
- id
. If and when the information is
- collected, the dataserver
- event is called with the returned key returned from this function
- passed in the requested
parameter. See the
- agent data constants for
- details about valid values of data
and what
- each will return in the dataserver event.
key llRequestInventoryData
(string name);
Requests data from object inventory item
- name
. When data is available the dataserver event will be raised
- with the key returned from this function in the
- requested
parameter. 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 of the region the script call is made
- (possible even resulting in negative values). So, to
- convert this value into a global position, just add the result of
- llGetRegionCorner.
integer llRequestPermissions
(key avatar, integer perm);
Ask avatar
to allow the script to do
- perm
. The perm
- parameter should be a permission
- constant. Multiple permissions can be requested
- simultaneously by or'ing the constants together. Many of the
- permissions requests can only go to object owner. This call will
- not stop script execution - if the specified avatar grants the
- requested permissions, the run_time_permissions
- event will be called.
key llRequestSimulatorData
(string sim_name, integer data);
This function requests data about simulator
- sim_name
. When the information is
- collected, the dataserver
- event is called with the returned key returned from this function
- passed in the requested
parameter. See the
- simulator data constants for
- details about valid values of data
and what
- each will return in the dataserver event.
llResetOtherScript
(string name);
Resets the script name
.
Sets the internal script timer to zero.
llRezAtRoot
(string inventory, vector pos, vector vel, rotation rot, integer param);
Creates object's inventory
object at
- position pos
with velocity
- vel
and rotation
- rot
. The last selected root object's location
- in a multi-object selection will be placed at pos
.
- All other objects in a selection will be created relative to the last
- selected root's position, taking rot
into account.
- The param
value
- will be available to the newly created object in the on_rez event or through the llGetStartParameter
- library function. The vel
parameter is
- ignored if the rezzed object is not physical.
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
. The param
value
- will be available to the newly created object in the on_rez event or through the llGetStartParameter
- library function. The vel
parameter is
- ignored if the rezzed object is not physical.
float llRot2Angle
(rotation rot);
Returns the rotation angle represented by
- rot
.
vector llRot2Axis
(rotation rot);
Returns the rotation axis represented by
- rot
.
vector llRot2Euler
(rotation rot);
Returns the Euler Angle representation of
- rot
.
vector llRot2Fwd
(rotation rot);
Returns the forward axis represented by
- rot
.
llRot2Left
(rotation rot);
Returns the left axis represented by
- rot
.
Returns the up axis represented by
- rot
.
rotation llRotBetween
(vector a, vector b);
Returns the rotation needed to rotate
- a
to b
.
llRotLookAt
(rotation rot, float strength, float damping);
Cause object to rotate to rot
. Good
- strength
values are around half the mass of
- the object and good damping
values are less
- than 1/10th of the
- strength
. Asymmetrical shapes require
- smaller damping
. A
- strength
of 0.0 cancels the look at.
integer llRotTarget
(rotation rot, float error);
Set object rotation within error
of
- rotation
as a rotational target and return
- an integer number for the target. The number can be used in llRotTargetRemove.
llRotTargetRemove
(integer number);
Remove rotational target
- number
.
llRotateTexture
(float radians, integer face);
Sets the texture rotation of face
to
- radians
. If face
- ALL_SIDES, rotate the
- texture of all faces.
integer llRound
(float val);
returns val
rounded to the nearest
- integer.
integer llSameGroup
(key id);
Returns TRUE if the
- object or agent id
is in the same simulator
- and has the same active group as this object. Otherwise, returns
- FALSE.
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 to
- 2,147,483,648 are private channels that are not sent to avatars
- but other scripts can listen for through the llListen api.
llScaleTexture
(integer scale_s, integer scale_t, integer face);
Sets the texture s and t scales of
- face
to scale_s
and
- scale_t
respectively. If face is ALL_SIDES, scale the texture
- to all faces.
integer llScriptDanger
(vector pos);
Returns true if pos is over public land, land that doesn't allow everyone to edit and build, or land that doesn't allow outside scripts.
key llSendRemoteData
(string dest, integer idata, string sdata);
Send an XML-RPC request to dest through channel with payload
- of channel (in a string), integer idata and string sdata. An
- XML-RPC reply will trigger a remote_data event with type =
- REMOTE_DATA_REPLY. The call returns a message_id that can be used
- to identify XML-RPC replies.
llSensor
(string name, key id, integer type, float range, float arc);
Performs a single scan for name
and
- id
with type
within
- range
meters and arc
- radians of forward vector. Specifying a blank name or NULL_KEY id will not filter results for
- any particular name or id. A range of 0.0 does not perform a
- scan. Range is limited to 96.0. The type
parameter should be an object type constant value. If anything is found
- during the scan, a sensor event is triggered. A maximum
- of 16 items are passed to this event. If nothing is found during the scan, a
- no sensor event is triggered instead.
llSensorRepeat
(string name, key id, integer type, float range, float arc, float rate);
Performs a single scan for name
and
- id
with type
within
- range
meters and arc
- radians of forward vector and repeats every
- rate
seconds. Specifying a blank name or
- NULL_KEY id will not filter
- results for any particular name or id. A range of 0.0 cancels the
- scan. Range is limited to 96.0. The type
parameter should be an object type constant
- value. If anything is found during the scan, a sensor
- event is triggered. A maximum of 16 items are passed to this event. If nothing is found
- during the scan, a no sensor event is triggered instead.
llSetAlpha
(float alpha, integer face);
Sets the alpha value for face
. If
- face is ALL_SIDES, set
- the alpha to all faces. The alpha
value is
- interpreted as an opacity percentage - 1.0 is fully opaque, and
- 0.2 is mostly transparent. This api will clamp
- alpha
values less 0.1 to .1 and greater
- than 1.0 to 1.
llSetBuoyancy
(float buoyancy);
Set the object buoyancy. A value of 0 is none, less than 1.0 sinks,
- 1.0 floats, and greater than 1.0 rises.
llSetCameraAtOffset
(vector offset);
Sets the camera at offset used in this object if an avatar
- sits on it.
llSetClickAction
(integer action);
Sets which action is invoked when a resident clicks a prim.
llForceMouselook
(integer mouselook);
Puts the camera into mouselook mode if an avatar
- sits on this object.
llSetCameraEyeOffset
(vector offset);
Sets the camera eye offset used in this object if an avatar
- sits on it.
llSetColor
(vector color, integer face);
Sets the color
of
- face
. If face is ALL_SIDES, set the alpha to
- all faces.
llSetDamage
(float damage);
Sets the amount of damage that will be done to an object
- that this object hits. This object will be destroyed on damaging
- another object.
llSetForce
(vector force, integer local);
If the object is physical, this function sets the
- force
. The vector is in local coordinates if
- local is TRUE, global if
- FALSE.
llSetForceAndTorque
(vector force, vector torque, integer local);
If the object is physical, this function sets the
- force
and
- torque
. The vectors are in local coordinates
- if local is TRUE, global if
- FALSE.
llSetHoverHeight
(float height, float water, float tau);
Critically damps to a height. The height is above ground and
- water if water
is TRUE.
llSetLinkAlpha
(integer linknumber, float alpha, integer face);
Sets the alpha
of a prim in the link set.
- The linknum
- parameter is either the linked number available through llGetLinkNumber or a link constant.
- If face
is
- ALL_SIDES, set the alpha
- of all faces.
llSetLinkColor
(integer linknumber, vector color, integer face);
Sets the color
of a prim in the link set.
- The linknum
- parameter is either the linked number available through llGetLinkNumber or a link constant.
- If face
is
- ALL_SIDES, set the color
- of all faces.
llSetLinkPrimitiveParams
(integer linknumber, list rules);
Sets the primitive parameters of a prim in the link set.
- The linknum
- parameter is either the linked number available through llGetLinkNumber or a link constant.
- The rules
- list is identical to that of
- llSetPrimitiveParams.
llSetLinkTexture
(integer linknumber, string texture, integer face);
Sets the texture
of a prim in the link set.
- The linknum
- parameter is either the linked number available through llGetLinkNumber or a link constant.
- If face
is
- ALL_SIDES, set the texture
- of all faces.
llSetLocalRot
(rotation rot);
If the object is not physical, this function sets the
- rotation of a child prim relative to the root prim, and the
- linked set is adjusted.
llSetObjectDesc
(string description);
Sets the object description to description
.
llSetObjectName
(string name);
Sets the object name to name
.
llSetParcelMusicURL
(string url);
Sets the streaming audio URL for the parcel where the object
- is currently located. The url
must be an
- http streaming source of mp3 or ogg data.
llSetPayPrice
(integer default_price, list quick_pay_buttons);
Sets the default pay price and optionally the quick pay buttons
- for the 'Pay' window when someone pays this object.
- See also Pay Button Constants.
If the object is not physical, this function sets the
- position in region coordinates. If the object is a child, the
- position is treated as root relative and the linked set is
- adjusted.
llSetPrimitiveParams
(list rules);
Set primitive parameters based on rules
. The
- rules
are specified as an ordered list
- of parameter and value(s). Valid parameters and their expected values
- can be found in the Primitive Constants.
- Here is a simple example:
-
llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0,1,0>,
- 0.5, <-0.2, 0.2, 0>, <0.5,0.5,0>,<-0.5,0.5,0>]);
-
llSetRemoteScriptAccessPin
(integer pin);
If pin is set to a non-zero number, the task will accept remote script
- loads via llRemoteLoadScriptPin if it passes in the correct pin.
- Otherwise, llRemoteLoadScriptPin is ignored.
If the object is not physical, this function sets the
- rotation. If the object is a child, the position is treated as
- root relative and the linked set is adjusted.
llSetScale
(vector scale);
Sets the object scale.
llSetScriptState
(string name, integer run);
Control the state of a script on the object.
llSetSitText
(string text);
Displays text
rather than 'sit' in
- viewer pie menu.
llSetSoundQueueing
(integer queue);
Sets whether successive calls to llPlaySound, llLoopSound, etc., (attached
- sounds) interrupt the playing sound. The default for objects is
- FALSE. Setting this value to
- TRUE will make the sound wait
- until the current playing sound reaches its end. The queue is one
- level deep.
llSetStatus
(integer status, integer value);
Sets the status
to
- value
. Use status constants for the values of
- status
.
llSetText
(string text, vector color, float alpha);
Sets text that floats above object to
- text
, using the specified
- color
and
- alpha
.
llSetTexture
(string texture, integer face);
Sets the texture
from object
- inventory of face
. If face is ALL_SIDES, set the texture to
- 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. The mode is a mask of texture animation
- constants. You can only have one texture animation on an
- object, calling llSetTextureAnim more than once on an object will
- reset it.
You can only do one traditional animation, ROTATE or SCALE at a time, you
- cannot 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.
The face
specified which face to
- animate. If face
is ALL_SIDES, all textures on the
- object are animated.
The sizex
and
- sizey
describe the layout of the frames
- within the texture. sizex
specifies how
- many horizontal frames and 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 per second, etc.
llSetTimerEvent
(float sec);
Sets the timer event to
- be triggered every sec
seconds. Passing in
- 0.0 stops further timer
- events.
llSetTorque
(vector torque, integer local);
If the object is physical, this function sets the
- torque
. The vector is in local coordinates
- if local is TRUE, global if
- FALSE.
llSetTouchText
(string text);
Displays text
in viewer pie menu that
- acts as a touch.
llSetVehicleFlags
(integer flags);
Sets the vehicle flags
to TRUE. Valid
- parameters can be found in the vehicle flags constants
- section.
llSetVehicleFloatParam
(integer param_name, float param_value);
Sets the vehicle floating point parameter
- param_name
to
- param_value
. Valid parameters and their
- expected values can be found in the vehicle parameter
- constants section.
llSetVehicleType
(integer type);
Activates the vehicle action and choose vehicle
- type
. Valid types and an explanation of
- their characteristics can be found in the vehicle type constants
- section.
llSetVehicleRotationParam
(integer param_name, rotation param_value);
Sets the vehicle rotation parameter
- param_name
to
- param_value
. Valid parameters can be found
- in the vehicle parameter
- constants section.
llSetVehicleVectorParam
(integer param_name, vector param_value);
Sets the vehicle vector parameter
- param_name
to
- param_value
. Valid parameters can be found
- in the vehicle parameter
- constants section.
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 to
- 2,147,483,648 are private channels that are not sent to avatars
- but other scripts can listen for through the llListen api.
float llSin
(float theta);
Returns the sine of theta
in
- radians.
llSitTarget
(vector offset, rotation rot);
Set the sit location for this object. If
- offset
== ZERO_VECTOR
- clear the sit target.
Puts the script to sleep for sec
- seconds.
Returns the square root of val
. If
- val
is less than 0.0, this function returns
- 0.0 and raises a math runtime error.
llStartAnimation
(string anim);
This function starts animation anim
- for the avatar that owns the object.
Valid strings for anim
- 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 aggressive
- 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.
- 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.
Stop causing object to look at target.
llStopMoveToTarget
(void);
Stops critically damped motion.
Stop avatar that owns object pointing.
integer llStringLength
(string src);
Returns the number of characters in
- src
.
integer llSubStringIndex
(string source, string pattern);
Finds index in source where pattern first appears. Returns
- -1 if no match is found.
string llStringToBase64
(string str);
Converts a string to the Base 64 representation of the string.
llTakeControls
(integer controls, integer accept, integer pass_on);
If (accept
==
- (controls
& input)), send input to
- object. If the boolean pass_on
is TRUE, also send input to
- avatar.
float llTan
(float theta);
Returns the tangent of theta
- radians.
integer llTarget
(vector position, float range);
Set object position within range
of
- position
as a target and returns an integer
- ID for the target.
llTargetOmega
(vector axis, float spinrate, float gain);
Attempt to spin at spinrate
with
- strength gain
on
- axis
. A spinrate
of
- 0.0 cancels the spin. This function works in object local
- coordinates for child objects and works in world coordinates for
- root objects.
llTargetRemove
(integer tnumber);
Remove target number tnumber
.
llTeleportAgentHome
(key id);
Teleport agent on the owner's land to agent's home
- location.
string llToUpper
(string src);
Returns src
in all lower case.
llTriggerSound
(string 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 triggered 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
- this function.
llTriggerSoundLimited
(string sound, float volume, vector tne, vector bsw);
Plays a transient sound NOT attached to an object with its
- audible range limited by the axis aligned bounding box define by
- tne
(top-north-eash) and
- bsw
(bottom-south-west). 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
- triggered 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 this
- function.
string llUnescapeURL
(string url);
Returns the string that is the URL unescaped version of url
,
- replacing %20 with spaces etc.
If 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.
float llVecDist
(vector a, vector b);
Returns the distance from a
to
- b
float llVecMag
(vector vec);
Returns the magnitude of vec
.
vector llVecNorm
(vector vec);
Returns normalized vec
.
llVolumeDetect
(integer detect);
When detect = TRUE, this makes the entire link set the script is attached to phantom but if another object interpenetrates it, it will get a collision_start event. When an object stops interpenetrating, a collision_end event is generated. While the other is interpenetrating, collision events are NOT generated. The script must be applied to the root object of the link set to get the collision events. Collision filters work normally.
float llWater
(vector offset);
Returns the water height at the object position +
- offset
.
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 to
- 2,147,483,648 are private channels that are not sent to avatars
- but other scripts can listen for through the llListen api.
vector llWind
(vector offset);
Returns the wind velocity below the object position +
- offset
.
string llXorBase64Strings
(string s1, string s2);
Performs an exclusive or on two Base 64 strings and returns
- a Base 64 string. The s2
parameter repeats if
- it is shorter than s1
.