Difference between revisions of "LlSetLinkPrimitiveParamsFast"

From Second Life Wiki
Jump to navigation Jump to search
m (intentional goof)
m
 
(23 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{LSL Function
#redirect[[llSetPrimitiveParams#llSetLinkPrimitiveParamsFast]]
|inject-2={{LSL Function/link|linknumber}}
{{:llSetPrimitiveParams|default=llSetLinkPrimitiveParamsFast}}
|func_id=353|func_sleep=0.0|func_energy=10.0
|func=llSetLinkPrimitiveParamsFast|sort=SetLinkPrimitiveParamsFast
|p1_type=integer|p1_name=linknumber
|p2_type=list|p2_name=rules
|func_desc=Set primitive parameters for '''{{LSL Param|linknumber}}''' based on '''{{LSL Param|rules}}''' with no built-in script sleep.  This function is identical to [[llSetLinkPrimitiveParams]] except without the delay.
|spec
|caveats=*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.
* [[PRIM_ROTATION]] is bugged in child prims, see [[llSetLinkPrimitiveParams#Useful_Snipptes|Useful Snippets]] for a workaround, or the linked SVC-93 issue below.
|constants={{LSL Constants/PrimitiveParams|get|remote=true}}
|examples =
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.
<lsl>
default
{
    touch_start(integer total_number)
    {
        // Turn off all prims
        llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);
        // Turn on the one that was touched
        llSetLinkPrimitiveParamsFast(llDetectedLinkNumber(0),[PRIM_FULLBRIGHT,ALL_SIDES,TRUE]);       
    }
}
</lsl>
A simple script which moves all child prims .25m higher than the root prim when touched.
<lsl>
default
{
    touch_start(integer total_number)
    {
        vector obj_pos = llGetPos();
        rotation obj_rot = llGetRot();
        integer i=1;
        while (i <= llGetNumberOfPrims())
        {
            vector prim_pos = llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_POSITION]),0);
            if (i > 1)  // If not the root prim
            {
                prim_pos = (prim_pos - obj_pos) / obj_rot;  // Convert from region coordinates to local coordinates
                prim_pos.z += 0.25;    // increase the Z position by .25m
                llSetLinkPrimitiveParamsFast(i,[PRIM_POSITION,prim_pos]);
            }
            ++i;
        }
    }
}
 
</lsl>
|helpers=
<lsl>//-- 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 )] )</lsl>
|also_functions=
{{LSL DefineRow||[[llSetLinkPrimitiveParams]]|Set many primitive parameters}}
{{LSL DefineRow||[[llGetLinkPrimitiveParams]]|Get many primitive parameters}}
{{LSL DefineRow||[[llSetPrimitiveParams]]|Set many primitive parameters}}
{{LSL DefineRow||[[llGetPrimitiveParams]]|Get many primitive parameters}}
{{LSL DefineRow||[[llSetLinkAlpha]]|}}
{{LSL DefineRow||[[llSetLinkColor]]|}}
{{LSL DefineRow||[[llSetLinkTexture]]|}}
{{LSL DefineRow||[[llSetLinkTextureAnim]]|}}
|also_tests
|also_events
|also_articles
|notes=
===[[PRIM_POSITION]]===
{{#var:PRIM_POSITION/SLPP&A}}
|cat1=Prim
|cat2=Movement
|cat3=Status
|cat4=Texture
|cat5=Object
|cat6=Teleport
|cat7=Link/Set
|cat8=PrimitiveParams
}}

Latest revision as of 16:37, 12 September 2013