Skip to content
lsl.devlsl.devLSL Dev

llSetLinkPrimitiveParamsFast

function

Replaces deprecated llSetLinkPrimitiveParams, llSetPrimitiveParams.

Function syntax
llSetLinkPrimitiveParamsFast(
  1. integer link,// Link number (1 for root, >1 for children) or a LINK_* flag. Values: Links
  2. list rules// A list of PRIM_* rules and data to apply.
);
Energy
10

This is a very powerful & sharp function. Each PRIM_* rule takes at least one parameter and has its own quirks and its own dedicated article with specific information.

Sets the prims parameters according to rules.

How to use
llSetLinkPrimitiveParamsFast(0, []);
From the LSL definitions: PrimParam (rule, then its arguments)
// Link targetingPRIM_LINK_TARGET, integer link_target  // the rules after it apply to this link// Position and orientationPRIM_POSITION, vector position  // region coordinatesPRIM_ROTATION, rotation rot  // global rotation, like llSetRot; broken for child primsPRIM_SIZE, vector size  // like llSetScale; fails silently on physical primsPRIM_POS_LOCAL, vector position  // relative to the root, like llSetPos in a childPRIM_ROT_LOCAL, rotation rot  // relative to the root, like llSetLocalRotPRIM_OMEGA, vector axis, float spinrate, float gain  // client-side spin, like llTargetOmega; spinrate in radians per second// AppearancePRIM_COLOR, integer face, vector color, float alpha  // Blinn-Phong colour and opacity; face may be ALL_SIDESPRIM_ALPHA_MODE, integer face, integer alpha_mode, integer alpha_cutoff  // PRIM_ALPHA_MODE_*; alpha_cutoff used only for _MASKPRIM_TEXTURE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians  // Blinn-Phong diffuse texturePRIM_FULLBRIGHT, integer face, integer boolean  // full-bright rendering on the facePRIM_GLOW, integer face, float intensity  // glow intensity on the facePRIM_POINT_LIGHT, integer boolean, vector linear_color, float intensity, float radius, float falloff  // local light; linear_color in linear space (llsRGB2Linear)PRIM_BUMP_SHINY, integer face, integer shiny, integer bump  // PRIM_SHINY_*, PRIM_BUMP_*PRIM_TEXGEN, integer face, integer mode  // PRIM_TEXGEN_* texture mapping modePRIM_RENDER_MATERIAL, integer face, string render_material  // clears most PRIM_GLTF_* overridesPRIM_GLTF_BASE_COLOR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector linear_color, float alpha, integer gltf_alpha_mode, float alpha_mask_cutoff, integer double_sided  // linear_color: linear spacePRIM_GLTF_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians  // glTF normal map overridePRIM_GLTF_METALLIC_ROUGHNESS, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, float metallic_factor, float roughness_factorPRIM_GLTF_EMISSIVE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector linear_emissive_tint  // linear spacePRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians  // Blinn-Phong normal mapPRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, integer glossiness, integer environment  // Blinn-PhongPRIM_PROJECTOR, string texture, float fov, float focus, float ambiance  // light projection; set onlyPRIM_REFLECTION_PROBE, integer boolean, float ambiance, float clip_distance, integer flags  // custom reflection probe; PRIM_REFLECTION_PROBE_* flags// Text and namingPRIM_TEXT, string text, vector color, float alpha  // floating text, like llSetTextPRIM_NAME, string name  // like llSetObjectNamePRIM_DESC, string description  // like llSetObjectDesc// ShapePRIM_TYPE, PRIM_TYPE_BOX, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear  // no effect on meshPRIM_TYPE, PRIM_TYPE_CYLINDER, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shearPRIM_TYPE, PRIM_TYPE_PRISM, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shearPRIM_TYPE, PRIM_TYPE_SPHERE, integer hole_shape, vector cut, float hollow, vector twist, vector dimplePRIM_TYPE, PRIM_TYPE_TORUS, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_TUBE, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_RING, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_SCULPT, string map, integer typePRIM_SLICE, vector slice  // shape slice, equivalent to cut / advanced_cut// Physics and behaviourPRIM_PHYSICS, integer boolean  // whole object responds to physicsPRIM_PHANTOM, integer boolean  // whole object phantomPRIM_TEMP_ON_REZ, integer boolean  // whole object temporary; cleaned up in about a minutePRIM_PHYSICS_SHAPE_TYPE, integer type  // PRIM_PHYSICS_SHAPE_NONE, _PRIM or _CONVEXPRIM_MATERIAL, integer material  // PRIM_MATERIAL_*: default collision sound, friction, restitutionPRIM_FLEXIBLE, integer boolean, integer softness, float gravity, float friction, float wind, float tension, vector force  // softness 0 to 3; gravity -10.0 to 10.0PRIM_COLLISION_SOUND, string sound, float volume  // collision sound UUID and volumePRIM_DAMAGE, float damage, integer damage_type  // damage delivered on collisionPRIM_HEALTH, float health  // objects default to 0 health// Clicking and sittingPRIM_CLICK_ACTION, integer action  // CLICK_ACTION_* default click/touch actionPRIM_SIT_TARGET, integer boolean, vector offset, rotation rot  // FALSE removes it; offset may be ZERO_VECTORPRIM_SIT_FLAGS, integer flags  // SIT_FLAG_*PRIM_SCRIPTED_SIT_ONLY, integer boolean  // only llSitOnLink can seat avatarsPRIM_ALLOW_UNSIT, integer boolean  // manual standing; experience seats (llSitOnLink) only
RuleDescription
PRIM_TYPE, integer flag, …Sets the prim’s shape. The PRIM_TYPE_* flag picks the shape and the arguments that follow it. hole_shape is one of PRIM_HOLE_*; a sculpt’s type is one of PRIM_SCULPT_TYPE_*, optionally combined with PRIM_SCULPT_FLAG_*. Has no effect on mesh. Forms:
  • PRIM_TYPE, PRIM_TYPE_BOX, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear
  • PRIM_TYPE, PRIM_TYPE_CYLINDER, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear
  • PRIM_TYPE, PRIM_TYPE_PRISM, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear
  • PRIM_TYPE, PRIM_TYPE_SPHERE, integer hole_shape, vector cut, float hollow, vector twist, vector dimple
  • PRIM_TYPE, PRIM_TYPE_TORUS, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew
  • PRIM_TYPE, PRIM_TYPE_TUBE, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew
  • PRIM_TYPE, PRIM_TYPE_RING, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skew
  • PRIM_TYPE, PRIM_TYPE_SCULPT, string map, integer type

