LSL Prim Manipulation

By Xah Lee. Date: .

A prim's shape, size, orientation, position, texture, color, can all be changed by a script.

To change a prim, use llSetPrimitiveParams(). The llSetPrimitiveParams() takes a list of arguments, of the form [p1,p1values,p1values…, p2,p2values,p2values, …], were the p are prim property names followed by its values to be set.

Primitive properties include: size, shape (twist, taper…), color and texture, orientation and position, physical attributes (full bright, phantom…) …

These can also be done with more specific functions. e.g.: llSetScale(), llSetColor(), llSetPos(), llSetRot()…

// touch to turn light on and off

integer onoff=FALSE;

default
{
    touch_start(integer total_number)
    {
        if (onoff==FALSE)
        { llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75] ); onoff=TRUE; }
        else
        { llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75] ); onoff=FALSE;}
    }
}

// that's: color, intensity, radius, falloff rate
// Simulate a beacon.
// using a timer to periodically toggle the prim's point light

integer onoff=FALSE;
default
{
  state_entry() { llSetTimerEvent(2); }

    timer()
    {
      if (onoff==FALSE)
        { llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1,0,0>, 1, 10, 1.] ); onoff=TRUE; }
      else
        { llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75] ); onoff=FALSE;}
    }
}

// that's: color, intensity, radius, falloff rate
Want to dash through walls?
Try Xah Tele-Dasher!

Linden Scripting Language

  1. LSL Tutorial
  2. Basic Concepts
  3. Syntax
  4. Code Structure
  5. Examples

advanced

  1. Prim Manipulation
  2. Particle System
  3. HUD

misc

  1. Emacs LSL Mode
  2. LSL References
  3. Misc Advanced LSL Tips
  4. LSL Unicode Support
  5. LSL Script Count
  6. Give Things Full Perm But No Script

LSL Problems

  1. LSL Problems
  2. llGetOwner()
  3. llEdgeOfWorld()
  4. llSitTarget as Teleporter