Difference between revisions of "User:Cerise Sorbet/Menu cross reference"
m |
m |
||
Line 1: | Line 1: | ||
{{LSL Function | {{LSL Function | ||
|func_id=259|func_sleep=0.2|func_energy=10.0 | |func_id=259|func_sleep=0.2|func_energy=10.0 | ||
|func=llSetPrimitiveParams|sort=SetPrimitiveParams | |||
|p1_type=list|p1_name=rules | |p1_type=list|p1_name=rules | ||
|func_desc=Sets the prims parameters according to '''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. | |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. | ||
Line 11: | Line 11: | ||
* [[PRIM_ROTATION]] is bugged in child prims, see [[llSetPrimitiveParams#Useful_Snippets|Useful Snippets]] for a workaround, or the linked SVC-93 issue below. | * [[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]] | * 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}} | <!-- |constants={{LSL Constants/PrimitiveParams|set}} --> | ||
|examples=<lsl> | |examples=<lsl> | ||
// To color all sides of a prim black, except side 3 white | // To color all sides of a prim black, except side 3 white |
Revision as of 14:40, 16 December 2010
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: llSetPrimitiveParams( list rules );259 | Function ID |
0.2 | Forced Delay |
10.0 | Energy |
Sets the prims parameters according to rules.
• list | rules |
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.
Caveats
- This function causes the script to sleep for 0.2 seconds.
- 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 updated 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 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
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>Useful Snippets
<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>
Notes
The old PRIM_TYPE interface (labeled PRIM_TYPE_LEGACY) while technically retired can still be used.
See Also
Functions
• | llGetPrimitiveParams | – | Get many primitive parameters | |
• | llSetLinkPrimitiveParams | – | Set parameters on other prims in linkset | |
• | llGetLinkPrimitiveParams | – | Get many primitive parameters of other prims in likset | |
• | llSetLinkPrimitiveParamsFast | – | Set parameters on other prims in linkset without sleep | |
• | llSetAlpha | – | Simpler way to set alpha (transparency) | |
• | llSetTexture | – | Simpler way to set texture | |
• | llSetColor | – | Simpler way to set color | |
• | llSetScale | – | Simpler way to set scale | |
• | llSetStatus | – | Simpler way to set physics and phantom |