Don't click here unless you want to be banned.

LSL Wiki : llGetPrimitiveParams

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl411.us.archive.org
list llGetPrimitiveParams(list params)

Returns primitive parameters specified in the params list.

The resulting list can then be used for parameters of llSetPrimitiveParams (but not without modification since the list is missing the parameters - you have to build a new list based on the params list and your own knowledge of how many arguments each parameter has). A function at the bottom of the page encapsulates llGetPrimitiveParams so that the output can be directly used with llSetPrimitiveParams.

Notes:

Parameters

Query Description
Alternate Function Call
Return Value(s) Example Query
Example Result
PRIM_BUMP_SHINY, integer face bumpmap and shininess of a face integer shiny, integer bump (PRIM_SHINY_* and PRIM_BUMP_*) [PRIM_BUMP_SHINY, 2]
[2, 0]
PRIM_COLOR, integer face color and alpha of a face
llGetColor, llGetAlpha
vector color, float alpha [PRIM_COLOR, 1]
[<0.000000, 0.250980, 1.000000>, 1.000000]
PRIM_FLEXIBLE flexible properties of the prim integer TRUE/FALSE, integer softness, float gravity, float friction, float wind, float tension, vector force [PRIM_FLEXIBLE]
[1, 3, 0.300000, 2.000000, 0.000000, 1.000000, <0.000000, 0.000000, 0.000000>]
PRIM_FULLBRIGHT, integer face full bright attibute integer TRUE/FALSE [PRIM_FULLBRIGHT, 1]
[1]
PRIM_GLOW, integer face amount of glow on face float intensity [PRIM_GLOW, ALL_SIDES]
[0.03]
PRIM_MATERIAL material of the prim integer material (PRIM_MATERIAL_*) [PRIM_MATERIAL]
[3]
PRIM_PHANTOM phantom property of the object
llGetStatus
integer phantom (TRUE/FALSE) [PRIM_PHANTOM]
[0]
PRIM_PHYSICS physics property of the object
llGetStatus
integer physics (TRUE/FALSE) [PRIM_PHYSICS]
[0]
PRIM_POINT_LIGHT light properties of the object integer (TRUE/FALSE), vector color, float intensity, float radius, float falloff [PRIM_POINT_LIGHT]
[1, <1.000000, 1.000000, 1.000000>, 1.000000, 10.000000, 0.750000]
PRIM_POSITION position of the object
llGetPos
vector position [PRIM_POSITION]
[<166.558548, 113.733795, 22.803015>]
PRIM_ROTATION rotation of the object
llGetRot
rotation rot [PRIM_ROTATION]
[<0.000000, 0.000000, 0.000000, 1.000000>]
PRIM_SIZE scale of the object
llGetScale
vector size [PRIM_SIZE]
[<0.500000, 0.500000, 0.500000>]
PRIM_TEMP_ON_REZ temporary on rez property of the object integer temponrez (TRUE/FALSE) [PRIM_TEMP_ON_REZ]
[1]
PRIM_TYPE basic prim type integer primtype, ... these parameters vary with primtype, see PRIM_TYPE table at llSetPrimitiveParams [PRIM_TYPE]
[2, 0, <0.000000, 1.000000, 0.000000>, 0.000000, <0.000000, 0.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, <0.000000, 0.000000, 0.000000>]
PRIM_TEXGEN, integer face texture mapping mode integer texgen (PRIM_TEXGEN_DEFAULT, PRIM_TEXGEN_PLANAR) [PRIM_TEXGEN, 4]
[1]
PRIM_TEXTURE, integer face texture properties of a face
llGetTexture, llGetTextureScale, llGetTextureOffset, llGetTextureRot
( string name OR key uuid ), vector repeats, vector offsets, float rotation (in radians) [PRIM_TEXTURE, 2]
["Steel Plate", <1.000000, 1.000000, 0.000000>, <0.000000, 0.000000, 0.000000>, 0.000000]

Refer to llSetPrimitiveParams for information about PRIM_SHINY_*, PRIM_BUMP_* and PRIM_MATERIAL_*.