This page transcludes LlSetPrimitiveParams. The following text is from that archived revision.

  • PRIM_SIZE has similar constraints to llSetScale and fails silently on physical prims/links. One workaround is to set items to non-physical before changing their size, then changing them back to physical; this can be accomplished in a single llSetLinkPrimitiveParamsFast command using PRIM_LINK_TARGET.
  • PRIM_PHANTOM, PRIM_PHYSICS and PRIM_TEMP_ON_REZ applies to the entire object (linkset).
  • Values may drift, become truncated or be range-limited. Some limits are applied by the client during deserialization and before rendering, others are applied by the simulator before storing the values.
  • When testing vectors and rotations use llVecDist and llAngleBetween (respectively) to perform fuzzy tests.
  • PRIM_LINK_TARGET is a special parameter which can be inserted to perform actions on multiple prims on the linkset with one call.
  • Scripts written before September 2004 that use PRIM_TYPE depend on PRIM_TYPE to have the value 1; if these scripts are recompiled, the new value of PRIM_TYPE will be used, causing errors at runtime.
  • To fix this, replace the PRIM_TYPE flag with the value 1 or update to the newer PRIM_TYPE syntax.
  • PRIM_ROTATION is bugged in child prims. See Useful Snippets for a workaround, or the linked SVC-93 issue below.
  • This function will return an error if given data of the wrong type. This is problematic when providing data from user input or notecard. To remedy this, see List Cast function.
  • Applying an operation to LINK_SET will apply it first to the root prim, then to each child prim.
  • The sim will clamp attributes before storing them.
  • The client will clamp attributes before rendering.
  • Some prim properties are reset by this function
  • A flexible prim will become not flexible
  • A sliced prim will become unsliced
  • : In order to preserve properties they must be saved and explicitly set in the function call
  • Attempting to change PRIM_TYPE of a mesh object has no effect.
  • Keeping the PRIM_TYPE as PRIM_TYPE_SCULPT and trying to set a different sculpt map or sculpt flags on a mesh also does nothing. Additionally, a script residing inside a mesh type prim cannot change the sculpt parameters of any prim in the linkset.
  • The caveats described at llSetClickAction all apply to PRIM_CLICK_ACTION.
