llGetPrimitiveParams
list llGetPrimitiveParams(list params// A list of PRIM_* flags specifying the attributes to retrieve.
);- Returns
list- Delay
- 0.2 s
- Energy
- 10
These functions are very similar; the difference is the latter takes a link parameter, and does not cause the script to sleep.
PRIM_* flags can be broken into three categories, face flags, prim flags, and object flags.
- Supplying a prim or object flag will return that flag’s attributes.
- Face flags require the user to also supply a side parameter.
If you are planning to use PRIM_LINK_TARGET consider using llGetLinkPrimitiveParams instead.
list result = llGetPrimitiveParams([]);Specification
Section titled “Specification”// Link targetingPRIM_LINK_TARGET, integer link_target // the rules after it read 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 // set only: not returnedPRIM_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
Each rule is followed by its request arguments; the result list holds the values after the arrow, in rule order.
| Rule | Description |
|---|---|
PRIM_TYPE → integer flag, … | Gets 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:
|
Caveats
Section titled “Caveats”PRIM_LINK_TARGETis a special parameter which can be inserted to perform actions on multiple prims on the linkset with one call.- Passing 0 (zero) as the link number in the formal link parameter on a linked object will return an empty list.
- The legacy value of
PRIM_TYPE, 1 (which is often referred to as PRIM_TYPE_LEGACY), is not supported by this function as a flag1.
Examples
Section titled “Examples”To test whether an object is a point light source, and if so get its parameters:
default{ state_entry() { list params = llGetPrimitiveParams([PRIM_POINT_LIGHT]); integer isLight = llList2Integer(params, 0);
19 collapsed lines
string msg = "Object is ";
if (!isLight) // read as "not isLight" msg += "not a light source."; else { msg += "a point light source.";
// llList2String will automatically typecast
msg += "\n\tColour = " + llList2String(params, 1); msg += "\n\tIntensity = " + llList2String(params, 2); msg += "\n\tRadius = " + llList2String(params, 3); msg += "\n\tFalloff = " + llList2String(params, 4); }
llSay(0, msg); }}Example 2
//code snippets by Strife Onizuka, Xen Lisle and Kireji Haikuinteger AreAllPrimsAreGlowing(){ //The root prim is either link number is 0 or 1 //It is only zero if it is a single prim object with no avatars sitting on it. //llGetNumberOfPrims() returns the number of prims and seated avatars. integer link = llGetNumberOfPrims() > 1;
//We want to loop over all prims but not avatars, so we need to know how many prims there are. //Fortunately the avatars are added to the end of the link set, their link numbers always come after the last prim. //llGetObjectPrimCount(llGetKey()) only returns only the number of prims, it doesn't count avatars. //To determine the upper bound, we need to take into consideration the link number of the root prim. integer end = link + llGetObjectPrimCount(llGetKey());
for(;link < end; ++link)//loop through all prims { if( llListStatistics(LIST_STAT_MAX, llGetLinkPrimitiveParams(link, [PRIM_GLOW, ALL_SIDES])) <= 0.0) {//we can exit early because we know that if this value is less than or equal to zero, so will the minimum return FALSE; } } //we didn't find a single value that was less than or equal to zero, QED, they are all greater than zero. return TRUE;}
default{ touch_start(integer num_detected) { if(AreAllPrimsAreGlowing()) llSay(0, "All prims glowing."); else llSay(0, "Not all prims glowing."); }}Helper functions
Section titled “Helper functions”list GetPrimitiveParams(list input){//Returns a list that can be fed to llSetPrimitiveParams integer link = LINK_THIS; list output; integer c = ~llGetListLength(input); while(0x80000000 & (c = - ~c)) { integer f = llList2Integer(input, c); list flag = (list)f; if(~llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW], flag )) { integer side = llList2Integer(input, (c = - ~c)); if(~side)//pop the stack output += flag + side + llGetLinkPrimitiveParams(link, flag + side ); else for(side = llGetLinkNumberOfSides(link); side; ) //we return the sides in reverse order, easier to code; runs faster. output += flag + side + llGetLinkPrimitiveParams(link, flag + (side = ~ -side) ); } else if(PRIM_LINK_TARGET ^ f) output += flag + (link = llList2Integer(input, (c = - ~c))); else output += flag + llGetLinkPrimitiveParams(link, flag ); } return output;}//Contributed by Strife Onizukalist GetLinkPrimitiveParams(integer link, list input){//Returns a list that can be fed to llSetPrimitiveParams list output; integer c = ~llGetListLength(input); while(0x80000000 & (c = - ~c)) { integer f = llList2Integer(input, c); list flag = (list)f; if(~llListFindList([PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN, PRIM_GLOW], flag )) { integer side = llList2Integer(input, (c = - ~c)); if(~side)//pop the stack output += flag + side + llGetLinkPrimitiveParams(link, flag + side ); else for(side = llGetLinkNumberOfSides(link); side; ) //we return the sides in reverse order, easier to code; runs faster. output += flag + side + llGetLinkPrimitiveParams(link, flag + (side = ~ -side) ); } else if(PRIM_LINK_TARGET ^ f) output += flag + (link = llList2Integer(input, (c = - ~c))); else output += flag + llGetLinkPrimitiveParams(link, flag ); } return output;}//Contributed by Strife OnizukaSetPrimitiveParams-Example by Anylyn Hax makes reading primitive parameters easy.
SetPrimitiveParams-Example by Anylyn Hax makes reading primitive parameters easy.
History
Section titled “History”- Date of release
llGetLinkPrimitiveParams29-03-2010
Related functions
Section titled “Related functions”The original wiki page documents these functions together with this one:
See also
Section titled “See also”Functions
Section titled “Functions”llSetLinkPrimitiveParamsFast— Set parameters on other prims in linkset without sleepllGetObjectDetails
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.
Footnotes
Section titled “Footnotes”-
llGetPrimitiveParamscame after PRIM_TYPE_LEGACY was deprecated. ↩