Example:
llGetPrimitiveParams([PRIM_PHANTOM, PRIM_TYPE, PRIM_COLOR, ALL_SIDES]);
Returns:
// note that it will not show the actual constants, but instead their values
[FALSE, // not phantom
// next the type of prim and the hole shape, as well as the parameters:
// vector cut, float hollow, vector twist, vector topsize, vector topshear
PRIM_TYPE_PRISM, PRIM_HOLE_DEFAULT, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>,
<0.000000, 0.250980, 1.000000>, 1.000000, // pairs of: vector color, float alpha
<0.000000, 0.250980, 1.000000>, 1.000000, // one for each side of the prim
<0.000000, 0.250980, 1.000000>, 1.000000, // because the query had ALL_SIDES as face
<0.000000, 0.250980, 1.000000>, 1.000000,
<0.000000, 0.250980, 1.000000>, 1.000000]

Example:
// get the prim type and everything that defines its form, except the scale
list params = llGetPrimitiveParams([PRIM_TYPE]);

// use this to restore the prim type and form (except scale)
llSetPrimitiveParams([PRIM_TYPE] + params);


Encapsulated (the ouput can be used as the input of llSetPrimitiveParams):
list GetPrimitiveParams(list input)
{
    list output;
    integer c = (output != input);//same as -llGetListLength(input);
    if(c)
    {
        list t = output;
        list special = [PRIM_BUMP_SHINY, PRIM_COLOR, PRIM_TEXTURE, PRIM_FULLBRIGHT, PRIM_TEXGEN];
        do
        {
            integer flag = llList2Integer(input, c); //peak the stack
            if(~llListFindList(special, [flag]))
            {
                if(++c)//adjust stack position, make sure it's valid.
                {
                    integer side = llList2Integer(input, c); //peak the stack
                    if(side == ALL_SIDES)
                    {
                        side = llGetNumberOfSides();
                        do
                            output += t + llGetPrimitiveParams(t = [flag, --side]);
                        while(side); //we return the sides in reverse order, easier to code; runs faster.
                    }
                    else
                        output += t + llGetPrimitiveParams(t = [flag, side]);
                    jump test;//by using a jump here we speed the code up a bit.
                }
                llOwnerSay("malformed input");
                jump end;
            }//else //not needed because of jumps.
            output += flag + llGetPrimitiveParams([flag]);
            @test;
        }while(++c);//adjust stack position, make sure it's valid.
    }
    @end;
    return output;
}//Writen by Strife Onizuka


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Prim | Parameter
Comments [Hide comments/form]
Wouldnt a more intuitive implementation return the constants along with the data for that constant?
That way, I could pass [PRIM_POSITION, PRIM_SIZE, PRIM_ROTATION] to llGetPrimitiveParams, and get [PRIM_POSITION, <x,y,z>, PRIM_SIZE, <x,y,z>, PRIM_ROTATION, <x, y, z>];?

This way, there would be no worry about the number of arguments each constant will return; one can just do an llListFindList(returnedParams, [PRIM_SIZE]) to get the index of the size constant, increment that, and get the index of the size data.

A more useful example would be something like llGetPrimitiveParams([PRIM_TYPE, PRIM_ROTATION]); In the current implementation, the script would have to know the number of values llGetPrimitiveParams would pass back to the script for PRIM_TYPE in order to get the return value of PRIM_ROTATION. What if LL ever wants to add more PRIM_TYPE data? It would kill all scripts that rely on their stored constant. Passing back the PRIM_* constants in the return list makes more sence, since then you'd be able to search the return list using llListFindList, and wouldn't have to worry about the number of values passed back for any given PRIM_* constant.

Im just wondering why they implemented it the way they did.
I hope Im making sence. :)
-- ChristopherOmega (2004-09-15 13:54:24)
I agree with you Chris; and the issue you speak of already exists llGetPrimitiveParams([PRIM_TEXTURE]); will return a list with of entries that type minus the PRIM_TEXTURE for each face of the prim one after another.
-- BlindWanderer (2004-09-24 11:36:21)
For this reason I found llGetPrimitiveParams ill-suited to returning multiple attributes, I only ever use it to request one at a time.
As for LL changing anything, I suspect that now they won't, because if they do they may break a number of scripts, if you want more data it'll have to be added as a new attribute to call for.
-- HaravikkMistral (2006-06-17 05:58:52)
This says that you can get any parameter of a prim on this page. However, I don't see anything for path cut, skew, shear, etc.
-- ip68-105-95-90.sd.sd.cox.net (2007-04-18 16:36:04)
Path cut, skew and shear are part of PRIM_TYPE
-- NexiiM (2007-04-20 06:32:30)
Attach a comment to this page: