Difference between revisions of "User:Cerise Sorbet/Menu cross reference"

From Second Life Wiki
Jump to navigation Jump to search
m
m
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL Function
[[{{#rel2abs:../.|{{NAMESPACE}}:{{PAGENAME}}}}]]
|func_id=259|func_sleep=0.2|func_energy=10.0
----
<!-- |func=llSetPrimitiveParams|sort=SetPrimitiveParams
|p1_type=list|p1_name=rules -->
|func_desc=Sets the prims parameters according to '''rules'''.
|func_footer=This is a very powerful & sharp function, each rule takes at least one parameter and has its own quirks. Each PRIM_* rule has its own dedicated article with specific information.
|spec
|caveats=
*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 {{HoverText|PRIM_TYPE|Value: 9}} will be used causing errors at runtime.
**To fix this replace the PRIM_TYPE flag with the value 1 or updated to the newer PRIM_TYPE syntax.
* [[PRIM_ROTATION]] is bugged in child prims, see [[llSetPrimitiveParams#Useful_Snippets|Useful Snippets]] for a workaround, or the linked SVC-93 issue below.
* This function will return an error if fed data of the wrong type. This is problematic when feeding data into it from user input or notecard. To remedy this, see this List Cast function: [[list_cast]]
|constants={{LSL Constants/PrimitiveParams|set}}
|examples=<lsl>
// To color all sides of a prim black, except side 3 white
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0.0,0.0,0.0>, 1.0]);
llSetPrimitiveParams([PRIM_COLOR, 3, <1.0,1.0,1.0>, 1.0]);
 
// To render on side 3
// the picture with the UUID...
// and the repeats per face as vector,
// the texture offset as second vector,
// and the texture rotation as float
llSetPrimitiveParams([PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288",
                          <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0]);
 
// To set the prim "Full Bright" on sides 3
llSetPrimitiveParams([PRIM_FULLBRIGHT,3,TRUE]);
 
// And to make it all in one breath,
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0.0,0.0,0.0>, 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>, <0.0,0.0,0.0>, 0.0,
                      PRIM_FULLBRIGHT, 3, TRUE]);
 
//And If you want to place it above you bed, to make you sleep well, and the coords
// of that place are for example <x, y, z>
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0.0,0.0,0.0>, 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>, <0.0,0.0,0.0>,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>, <0.0,0.0,0.0>, 0.0,
        PRIM_TEXTURE, 4, "4d304955-2b01-c6c6-f545-c1ae1e618288",
            <1.0,1.0,0.0>, <0.0,0.0,0.0>, 0.0
    ]);
</lsl>
 
=== Top-size (taper) ===
<lsl>default
{
    state_entry()
    {
        vector XYZ = llGetScale();
        float X = XYZ.x;
        float Y = XYZ.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 use 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();
        }
    }
}
</lsl>
|helpers=
<lsl> //-- PRIM_ROTATION workaround for child prims (works in unattached objects only)
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot * llGetRootRotation()] )
 
//-- PRIM_ROTATION workaround for child prims (works in linked objects only)
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot * llList2Rot( llGetLinkPrimitiveParams( LINK_ROOT, [PRIM_ROT_LOCAL] ), 0 )] )
 
//-- PRIM_ROTATION workaround for child prims (works in all scenarios)
llSetPrimitiveParams( [PRIM_ROT_LOCAL, rot * llList2Rot( llGetLinkPrimitiveParams( !!llGetLinkNumber(), [PRIM_ROT_LOCAL] ), 0 )] )</lsl>
|also_functions={{LSL DefineRow||[[llGetPrimitiveParams]]|Get many primitive parameters}}
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|Set parameters on other prims in linkset}}
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|Get many primitive parameters of other prims in likset}}
{{LSL DefineRow||[[llSetLinkPrimitiveParamsFast]]|Set parameters on other prims in linkset without sleep}}
{{LSL DefineRow||[[llSetAlpha]]|Simpler way to set alpha (transparency)}}
{{LSL DefineRow||[[llSetTexture]]|Simpler way to set texture}}
{{LSL DefineRow||[[llSetColor]]|Simpler way to set color}}
{{LSL DefineRow||[[llSetScale]]|Simpler way to set scale}}
{{LSL DefineRow||[[llSetStatus]]|Simpler way to set physics and phantom}}
|also_tests
|also_events
|also_articles
|notes=The old PRIM_TYPE interface (labeled PRIM_TYPE_LEGACY) while technically retired can still be used.
|issues
|cat1=Prim
|cat2=Movement
|cat3=Status
|cat4=Texture
|cat5=Object
|cat6=PrimitiveParams
}}

Latest revision as of 23:07, 4 April 2011