A simple script to light up a prim in a linkset when touched, and unlight the others using llSetLinkPrimitiveParams, when script is installed in the root prim of the linkset.
// Turn all prims off and the one touched turn on
default
{
touch_start(integer num_detected)
{
llSetLinkPrimitiveParamsFast(LINK_SET, [
PRIM_FULLBRIGHT, ALL_SIDES, FALSE,
PRIM_LINK_TARGET, llDetectedLinkNumber(0),
PRIM_FULLBRIGHT, ALL_SIDES, TRUE]);
}
}
A simple script which moves all child prims .25m forward on the root’s Z axis, when touched.
27 collapsed lines
default
{
touch_start(integer total_number)
{
integer numberOfPrims = llGetNumberOfPrims();
if (numberOfPrims < 2) return;
vector link_pos;
list params;
integer link = 2;// start with first child prim
do
{
// get a child prim's local position (i.e, relative to the root prim)
link_pos = llList2Vector(llGetLinkPrimitiveParams(link, [PRIM_POS_LOCAL]), 0);
link_pos.z += 0.25;// relative to root's local z-axis !!!
params += [PRIM_LINK_TARGET, link,
PRIM_POS_LOCAL, link_pos];
}
while (++link <= numberOfPrims);
if (!llGetListLength(params)) return;
// the params list starts with a PRIM_LINK_TARGET (a hack so we can start
// with the first child prim), so it doesn't really matter which number you
// put as first parameter in this function call
llSetLinkPrimitiveParamsFast(2, params);
}
}
Example 3
Preferred method using PRIM_LINK_TARGETSecond method does the same effect-wise.
// color the root prim red and the first linked-prim green
default
{
touch_start(integer num_detected)
{
llSetLinkPrimitiveParamsFast(LINK_ROOT, [
PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, 1.0,
PRIM_LINK_TARGET, 2,
PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, 1.0]);
}
}
// color the root prim red and the first linked-prim green
default
{
touch_start(integer num_detected)
{
llSetLinkPrimitiveParamsFast(LINK_ROOT, [
PRIM_COLOR, ALL_SIDES, <1.0, 0.0, 0.0>, 1.0]);
llSetLinkPrimitiveParamsFast(2, [
PRIM_COLOR, ALL_SIDES, <0.0, 1.0, 0.0>, 1.0]);
}
}
Combining function calls
// Combined function calls
default
{
touch_start(integer num_detected)
{
// color prim faces, set texture and set fullbright
llSetPrimitiveParams([
PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.0,
PRIM_COLOR, 3, <1.0, 1.0, 1.0>, 1.0,
PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
PRIM_FULLBRIGHT, 3, TRUE]);
}
}
// Single function calls
default
{
touch_start(integer num_detected)
{
// color prim faces
llSetPrimitiveParams([
PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1,
PRIM_COLOR, 3, <1.0, 1.0, 1.0>, 1.0]);
// set texture
llSetPrimitiveParams([
PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]);
// set fullbright
llSetPrimitiveParams([
PRIM_FULLBRIGHT, 3, TRUE]);
}
}
// And if you want to place it above your bed, to make you sleep well, and the coords
// of that place are, for example, <x, y, z>
llSetPrimitiveParams([
PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.0,
PRIM_COLOR, 3, <1.0,1.0,1.0>, 1.0,
PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0,
PRIM_FULLBRIGHT, 3, TRUE,
PRIM_POSITION, <x, y, z>]);
// You can set the texture of several sides at once, with no time penalty,
// just by repeating the param for that:
llSetPrimitiveParams([
PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0,
PRIM_TEXTURE, 4, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]);
Example 4
default
{
state_entry()
{
vector scale = llGetScale();
float X = scale.x;
float Y = scale.y;
llSetPrimitiveParams([
PRIM_SIZE, <X, Y, 0.1>, // keep the prim thin
PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR,
<1.0 - (0.4 / X), 1.0 - (0.4 / Y), 0.0>, ZERO_VECTOR]);
// We used the equation "answer = 1 - desired_taper"
// The proportions of the top-size (taper) will be maintained (as close as possible)
// whenever the prim is resized. The proportion above will produce a reasonably
// pleasing picture frame kinda thing.
}
changed(integer change)
{
if(change & CHANGED_SCALE)
{
llResetScript();
}
}
}
//-- PRIM_ROTATION workaround for child prims (works in unattached objects only)
llSetLinkPrimitiveParamsFast(linknumber, [
PRIM_ROT_LOCAL, rot*llGetRootRotation()]);
//-- PRIM_ROTATION workaround for child prims (works in linked objects only)
llSetLinkPrimitiveParamsFast(linknumber, [
PRIM_ROT_LOCAL, rot*llList2Rot(llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_ROT_LOCAL]), 0)]);
//-- PRIM_ROTATION workaround for child prims (works in all scenarios)
llSetLinkPrimitiveParamsFast(linknumber, [
PRIM_ROT_LOCAL, rot*llList2Rot(llGetLinkPrimitiveParams(!!llGetLinkNumber(), [PRIM_ROT_LOCAL]), 0)]);

The old PRIM_TYPE interface (labeled PRIM_TYPE_LEGACY), while technically retired, can still be used.

{{#var:PRIM_POSITION/SLPP&A}}

From the issue templates included by the wiki article:

  • SVC-2105 (nf): '''llSetLinkListPrimitiveParams'''() for setting multiple, specific linked items
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.