Difference between revisions of "User:Anylyn Hax"
Anylyn Hax (talk | contribs) |
Anylyn Hax (talk | contribs) |
||
(63 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
{| style="color:pink;background-color:#ffeeee;" cellpadding="20" cellspacing="0" border="0" width="100%" | |||
!width="100" align="left"|[[Image:Anylyn_256_002.jpg|Anylyn Hax, 500 L$ / 30 min]] | |||
!valign="top" align="left"| | |||
___TOC___ | |||
|} | |||
{{Jira Reporter}} | |||
== echo, im, imme and debug == | |||
Sometimes when I am writing very long and complicated scripts I like to have debug output on the chat to follow the script if its running well.<BR> | |||
For this I usually use one or more variables called DEBUG. In this way there is no risk to forget some debug output in the code when I deliver the scripts to the customer.<BR> | |||
The function echo is theoretically useless, but it keeps me from making some typos like llownerSay or llOwnersay or llownersay etc.<BR> | |||
The functions im and imme are very similar to each other just that imme ims me. | |||
<lsl> | |||
key me="aed6887f-7f1d-485c-9906-515355b5c49a"; // Put your key here. | |||
integer DEBUG=TRUE; // Change this to FALSE for production | |||
integer STEP=0; | |||
init(){if(llGetInventoryCreator(llGetScriptName())!=me){integer DEBUG=FALSE; }return; } | |||
echo(string ECHO){string ON=llGetObjectName(); llSetObjectName(""); llOwnerSay("/me "+ECHO); llSetObjectName(ON); return; } | |||
im(key KEY,string ECHO){string ON=llGetObjectName(); llSetObjectName("#"); llInstantMessage(KEY,"/me "+ECHO); llSetObjectName(ON); return; } | |||
imme(string ECHO){im(llGetInventoryCreator(llGetScriptName()),ECHO); return; } | |||
debug(string ECHO){init(); string ON=llGetObjectName(); if(DEBUG){echo("[DEBUG ["+ON+"["+llGetScriptName()+"]] STEP "+(string)(STEP++)+"] "+ECHO); }return; } | |||
debugim(string ECHO){init(); if(DEBUG){imme("[DEBUG STEP "+(string)(STEP++)+"] "+ECHO); }return; } | |||
/* | |||
your functions here | |||
*/ | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
debug("Hello, Avatar!"); | |||
} | |||
touch_start(integer total_number) | |||
{ | |||
debug("Touched."); | |||
} | |||
} | |||
</lsl> | |||
== StartAnimation Example == | |||
For those avatars who need to use another walking animation, other then the one supplied by LL here is a small goodie. | |||
<lsl> | |||
// I like to use Antoinette Lioncourt's sexywalk | |||
// UUID:51e4d6c1-0bf0-f7b9-2cc7-8d7b46baf35b | |||
// place this script in one of your shoes together with the sexywalk | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION ); | |||
} | |||
run_time_permissions(integer perm) | |||
{ | |||
if(PERMISSION_TRIGGER_ANIMATION & perm) | |||
{ | |||
llSetTimerEvent(.1); | |||
} | |||
} | |||
timer() | |||
{ | |||
vector vel = llGetVel(); | |||
if( llFabs(vel.x) > 0.1)llStartAnimation("sexywalk"); | |||
if( llFabs(vel.x)<= 0.1)llStopAnimation("sexywalk"); | |||
} | |||
} | |||
</lsl> | |||
Anylyn Hax 21:43, 1 June 2007 (PDT) | |||
== Percent as a String == | |||
In some parts of the world the period is "," in other parts of the world it is "." and others even use "`" | |||
This Function displays the ISO percent format [X]X[period]XX%, very useful when developing things like ... ehmm... ;) | |||
<lsl> | |||
string StrPerCent(float foo, float bar){ | |||
string p; string fb = (string)(foo/bar); | |||
if(~llSubStringIndex(fb,".")){p=".";} | |||
else if(~llSubStringIndex(fb,",")){p=",";} | |||
else if(~llSubStringIndex(fb,"`")){p="`";} | |||
// [...] another unknown or future period notation | |||
else {p=" ";} | |||
list pl = llParseString2List((string)(foo*100/bar)+" ",[p],[]); | |||
return llList2String(pl,0)+p+llGetSubString(llList2String(pl,1),0,1); | |||
} | |||
</lsl> | |||
Anylyn Hax 07:23, 8 May 2011 (PDT) | |||
== llSetPrimitiveParams() Example1 (Human readable output) == | |||
<lsl> | |||
// This ugly hack gives out a piece of Human Readable Code, as demanded | |||
// by llSetPrimitiveParams. The result of this program comes via llOwnerSay | |||
// on the chat channel. Its a good idea to cut objectname and date out ;) | |||
// created by Anylyn Hax in the hot summer of 2007. | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
integer i = 0; | |||
integer ce_side = llGetNumberOfSides(); | |||
list booleans = ([ | |||
"FALSE", // 0 | |||
"TRUE" // 1 | |||
]); | |||
list texgens = ([ | |||
"PRIM_TEXGEN_DEFAULT", // 0 | |||
"PRIM_TEXGEN_PLANAR" // 1 | |||
]); | |||
list holeshape = ([ | |||
"PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_CIRCLE", // 16 circle | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_SQUARE", // 32 square | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_TRIANGLE" // 48 triangle | |||
]); | |||
list sculpttype = ([ | |||
"PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) | |||
"PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) | |||
]); | |||
list bumpmapping = ([ | |||
"PRIM_BUMP_NONE", // 0 none: no bump map | |||
"PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights | |||
"PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights | |||
"PRIM_BUMP_WOOD", // 3 woodgrain | |||
"PRIM_BUMP_BARK", // 4 bark | |||
"PRIM_BUMP_BRICKS", // 5 bricks | |||
"PRIM_BUMP_CHECKER", // 6 checker | |||
"PRIM_BUMP_CONCRETE", // 7 concrete | |||
"PRIM_BUMP_TILE", // 8 crustytile | |||
"PRIM_BUMP_STONE", // 9 cutstone: blocks | |||
"PRIM_BUMP_DISKS", // 10 discs: packed circles | |||
"PRIM_BUMP_GRAVEL", // 11 gravel | |||
"PRIM_BUMP_SIDING", // 13 siding | |||
"PRIM_BUMP_LARGETILE", // 14 stonetile | |||
"PRIM_BUMP_STUCCO", // 15 stucco | |||
"PRIM_BUMP_SUCTION", // 16 suction: rings | |||
"PRIM_BUMP_WEAVE" // 17 weave | |||
]); | |||
list shinys = ([ | |||
"PRIM_SHINY_NONE", // 0 none | |||
"PRIM_SHINY_LOW", // 1 low | |||
"PRIM_SHINY_MEDIUM", // 2 medium | |||
"PRIM_SHINY_HIGH" // 3 high | |||
]); | |||
list materials =([ | |||
"PRIM_MATERIAL_STONE", // 0 stone | |||
"PRIM_MATERIAL_METAL", // 1 metal | |||
"PRIM_MATERIAL_GLASS", // 2 glass | |||
"PRIM_MATERIAL_WOOD", // 3 wood | |||
"PRIM_MATERIAL_FLESH", // 4 flesh | |||
"PRIM_MATERIAL_PLASTIC", // 5 plastic | |||
"PRIM_MATERIAL_RUBBER", // 6 rubber | |||
"PRIM_MATERIAL_LIGHT" // 7 light | |||
]); | |||
llOwnerSay("llSetPrimitiveParams(["); | |||
list ce_prim_flexible = llGetPrimitiveParams([PRIM_FLEXIBLE]); // 21 | |||
llOwnerSay("PRIM_FLEXIBLE"+ | |||
", "+(string)llList2String(booleans ,llList2Integer(ce_prim_flexible,0))+ // true / false | |||
", "+(string)llList2Integer(ce_prim_flexible,1)+ // softness | |||
", "+(string)llList2Float(ce_prim_flexible,2)+ // gravity | |||
", "+(string)llList2Float(ce_prim_flexible,3)+ // friction | |||
", "+(string)llList2Float(ce_prim_flexible,4)+ // wind | |||
", "+(string)llList2Float(ce_prim_flexible,5)+ // tension | |||
", "+(string)llList2Vector(ce_prim_flexible,6)+", "); // force | |||
ce_prim_flexible =[]; | |||
list ce_prim_material = llGetPrimitiveParams([PRIM_MATERIAL]); // 2 | |||
llOwnerSay("PRIM_MATERIAL, "+(string)llList2String(materials ,llList2Integer(ce_prim_material,0))+", "); | |||
ce_prim_material = []; | |||
list ce_prim_phantom = llGetPrimitiveParams([PRIM_PHANTOM]); // 5 | |||
llOwnerSay("PRIM_PHANTOM, "+(string)llList2String(booleans ,llList2Integer(ce_prim_phantom ,0))+", "); | |||
ce_prim_phantom = []; | |||
list ce_prim_physiks = llGetPrimitiveParams([PRIM_PHYSICS]); // 3 | |||
llOwnerSay("PRIM_PHYSICS, "+(string)llList2String(booleans ,llList2Integer(ce_prim_physiks ,0))+", "); | |||
ce_prim_physiks = []; | |||
list ce_prim_point_light = llGetPrimitiveParams([PRIM_POINT_LIGHT]); // 23 | |||
llOwnerSay("PRIM_POINT_LIGHT"+ | |||
", "+(string)llList2String(booleans ,llList2Integer(ce_prim_point_light,0))+ // true / false | |||
", "+(string)llList2Vector(ce_prim_point_light,1)+ // color | |||
", "+(string)llList2Float(ce_prim_point_light,2)+ // intensity | |||
", "+(string)llList2Float(ce_prim_point_light,3)+ // radius | |||
", "+(string)llList2Float(ce_prim_point_light,4)+", "); // falloff | |||
ce_prim_point_light = []; | |||
list ce_prim_position = llGetPrimitiveParams([PRIM_POSITION]); // 6 | |||
llOwnerSay("PRIM_POSITION, "+(string)llList2Vector(ce_prim_position ,0)+", "); | |||
ce_prim_position = []; | |||
list ce_prim_rotation = llGetPrimitiveParams([PRIM_ROTATION]); // 8 | |||
llOwnerSay("PRIM_ROTATION, "+(string)llList2Rot(ce_prim_rotation ,0)+", "); | |||
ce_prim_rotation = []; | |||
list ce_prim_size = llGetPrimitiveParams([PRIM_SIZE]); // 7 | |||
llOwnerSay("PRIM_SIZE, "+(string)llList2Vector(ce_prim_size ,0)+", "); | |||
ce_prim_size = []; | |||
list ce_prim_temp_on_rez = llGetPrimitiveParams([PRIM_TEMP_ON_REZ]); // 4 | |||
llOwnerSay("PRIM_TEMP_ON_REZ, "+(string)llList2String(booleans ,llList2Integer(ce_prim_temp_on_rez ,0))+", "); | |||
ce_prim_temp_on_rez = []; | |||
list ce_prim_type = llGetPrimitiveParams([PRIM_TYPE]); // 9 | |||
if(llList2Integer(ce_prim_type,0)==0){llOwnerSay("PRIM_TYPE, PRIM_TYPE_BOX"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==1){llOwnerSay("PRIM_TYPE, PRIM_TYPE_CYLINDER"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==2){llOwnerSay("PRIM_TYPE, PRIM_TYPE_PRISM"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==3){llOwnerSay("PRIM_TYPE, PRIM_TYPE_SPHERE"+", "+(string)llList2Integer(ce_prim_type,1)+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==4){llOwnerSay("PRIM_TYPE, PRIM_TYPE_TORUS"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==5){llOwnerSay("PRIM_TYPE, PRIM_TYPE_TUBE"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==6){llOwnerSay("PRIM_TYPE, PRIM_TYPE_RING"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} | |||
if(llList2Integer(ce_prim_type,0)==7){llOwnerSay("PRIM_TYPE, PRIM_TYPE_SCULPT"+", "+(string)llList2String(ce_prim_type,1)+", "+(string)llList2Integer(ce_prim_type,2)+", ");} | |||
ce_prim_type = []; | |||
i = 0; | |||
list ce_prim_fullbright; | |||
while(i <= ce_side) { | |||
ce_prim_fullbright = llGetPrimitiveParams([PRIM_FULLBRIGHT,i]); // 20 | |||
if (ce_prim_fullbright != []) { | |||
llOwnerSay("PRIM_FULLBRIGHT, "+(string)i+", "+(string)llList2String(booleans ,llList2Integer(ce_prim_fullbright,0))+", "); | |||
ce_prim_fullbright = []; | |||
} | |||
i++; | |||
} | |||
i = 0; | |||
list ce_prim_bump_shiny; | |||
while(i <= ce_side) { | |||
ce_prim_bump_shiny = llGetPrimitiveParams([PRIM_BUMP_SHINY,i]); // 19 | |||
if (ce_prim_bump_shiny != []) { | |||
llOwnerSay("PRIM_BUMP_SHINY, "+(string)i+", "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny,0))+ // shiny | |||
", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny,1))+", ");// bumpmaping | |||
ce_prim_bump_shiny = []; | |||
} | |||
i++; | |||
} | |||
i = 0; | |||
list ce_prim_color; | |||
while(i <= ce_side) { | |||
ce_prim_color = llGetPrimitiveParams([PRIM_COLOR,i]); // 18 | |||
if (ce_prim_color != []) { | |||
llOwnerSay("PRIM_COLOR, "+(string)i+", "+(string)llList2Vector(ce_prim_color,0)+", "+(string)llList2Float(ce_prim_color,1)+", "); | |||
ce_prim_color = []; | |||
} | |||
i++; | |||
} | |||
i = 0; | |||
list ce_prim_texgen; | |||
while(i <= ce_side) { | |||
ce_prim_texgen = llGetPrimitiveParams([PRIM_TEXGEN ,i]); // 22 | |||
if (ce_prim_texgen != []) { | |||
llOwnerSay("PRIM_TEXGEN, "+(string)i+", "+llList2String(texgens,llList2Integer(ce_prim_texgen,0))+", "); // type | |||
ce_prim_texgen = []; | |||
} | |||
i++; | |||
} | |||
i = 0; | |||
string koma = ""; | |||
list ce_prim_texture; | |||
while(i <= ce_side) { | |||
ce_prim_texture = llGetPrimitiveParams([PRIM_TEXTURE,i]); // 17 | |||
if(i < ce_side -1) { koma = ", "; } // we dont put everywhere a komata | |||
if (ce_prim_texture != []) { | |||
llOwnerSay("PRIM_TEXTURE, "+(string)i+ | |||
", "+(string)llList2String(ce_prim_texture,0)+ // name | |||
", "+(string)llList2Vector(ce_prim_texture,1)+ // repeats | |||
", "+(string)llList2Vector(ce_prim_texture,2)+ // offsets | |||
", "+(string)llList2Float(ce_prim_texture,3) + koma); // rotation | |||
ce_prim_texture = []; | |||
koma = ""; | |||
} | |||
i++; | |||
} | |||
llOwnerSay("]);"); | |||
llOwnerSay("//This Script used " + (string)((16384 - llGetFreeMemory())/1024) + " kBytes"); | |||
} | |||
} | |||
</lsl> | |||
... and outputs something like this: | |||
<pre> | |||
[23:00] Object: llSetPrimitiveParams([ | |||
[23:00] Object: PRIM_FLEXIBLE, TRUE, 2.000000, 0.300000, 2.000000, 0.000000, 1.000000, <0.01000, 0.00000, 0.01000>, | |||
[23:00] Object: PRIM_MATERIAL, PRIM_MATERIAL_WOOD, | |||
[23:00] Object: PRIM_PHANTOM, TRUE, | |||
[23:00] Object: PRIM_PHYSICS, FALSE, | |||
[23:00] Object: PRIM_POINT_LIGHT, TRUE, <1.00000, 1.00000, 1.00000>, 1.000000, 10.000000, 0.750000, | |||
[23:00] Object: PRIM_POSITION, <57.18748, 200.57619, 21.45186>, | |||
[23:00] Object: PRIM_ROTATION, <0.00000, 0.00000, 0.00000, 1.00000>, | |||
[23:00] Object: PRIM_SIZE, <0.76611, 0.76611, 0.76611>, | |||
[23:00] Object: PRIM_TEMP_ON_REZ, FALSE, | |||
[23:00] Object: PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE, <0.00000, 1.00000, 0.00000>, 0.099900, <0.00000, 0.00000, 0.00000>, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, | |||
[23:00] Object: PRIM_FULLBRIGHT, 0, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 1, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 2, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 3, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 4, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 5, TRUE, | |||
[23:00] Object: PRIM_FULLBRIGHT, 6, TRUE, | |||
[23:00] Object: PRIM_BUMP_SHINY, 0, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 1, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 2, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 3, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 4, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 5, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_BUMP_SHINY, 6, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, | |||
[23:00] Object: PRIM_COLOR, 0, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 1, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 2, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 3, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 4, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 5, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_COLOR, 6, <1.00000, 1.00000, 1.00000>, 1.000000, | |||
[23:00] Object: PRIM_TEXGEN, 0, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 1, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 2, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 3, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 4, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 5, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXGEN, 6, PRIM_TEXGEN_PLANAR, | |||
[23:00] Object: PRIM_TEXTURE, 0, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 1, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 2, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 3, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 4, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 5, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, | |||
[23:00] Object: PRIM_TEXTURE, 6, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000 | |||
[23:00] Object: ]); | |||
</pre> | |||
Anylyn Hax 15:58, 8 August 2007 (PDT) | |||
== llSetPrimitiveParams() Example2 Human readable using ALL_SIDES == | |||
2.07.2010 was simply to hot to walk outside :) so I reworked this old script. Don't worry its mostly cosmetics.<BR /> | |||
- Due to mono we can now try some more tricks because we have 64k memory to use.<BR /> | |||
- The functions FormatFloat and FormatVector should simplify the output by using ALL_SIDES and another call with the differences on other sides.<BR /> | |||
- I used a function called strReplace by Haravikk Mistral for doing string replace.<BR /> | |||
- The code removes for running time the prim name in order to not have it in your chat output.<BR /> | |||
- If you want to not have the Timestamp in your output modify this in your Viewer.(Preferences/Text Chat/Chat Options/Show Timestamp in local Chat)<BR /> | |||
IN this way the output shorts itself dramatically.<BR /> | |||
Manny thanks to Krull Aeon for pointing the bugs in the last version, regarding the using of double quotes for keys.<BR /> | |||
Manny thanks also to Flavio Dayafter for the trick to remove the ":" llOwnerSay("/me ....... <BR /> | |||
<lsl> | |||
// This ugly hack gives out a piece of Human Readable Code, as demanded | |||
// by llSetPrimitiveParams. The result of this program comes via llOwnerSay | |||
// on the chat channel. Its a good idea to cut objectname and date out ;) | |||
// created by Anylyn Hax in the hot summer of 2007, and reworked in 2010. | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// strReplace by Haravikk Mistral | |||
string strReplace(string str, string search, string replace) { | |||
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); | |||
} | |||
string FormatFloat(float number, integer precision) | |||
{ | |||
float roundingValue = llPow(10, -precision)*0.5; | |||
float rounded; | |||
if (number < 0) rounded = number - roundingValue; | |||
else rounded = number + roundingValue; | |||
if (precision < 1) { precision = 1; } // float is float | |||
string result = llGetSubString((string)rounded, 0, llSubStringIndex((string)rounded, ".") + precision); | |||
result = strReplace(result, ".000", ".0"); | |||
result = strReplace(result, "00,", "0,"); | |||
return result; | |||
} | |||
string FormatVector(vector hector, integer precision) | |||
{ | |||
if(hector == ZERO_VECTOR) { return "ZERO_VECTOR";} else { | |||
if (precision < 1) { precision = 1; } // a vector contains floats | |||
float roundingValue = llPow(10, -precision)*0.5; | |||
float relx; float rely; float relz; float elx; float ely; float elz; | |||
elx = hector.x; ely = hector.y; elz = hector.z; | |||
if (elx < 0) {relx = elx - roundingValue;} else {relx = elx + roundingValue;} | |||
if (ely < 0) {rely = ely - roundingValue;} else {rely = ely + roundingValue;} | |||
if (elz < 0) {relz = elz - roundingValue;} else {relz = elz + roundingValue;} | |||
string result = "<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + precision)+","+ | |||
llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + precision)+","+ | |||
llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + precision)+">"; | |||
result = strReplace(result, ".000", ".0"); | |||
result = strReplace(result, "00,", "0,"); | |||
result = strReplace(result, "00>", "0>"); | |||
return result; | |||
} | |||
} | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
string ce_primname = llGetObjectName(); llSetObjectName(""); // thats for you to not cut so much from the chat | |||
integer i = 0; integer j =0; | |||
integer ce_side = llGetNumberOfSides(); | |||
list booleans = ([ | |||
"FALSE", // 0 | |||
"TRUE" // 1 | |||
]); | |||
list texgens = ([ | |||
"PRIM_TEXGEN_DEFAULT", // 0 | |||
"PRIM_TEXGEN_PLANAR" // 1 | |||
]); | |||
list holeshape = ([ | |||
"PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_CIRCLE", // 16 circle | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_SQUARE", // 32 square | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_TRIANGLE" // 48 triangle | |||
]); | |||
list sculpttype = ([ | |||
"PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) | |||
"PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) | |||
]); | |||
list bumpmapping = ([ | |||
"PRIM_BUMP_NONE", // 0 none: no bump map | |||
"PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights | |||
"PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights | |||
"PRIM_BUMP_WOOD", // 3 woodgrain | |||
"PRIM_BUMP_BARK", // 4 bark | |||
"PRIM_BUMP_BRICKS", // 5 bricks | |||
"PRIM_BUMP_CHECKER", // 6 checker | |||
"PRIM_BUMP_CONCRETE", // 7 concrete | |||
"PRIM_BUMP_TILE", // 8 crustytile | |||
"PRIM_BUMP_STONE", // 9 cutstone: blocks | |||
"PRIM_BUMP_DISKS", // 10 discs: packed circles | |||
"PRIM_BUMP_GRAVEL", // 11 gravel | |||
"PRIM_BUMP_SIDING", // 13 siding | |||
"PRIM_BUMP_LARGETILE", // 14 stonetile | |||
"PRIM_BUMP_STUCCO", // 15 stucco | |||
"PRIM_BUMP_SUCTION", // 16 suction: rings | |||
"PRIM_BUMP_WEAVE" // 17 weave | |||
]); | |||
list shinys = ([ | |||
"PRIM_SHINY_NONE", // 0 none | |||
"PRIM_SHINY_LOW", // 1 low | |||
"PRIM_SHINY_MEDIUM", // 2 medium | |||
"PRIM_SHINY_HIGH" // 3 high | |||
]); | |||
list materials =([ | |||
"PRIM_MATERIAL_STONE", // 0 stone | |||
"PRIM_MATERIAL_METAL", // 1 metal | |||
"PRIM_MATERIAL_GLASS", // 2 glass | |||
"PRIM_MATERIAL_WOOD", // 3 wood | |||
"PRIM_MATERIAL_FLESH", // 4 flesh | |||
"PRIM_MATERIAL_PLASTIC", // 5 plastic | |||
"PRIM_MATERIAL_RUBBER", // 6 rubber | |||
"PRIM_MATERIAL_LIGHT" // 7 light | |||
]); | |||
llOwnerSay("/me llSetPrimitiveParams(["); | |||
list ce_prim_flexible = llGetPrimitiveParams([PRIM_FLEXIBLE]); // 21 | |||
llOwnerSay("/me\t PRIM_FLEXIBLE"+ | |||
", "+llList2String(booleans ,llList2Integer(ce_prim_flexible,0))+ // true / false | |||
", "+(string)llList2Integer(ce_prim_flexible,1)+ // softness | |||
", "+FormatFloat(llList2Float(ce_prim_flexible,2),3)+ // gravity | |||
", "+FormatFloat(llList2Float(ce_prim_flexible,3),3)+ // friction | |||
", "+FormatFloat(llList2Float(ce_prim_flexible,4),3)+ // wind | |||
", "+FormatFloat(llList2Float(ce_prim_flexible,5),3)+ // tension | |||
", "+FormatVector(llList2Vector(ce_prim_flexible,6),3)); // force | |||
ce_prim_flexible =[]; | |||
list ce_prim_material = llGetPrimitiveParams([PRIM_MATERIAL]); // 2 | |||
llOwnerSay("/me\t, PRIM_MATERIAL, "+llList2String(materials ,llList2Integer(ce_prim_material,0))); | |||
ce_prim_material = []; | |||
list ce_prim_phantom = llGetPrimitiveParams([PRIM_PHANTOM]); // 5 | |||
llOwnerSay("/me\t, PRIM_PHANTOM, "+llList2String(booleans ,llList2Integer(ce_prim_phantom ,0))); | |||
ce_prim_phantom = []; | |||
list ce_prim_physiks = llGetPrimitiveParams([PRIM_PHYSICS]); // 3 | |||
llOwnerSay("/me\t, PRIM_PHYSICS, "+llList2String(booleans ,llList2Integer(ce_prim_physiks ,0))); | |||
ce_prim_physiks = []; | |||
list ce_prim_point_light = llGetPrimitiveParams([PRIM_POINT_LIGHT]); // 23 | |||
llOwnerSay("/me\t, PRIM_POINT_LIGHT"+ | |||
", "+llList2String(booleans ,llList2Integer(ce_prim_point_light,0))+ // true / false | |||
", "+FormatVector(llList2Vector(ce_prim_point_light,1),3)+ // color | |||
", "+FormatFloat(llList2Float(ce_prim_point_light,2),3)+ // intensity | |||
", "+FormatFloat(llList2Float(ce_prim_point_light,3),3)+ // radius | |||
", "+FormatFloat(llList2Float(ce_prim_point_light,4),3)); // falloff | |||
ce_prim_point_light = []; | |||
list ce_prim_position = llGetPrimitiveParams([PRIM_POSITION]); // 6 | |||
llOwnerSay("/me\t, PRIM_POSITION, "+FormatVector(llList2Vector(ce_prim_position ,0),3)); | |||
ce_prim_position = []; | |||
list ce_prim_rotation = llGetPrimitiveParams([PRIM_ROTATION]); // 8 | |||
llOwnerSay("/me\t, PRIM_ROTATION, "+(string)llList2Rot(ce_prim_rotation ,0)); | |||
ce_prim_rotation = []; | |||
list ce_prim_size = llGetPrimitiveParams([PRIM_SIZE]); // 7 | |||
llOwnerSay("/me\t, PRIM_SIZE, "+FormatVector(llList2Vector(ce_prim_size ,0),3)); | |||
ce_prim_size = []; | |||
list ce_prim_temp_on_rez = llGetPrimitiveParams([PRIM_TEMP_ON_REZ]); // 4 | |||
llOwnerSay("/me\t, PRIM_TEMP_ON_REZ, "+llList2String(booleans ,llList2Integer(ce_prim_temp_on_rez ,0))); | |||
ce_prim_temp_on_rez = []; | |||
list ce_prim_type = llGetPrimitiveParams([PRIM_TYPE]); // 9 | |||
if(llList2Integer(ce_prim_type,0)==0){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_BOX"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} | |||
if(llList2Integer(ce_prim_type,0)==1){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_CYLINDER"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} | |||
if(llList2Integer(ce_prim_type,0)==2){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_PRISM"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} | |||
if(llList2Integer(ce_prim_type,0)==3){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_SPHERE"+", "+(string)llList2Integer(ce_prim_type,1)+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3));} | |||
if(llList2Integer(ce_prim_type,0)==4){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_TORUS"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} | |||
if(llList2Integer(ce_prim_type,0)==5){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_TUBE"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} | |||
if(llList2Integer(ce_prim_type,0)==6){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_RING"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} | |||
if(llList2Integer(ce_prim_type,0)==7){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_SCULPT"+", \""+llList2String(ce_prim_type,1)+"\", "+(string)llList2Integer(ce_prim_type,2));} | |||
ce_prim_type = []; | |||
//fullbright | |||
list ce_prim_fullbright0 = llGetPrimitiveParams([PRIM_FULLBRIGHT,0]);list ce_prim_fullbright; // 20 | |||
llOwnerSay("/me\t, PRIM_FULLBRIGHT, ALL_SIDES, "+llList2String(booleans ,llList2Integer(ce_prim_fullbright0,0)) ); | |||
for(i = 0;i <= ce_side; i++) { | |||
ce_prim_fullbright = llGetPrimitiveParams([PRIM_FULLBRIGHT,i]); | |||
if (ce_prim_fullbright != [] && ce_prim_fullbright0 !=ce_prim_fullbright) { | |||
llOwnerSay("/me\t, PRIM_FULLBRIGHT, "+(string)i+", "+llList2String(booleans ,llList2Integer(ce_prim_fullbright,0)) ); | |||
} | |||
} ce_prim_fullbright0 = [];ce_prim_fullbright = []; | |||
//shiny & bumpmaping | |||
list ce_prim_bump_shiny0 = llGetPrimitiveParams([PRIM_BUMP_SHINY,0]);list ce_prim_bump_shiny; | |||
llOwnerSay("/me\t, PRIM_BUMP_SHINY, ALL_SIDES, "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny0,0))+ // shiny | |||
", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny0,1)) ); // bumpmaping | |||
for(i = 0;i <= ce_side; i++) { | |||
ce_prim_bump_shiny = llGetPrimitiveParams([PRIM_BUMP_SHINY,i]); // 19 | |||
if (ce_prim_bump_shiny != [] && ce_prim_bump_shiny0 != ce_prim_bump_shiny) { | |||
llOwnerSay("/me\t, PRIM_BUMP_SHINY, "+(string)i+", "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny,0))+ // shiny | |||
", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny,1)) ); // bumpmaping | |||
} | |||
} ce_prim_bump_shiny0 = []; ce_prim_bump_shiny = []; | |||
//color | |||
list ce_prim_color0 = llGetPrimitiveParams([PRIM_COLOR ,0]);list ce_prim_color; | |||
llOwnerSay("/me\t, PRIM_COLOR, ALL_SIDES, "+FormatVector(llList2Vector(ce_prim_color0,0),3)+", "+FormatFloat(llList2Float(ce_prim_color0,1),3)); | |||
for(i=0;i <= ce_side;i++) { | |||
ce_prim_color = llGetPrimitiveParams([PRIM_COLOR,i]); // 18 | |||
if (ce_prim_color != [] && ce_prim_color0 !=ce_prim_color) { | |||
llOwnerSay("/me\t, PRIM_COLOR, "+(string)i+", "+FormatVector(llList2Vector(ce_prim_color,0),3)+", "+FormatFloat(llList2Float(ce_prim_color,1),3) ); | |||
} | |||
}ce_prim_color = [];ce_prim_color0 = []; | |||
//texgen | |||
list ce_prim_texgen0 = llGetPrimitiveParams([PRIM_TEXGEN ,0]);list ce_prim_texgen; | |||
llOwnerSay("/me\t, PRIM_TEXGEN, ALL_SIDES, "+llList2String(texgens,llList2Integer(ce_prim_texgen0,0))); | |||
for(i = 0;i <= ce_side ;i++ ) { | |||
ce_prim_texgen = llGetPrimitiveParams([PRIM_TEXGEN ,i]); // 22 | |||
if (ce_prim_texgen != [] && ce_prim_texgen0!=ce_prim_texgen) { | |||
llOwnerSay("/me\t, PRIM_TEXGEN, "+(string)i+", "+llList2String(texgens,llList2Integer(ce_prim_texgen,0)) ); // type | |||
} | |||
}ce_prim_texgen = [];ce_prim_texgen0 = []; | |||
//texture | |||
list ce_prim_texture0 = llGetPrimitiveParams([PRIM_TEXTURE,0]);list ce_prim_texture; | |||
llOwnerSay("/me\t, PRIM_TEXTURE, ALL_SIDES"+ | |||
", \""+llList2String(ce_prim_texture0,0)+ // name | |||
"\", "+FormatVector(llList2Vector(ce_prim_texture0,1),3)+ // repeats | |||
", "+FormatVector(llList2Vector(ce_prim_texture0,2),3)+ // offsets | |||
", "+FormatFloat(llList2Float(ce_prim_texture0,3),3)); // rotation | |||
for(i = 0;i <= ce_side;i++) { | |||
ce_prim_texture = llGetPrimitiveParams([PRIM_TEXTURE,i]); // we dont put everywhere a komata | |||
if ( ce_prim_texture != [] && | |||
( | |||
llList2String(ce_prim_texture0,0) != llList2String(ce_prim_texture,0) || | |||
llList2Vector(ce_prim_texture0,1) != llList2Vector(ce_prim_texture,1) || | |||
llList2Vector(ce_prim_texture0,2) != llList2Vector(ce_prim_texture,2) || | |||
llList2Float(ce_prim_texture0,3) != llList2Float(ce_prim_texture,3) | |||
) | |||
) { | |||
llOwnerSay("/me\t, PRIM_TEXTURE, "+(string)i+ | |||
", \""+llList2String(ce_prim_texture,0)+ // name | |||
"\", "+FormatVector(llList2Vector(ce_prim_texture,1),3)+ // repeats | |||
", "+FormatVector(llList2Vector(ce_prim_texture,2),3)+ // offsets | |||
", "+FormatFloat(llList2Float(ce_prim_texture,3),3) ); // rotation | |||
} | |||
}ce_prim_texture0 = [];ce_prim_texture = []; | |||
llOwnerSay("/me ]);"); | |||
llOwnerSay("/me //This Script used " + (string)(((4*16384) - llGetFreeMemory())/1024) + " kBytes"); | |||
llSetObjectName(ce_primname); // what you take you must give back | |||
} | |||
} | |||
</lsl> | |||
would output something like this: | |||
<pre> | |||
[20:31] llSetPrimitiveParams([ | |||
[20:31] PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR | |||
[20:31] , PRIM_MATERIAL, PRIM_MATERIAL_WOOD | |||
[20:31] , PRIM_PHANTOM, FALSE | |||
[20:31] , PRIM_PHYSICS, FALSE | |||
[20:31] , PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 | |||
[20:31] , PRIM_POSITION, <192.339,170.855,87.438> | |||
[20:31] , PRIM_ROTATION, <-0.50509, 0.49964, 0.49491, 0.50031> | |||
[20:31] , PRIM_TEMP_ON_REZ, FALSE | |||
[20:31] , PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.20,0.705,0.0>, 0.950, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR | |||
[20:31] , PRIM_FULLBRIGHT, ALL_SIDES, FALSE | |||
[20:31] , PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE | |||
[20:31] , PRIM_COLOR, ALL_SIDES, <1.0,1.0,1.0>, 1.0 | |||
[20:31] , PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT | |||
[20:31] , PRIM_SIZE, <10.0,10.0,10.0> | |||
[20:31] , PRIM_TEXTURE, ALL_SIDES, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <0.50,2.0,0.0>, ZERO_VECTOR, 1.571 | |||
[20:31] , PRIM_TEXTURE, 1, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 | |||
[20:31] , PRIM_TEXTURE, 2, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 | |||
[20:31] , PRIM_TEXTURE, 3, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 | |||
[20:31] , PRIM_TEXTURE, 4, "6501bbbc-f754-bfff-dfbe-41f7492a077b", <1.0,2.10,0.0>, <0.0,0.450,0.0>, 1.571 | |||
[20:31] , PRIM_TEXTURE, 6, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <0.50,0.20,0.0>, <0.40,0.280,0.0>, 1.571 | |||
[20:31] ]); | |||
[20:31] //This Script used 40 kBytes | |||
</pre> | |||
If your client does not support to turn of the time you still have to cut cut out "[20:31] " from the beginning of each line in order to use the output in a code. | |||
Anylyn Hax 18:50, 4 July 2010 (UTC) | |||
== llSetPrimitiveParams() Example3 (updated since the function has changed) == | |||
<lsl> | |||
// This ugly hack gives out a piece of Human Readable Code, as demanded | |||
// by llSetPrimitiveParams. The result of this program comes via llOwnerSay | |||
// on the chat channel. Its a good idea to cut objectname and date out ;) | |||
// created by Anylyn Hax in the hot summer of 2007, and reworked in 2010. | |||
// | |||
// This program is free software: you can redistribute it and/or modify | |||
// it under the terms of the GNU General Public License as published by | |||
// the Free Software Foundation, either version 3 of the License, or | |||
// (at your option) any later version. | |||
// | |||
// This program is distributed in the hope that it will be useful, | |||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
// GNU General Public License for more details. | |||
// | |||
// You should have received a copy of the GNU General Public License | |||
// along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
// strReplace by Haravikk Mistral | |||
string strReplace(string str, string search, string replace) { | |||
return llDumpList2String(llParseStringKeepNulls((str="") + str, [search], []), replace); | |||
} | |||
//cheatings | |||
string K=", "; | |||
list L=[];list L0=[]; | |||
o(string S){llOwnerSay("/me "+S);return;} | |||
t(string S){llOwnerSay("/me\t "+S);return;} | |||
list gpp(list l){ return llGetPrimitiveParams(l);} | |||
integer l2i(list s,integer i){return llList2Integer(s,i);} | |||
vector l2v(list s,integer i){return llList2Vector(s,i);} | |||
rotation l2r(list s,integer i){return llList2Rot(s,i);} | |||
string l2s(list s,integer i){return llList2String(s,i);} | |||
float l2f(list s,integer i){return llList2Float(s,i);} | |||
string FI(integer n){if(!n){return "0";}else{return (string)n;}} | |||
string FS(string s){if(s==""){return "\"\"";}else{return s;}} | |||
string FF(float n, integer p) | |||
{ | |||
float rv=llPow(10, -p)*0.5; | |||
float r; | |||
if (n < 0) r=n - rv; | |||
else r=n + rv; | |||
if (p < 1) { p=1; } // float is float | |||
string result=llGetSubString((string)r, 0, llSubStringIndex((string)r, ".") + p); | |||
result=strReplace(result, ".000", ".0"); | |||
result=strReplace(result, "00,", "0,"); | |||
return result; | |||
} | |||
string FV(vector v, integer p) | |||
{ | |||
if(v==ZERO_VECTOR) { return "ZERO_VECTOR";} else { | |||
if (p < 1) { p=1; } // a vector contains floats | |||
float rv=llPow(10, -p)*0.5; | |||
float relx; float rely; float relz; float elx; float ely; float elz; | |||
elx=v.x; ely=v.y; elz=v.z; | |||
if (elx < 0) {relx=elx - rv;} else {relx=elx + rv;} | |||
if (ely < 0) {rely=ely - rv;} else {rely=ely + rv;} | |||
if (elz < 0) {relz=elz - rv;} else {relz=elz + rv;} | |||
string result="<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + p)+","+ | |||
llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + p)+","+ | |||
llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + p)+">"; | |||
result=strReplace(result, ".000", ".0"); | |||
result=strReplace(result, "00,", "0,"); | |||
result=strReplace(result, "00>", "0>"); | |||
return result; | |||
} | |||
} | |||
string FR(rotation r, integer p) | |||
{ | |||
if(r==ZERO_ROTATION) { return "ZERO_ROTATION";} else { | |||
if (p < 1) { p=1; } // a vector contains floats | |||
float rv=llPow(10, -p)*0.5; | |||
float relx; float rely; float relz; float rels; float elx; float ely; float elz; float els; | |||
elx=r.x; ely=r.y; elz=r.z; els=r.s; | |||
if (elx < 0) {relx=elx - rv;} else {relx=elx + rv;} | |||
if (ely < 0) {rely=ely - rv;} else {rely=ely + rv;} | |||
if (elz < 0) {relz=elz - rv;} else {relz=elz + rv;} | |||
if (els < 0) {rels=els - rv;} else {rels=els + rv;} | |||
string result="<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + p)+","+ | |||
llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + p)+","+ | |||
llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + p)+","+ | |||
llGetSubString((string)rels, 0, llSubStringIndex((string)rels, ".") + p)+">"; | |||
result=strReplace(result, ".000", ".0"); | |||
result=strReplace(result, "00,", "0,"); | |||
result=strReplace(result, "00>", "0>"); | |||
return result; | |||
} | |||
} | |||
default | |||
{ | |||
state_entry() | |||
{ | |||
string ce_primname=llGetObjectName(); llSetObjectName(""); // thats for you to not cut so much from the chat | |||
integer i=0; integer j=0; | |||
integer ce_side=llGetNumberOfSides(); | |||
list primtype=([ | |||
"PRIM_TYPE_BOX", // 0 | |||
"PRIM_TYPE_CYLINDER", // 1 | |||
"PRIM_TYPE_PRISM", // 2 | |||
"PRIM_TYPE_SPHERE", // 3 | |||
"PRIM_TYPE_TORUS", // 4 | |||
"PRIM_TYPE_TUBE", // 5 | |||
"PRIM_TYPE_RING", // 6 | |||
"PRIM_TYPE_SCULPT" // 7 | |||
]); | |||
list booleans=([ | |||
"FALSE", // 0 | |||
"TRUE" // 1 | |||
]); | |||
list texgens=([ | |||
"PRIM_TEXGEN_DEFAULT", // 0 | |||
"PRIM_TEXGEN_PLANAR" // 1 | |||
]); | |||
list holeshape=([ | |||
"PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_CIRCLE", // 16 circle | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_SQUARE", // 32 square | |||
"","","","","","","","","","","","","","","", | |||
"PRIM_HOLE_TRIANGLE" // 48 triangle | |||
]); | |||
list sculpttype=([ | |||
"PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) | |||
"PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) | |||
"PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) | |||
]); | |||
list bumpmapping=([ | |||
"PRIM_BUMP_NONE", // 0 none: no bump map | |||
"PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights | |||
"PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights | |||
"PRIM_BUMP_WOOD", // 3 woodgrain | |||
"PRIM_BUMP_BARK", // 4 bark | |||
"PRIM_BUMP_BRICKS", // 5 bricks | |||
"PRIM_BUMP_CHECKER", // 6 checker | |||
"PRIM_BUMP_CONCRETE", // 7 concrete | |||
"PRIM_BUMP_TILE", // 8 crustytile | |||
"PRIM_BUMP_STONE", // 9 cutstone: blocks | |||
"PRIM_BUMP_DISKS", // 10 discs: packed circles | |||
"PRIM_BUMP_GRAVEL", // 11 gravel | |||
"PRIM_BUMP_SIDING", // 13 siding | |||
"PRIM_BUMP_LARGETILE", // 14 stonetile | |||
"PRIM_BUMP_STUCCO", // 15 stucco | |||
"PRIM_BUMP_SUCTION", // 16 suction: rings | |||
"PRIM_BUMP_WEAVE" // 17 weave | |||
]); | |||
list shinys=([ | |||
"PRIM_SHINY_NONE", // 0 none | |||
"PRIM_SHINY_LOW", // 1 low | |||
"PRIM_SHINY_MEDIUM", // 2 medium | |||
"PRIM_SHINY_HIGH" // 3 high | |||
]); | |||
list materials=([ | |||
"PRIM_MATERIAL_STONE", // 0 stone | |||
"PRIM_MATERIAL_METAL", // 1 metal | |||
"PRIM_MATERIAL_GLASS", // 2 glass | |||
"PRIM_MATERIAL_WOOD", // 3 wood | |||
"PRIM_MATERIAL_FLESH", // 4 flesh | |||
"PRIM_MATERIAL_PLASTIC", // 5 plastic | |||
"PRIM_MATERIAL_RUBBER", // 6 rubber | |||
"PRIM_MATERIAL_LIGHT" // 7 light | |||
]); | |||
list physics_shape=([ | |||
"PRIM_PHYSICS_SHAPE_PRIM", // 0 | |||
"PRIM_PHYSICS_SHAPE_CONVEX",// 1 | |||
"PRIM_PHYSICS_SHAPE_NONE" // 2 | |||
]); | |||
o("llSetPrimitiveParams(["); | |||
// 2 | |||
L=gpp([PRIM_MATERIAL]);t(" PRIM_MATERIAL, "+l2s(materials ,l2i(L,0))); | |||
// 3 | |||
L=gpp([PRIM_PHYSICS]);t(", PRIM_PHYSICS, "+l2s(booleans ,l2i(L ,0))); | |||
// 4 | |||
L=gpp([PRIM_TEMP_ON_REZ]);t(", PRIM_TEMP_ON_REZ, "+l2s(booleans ,l2i(L ,0))); | |||
// 5 | |||
L=gpp([PRIM_PHANTOM]);t(", PRIM_PHANTOM, "+l2s(booleans ,l2i(L ,0))); | |||
// 6 | |||
L=gpp([PRIM_POSITION]);t(", PRIM_POSITION, "+FV(l2v(L ,0),3)); | |||
// 7 | |||
L=gpp([PRIM_SIZE]);t(", PRIM_SIZE, "+FV(l2v(L ,0),3)); | |||
// 8 | |||
L=gpp([PRIM_ROTATION]);t(", PRIM_ROTATION, "+FR(l2r(L ,0),3)); | |||
// 9 | |||
L=gpp([PRIM_TYPE]); | |||
if(l2i(L,0)==0){t(", PRIM_TYPE, PRIM_TYPE_BOX"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} | |||
if(l2i(L,0)==1){t(", PRIM_TYPE, PRIM_TYPE_CYLINDER"+K+l2s(holeshape ,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} | |||
if(l2i(L,0)==2){t(", PRIM_TYPE, PRIM_TYPE_PRISM"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} | |||
if(l2i(L,0)==3){t(", PRIM_TYPE, PRIM_TYPE_SPHERE"+K+FI(l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3));} | |||
if(l2i(L,0)==4){t(", PRIM_TYPE, PRIM_TYPE_TORUS"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} | |||
if(l2i(L,0)==5){t(", PRIM_TYPE, PRIM_TYPE_TUBE"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} | |||
if(l2i(L,0)==6){t(", PRIM_TYPE, PRIM_TYPE_RING"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} | |||
if(l2i(L,0)==7){t(", PRIM_TYPE, PRIM_TYPE_SCULPT"+", \""+l2s(L,1)+"\", "+FI(l2i(L,2)));} | |||
// 17 | |||
L0=gpp([PRIM_TEXTURE,0]);t(", PRIM_TEXTURE, ALL_SIDES"+", \""+l2s(L0,0)+"\", "+FV(l2v(L0,1),3)+K+FV(l2v(L0,2),3)+K+FF(l2f(L0,3),3)); | |||
for(i=0;i <=ce_side;i++){L=gpp([PRIM_TEXTURE,i]); | |||
if (L!=[] && (l2s(L0,0)!=l2s(L,0)||l2v(L0,1)!=l2v(L,1)||l2v(L0,2)!=l2v(L,2)||l2f(L0,3)!=l2f(L,3))) { | |||
t(", PRIM_TEXTURE, "+(string)i+", \""+l2s(L,0)+"\", "+FV(l2v(L,1),3)+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3) );}} | |||
// 18 | |||
L0=gpp([PRIM_COLOR ,0]);t(", PRIM_COLOR, ALL_SIDES, "+FV(l2v(L0,0),3)+K+FF(l2f(L0,1),3)); | |||
for(i=0;i<=ce_side;i++){L=gpp([PRIM_COLOR,i]);if(L!=[] && L0!=L){t(", PRIM_COLOR, "+FI(i)+K+FV(l2v(L,0),3)+K+FF(l2f(L,1),3));}} | |||
// 19 | |||
L0=gpp([PRIM_BUMP_SHINY,0]);t(", PRIM_BUMP_SHINY, ALL_SIDES, "+l2s(shinys,l2i(L0,0))+K+l2s(bumpmapping,l2i(L0,1)) ); | |||
for(i=0;i<=ce_side;i++){ | |||
L=gpp([PRIM_BUMP_SHINY,i]);if(L!=[] && L0!=L){t(", PRIM_BUMP_SHINY, "+FI(i)+K+l2s(shinys,l2i(L,0))+K+l2s(bumpmapping ,l2i(L,1)));}} | |||
// 20 | |||
L0=gpp([PRIM_FULLBRIGHT,0]);t(", PRIM_FULLBRIGHT, ALL_SIDES, "+l2s(booleans ,l2i(L0,0)) ); | |||
for(i=0;i<=ce_side;i++){L=gpp([PRIM_FULLBRIGHT,i]);if (L!=[] && L0!=L){t(", PRIM_FULLBRIGHT, "+FI(i)+K+l2s(booleans ,l2i(L,0)));}} | |||
// 21 | |||
L=gpp([PRIM_FLEXIBLE]); | |||
t(", PRIM_FLEXIBLE"+K+l2s(booleans ,l2i(L,0))+K+FI(l2i(L,1))+K+FF(l2f(L,2),3)+K+FF(l2f(L,3),3)+K+FF(l2f(L,4),3)+K+FF(l2f(L,5),3)+K+FV(l2v(L,6),3)); | |||
// 22 | |||
L0=gpp([PRIM_TEXGEN ,0]);t(", PRIM_TEXGEN, ALL_SIDES, "+l2s(texgens,l2i(L0,0))); | |||
for(i=0;i<=ce_side;i++){L=gpp([PRIM_TEXGEN ,i]);if (L!=[] && L0!=L){t(", PRIM_TEXGEN, "+FI(i)+K+l2s(texgens,l2i(L,0)));}} | |||
// 23 | |||
L=gpp([PRIM_POINT_LIGHT]);t(", PRIM_POINT_LIGHT"+K+l2s(booleans ,l2i(L,0))+K+FV(l2v(L,1),3)+K+FF(l2f(L,2),3)+K+FF(l2f(L,3),3)+K+FF(l2f(L,4),3)); | |||
// 25 | |||
L0=gpp([PRIM_GLOW ,0]);t(", PRIM_GLOW, ALL_SIDES, "+FF(l2f(L0,0),3)); | |||
for(i=0;i<=ce_side;i++){L=gpp([PRIM_GLOW ,i]);if (L!=[] && L0!=L) {t(", PRIM_GLOW, "+FI(i)+K+FF(l2f(L,0),3) );}} | |||
// 26 | |||
L=gpp([PRIM_TEXT]);t(", PRIM_TEXT, "+FS(l2s(L,0))+K+FV(l2v(L,1),3)+K+FF(l2f(L,2),3)); | |||
// 27 | |||
L=gpp([PRIM_NAME]); | |||
string prn=l2s(L,0);t(", PRIM_NAME, \""+prn+"\" ");prn=""; | |||
// 28 | |||
L=gpp([PRIM_DESC]); | |||
string prd=l2s(L,0);t(", PRIM_DESC, \""+prd+"\" ");prd=""; | |||
// 29 | |||
L=gpp([PRIM_ROT_LOCAL]);t(", PRIM_ROT_LOCAL, "+FR(l2r(L,0),3) ); | |||
// 30 | |||
L=gpp([PRIM_PHYSICS_SHAPE_TYPE]);t(", PRIM_PHYSICS_SHAPE_TYPE, "+l2s(physics_shape ,l2i(L,0))); | |||
//32 | |||
L=gpp([PRIM_OMEGA]);t(", PRIM_OMEGA, "+FV(l2v(L,0),3)+K+FF(l2f(L,1),3)+K+FF(l2f(L,2),3)); | |||
// 33 | |||
L=gpp([PRIM_POS_LOCAL]);t(", PRIM_POS_LOCAL, "+FV(l2v(L,0),3) ); | |||
/* 34 BUGGY, use only with Linksets | |||
L=gpp([PRIM_LINK_TARGET]); | |||
string plt=FI(0+l2i(L,0)); | |||
if(plt=="-4"){plt="LINK_THIS";} | |||
else if(plt=="-3"){plt="LINK_ALL_CHILDREN";} | |||
else if(plt=="-2"){plt="LINK_ALL_OTHERS";} | |||
else if(plt=="-1"){plt="LINK_SET";} | |||
else if(plt=="0"){plt="0 //unlinked";} | |||
else if(plt=="1"){plt="LINK_ROOT";} | |||
t(", PRIM_LINK_TARGET, "+plt);plt=""; | |||
*/ | |||
o(" ]);"); | |||
o(" //This Script used " + (string)(((4*16384) - llGetFreeMemory())/1024) + " kBytes"); | |||
llSetObjectName(ce_primname); // what you take you must give back | |||
} | |||
} | |||
</lsl> | |||
llSetPrimitiveParams([ | |||
PRIM_MATERIAL, PRIM_MATERIAL_WOOD | |||
, PRIM_PHYSICS, FALSE | |||
, PRIM_TEMP_ON_REZ, FALSE | |||
, PRIM_PHANTOM, FALSE | |||
, PRIM_POSITION, <106.967,232.168,70.913> | |||
, PRIM_SIZE, <0.50,0.50,0.50> | |||
, PRIM_ROTATION, ZERO_ROTATION | |||
, PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR | |||
, PRIM_TEXTURE, ALL_SIDES, "89556747-24cb-43ed-920b-47caed15465f", <1.0,1.0,0.0>, ZERO_VECTOR, 0.0 | |||
, PRIM_COLOR, ALL_SIDES, <1.0,1.0,1.0>, 1.0 | |||
, PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE | |||
, PRIM_FULLBRIGHT, ALL_SIDES, FALSE | |||
, PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR | |||
, PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT | |||
, PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 | |||
, PRIM_GLOW, ALL_SIDES, 0.0 | |||
, PRIM_TEXT, "", ZERO_VECTOR, 1.0 | |||
, PRIM_NAME, "" | |||
, PRIM_DESC, "" | |||
, PRIM_ROT_LOCAL, ZERO_ROTATION | |||
, PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM | |||
, PRIM_OMEGA, ZERO_VECTOR, 0.0, 0.0 | |||
, PRIM_POS_LOCAL, <106.967,232.168,70.913> | |||
]); | |||
//This Script used 53 kBytes | |||
== Spinning DanceBall with random colors == | |||
People keep asking me how to make a danceball, so I thought I might publish one here and show same time a exemple of how to use the upper Human Readable Output script.<BR /> | |||
- remember to cut out the PRIM_POSITION and possible the PRIM_ROTATION stanza.<BR /> | |||
- remember to make (or by) some dances and fill the danceball with up to 11 such animations.<BR /> | |||
If you like to try to do some animations like dances or other by yourself, I recommend the fantastic work of Vince Invincible and Zi Ree the <I>QAvimator</I>. It is a free alternative to Poser and Maya, and it runs on Windows, Mac OS X, and Linux. http://www.qavimator.org/ | |||
<lsl> | |||
list anis; | |||
integer CHANNEL; | |||
integer lisi; | |||
MakeTheBall() | |||
{ | |||
llSetTimerEvent(10); | |||
llSetPrimitiveParams([ | |||
PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR | |||
, PRIM_MATERIAL, PRIM_MATERIAL_WOOD | |||
, PRIM_PHANTOM, FALSE | |||
, PRIM_PHYSICS, FALSE | |||
, PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 | |||
, PRIM_SIZE, <1.5,1.5,1.5> | |||
, PRIM_TEMP_ON_REZ, FALSE | |||
, PRIM_TYPE, PRIM_TYPE_SPHERE, 0, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <0.0,1.0,0.0> | |||
, PRIM_FULLBRIGHT, ALL_SIDES, TRUE | |||
, PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_HIGH, PRIM_BUMP_NONE | |||
, PRIM_COLOR, ALL_SIDES, <0.705,0.449,0.807>, 1.0 | |||
, PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT | |||
, PRIM_TEXTURE, ALL_SIDES, "42d9ac0b-d423-94f0-9fd5-db3162b0d4ea", <4.0,12.0,0.0>, <0,0,0>, 0.5 | |||
]); | |||
llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 0, 1, 0.0, 1.0, 0.1); | |||
anis = ["STOP"]; | |||
integer a=0; | |||
while(a<llGetInventoryNumber(INVENTORY_ANIMATION) && a<9){anis+=llGetInventoryName(INVENTORY_ANIMATION,a++);}; | |||
return; | |||
} | |||
default | |||
{ | |||
state_entry(){MakeTheBall();} | |||
changed(integer change){if (change & CHANGED_INVENTORY){MakeTheBall();}} | |||
timer() | |||
{ | |||
float rot = llFrand(1.0); | |||
float gruen = llFrand(1.0); | |||
float blau = llFrand(1.0); | |||
//llSetColor(<rot,gruen,blau> , ALL_SIDES ); | |||
llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR, ALL_SIDES, <rot,gruen,blau>, 1.0]); | |||
llSetTimerEvent(llFrand(25.0)); | |||
} | |||
touch_start(integer total_number){llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);} | |||
run_time_permissions(integer perm) | |||
{ | |||
if (perm & PERMISSION_TRIGGER_ANIMATION) | |||
{ | |||
CHANNEL = llRound(llFrand(-99999999.9)); | |||
lisi = llListen(CHANNEL,"","",""); | |||
llDialog(llGetPermissionsKey(), "Choose the dance ",anis,CHANNEL); | |||
} | |||
} | |||
listen(integer chan, string name, key id, string mess) | |||
{ | |||
if ( chan==CHANNEL && id == llGetPermissionsKey() && mess != "STOP") | |||
{llStartAnimation(mess);llListenRemove(lisi);} | |||
if ( chan==CHANNEL && id == llGetPermissionsKey() && mess == "STOP") | |||
{ | |||
integer x = 0; while(x < llGetInventoryNumber(INVENTORY_ANIMATION)) | |||
{llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, x++));} | |||
llListenRemove(lisi); | |||
} | |||
} | |||
} | |||
</lsl> | |||
== Viewer 2 and privacy issues == | |||
We can see that the viewer 2 is very hardly pushed by the Lindens this days. | |||
But there are some privacy issues when you let everybody run java scripts on your system. | |||
As long as the integrated browser accepts all cookies and runs all java scripts, I is not just stupid but irresponsible to use the viewer2. | |||
Under this light can someone explain me why I should use the viewer ? | |||
{{Jira Reporter}}{{Skills}} | |||
---- | |||
This was a Anonymous comment of a Viewer 2 fan:<BR> | |||
COMMENT :<BR> | |||
"Why should you use Internet Explore or Firefox or Opera as INTERNET browser? They allow javascripts as the LL integrated browser. Do you judge a viewer bad because it just integrate an internet browser working like all the other INTERNET browsers in the world?. Just disable cookies and javascripts in the Preferences. There is no reason to NOT use the new great LL viewer. Anyway I wonder where this informations are useful here. Just for gossip? There is no Viewer 2 privacy issues. If you are worried about this, start to remove al your INTERNET browsers."<BR> | |||
ANSWER BY ANYLYN:<BR> | |||
Viewer 2 enables Web on a prim, you can't turn it off. What means that I can put a Website on a primface and you visit this website without knowing its a website. Just by simple visiting the website you submit your IP and with the IP a lot of Informations. If Java and Cookies are enabled its almost like showing your personal id to the Webmaster of the site.<BR> | |||
Sure does the Webmaster see all the IPs of the visitos also if the Website is in the profile tab. But the difference is that he can not know is who.<BR> | |||
With web on a prim he can, because he can send a llHTTPRequest() to the server submitting your key, and then he can determine your IP very exactly by comparing the timestamp with the webserver logs.<BR> | |||
If the Webmaster is the one who placed the site on the prim he could attack you with a Ping Flood for example and in best case disconnect you from second life. In the worst case he can burn your hardware down, by running your processor with 100%. if your cooling System is not that good you need a new processor. I think this is enough info, I don't want to give people ideas. Anyway if a lady is warning you by telling you there is a privacy issue together with viewer 2 and you don't know or understand , ask, don't talk nonsense in public. |
Latest revision as of 16:12, 26 February 2012
_ | _
---|
echo, im, imme and debug
Sometimes when I am writing very long and complicated scripts I like to have debug output on the chat to follow the script if its running well.
For this I usually use one or more variables called DEBUG. In this way there is no risk to forget some debug output in the code when I deliver the scripts to the customer.
The function echo is theoretically useless, but it keeps me from making some typos like llownerSay or llOwnersay or llownersay etc.
The functions im and imme are very similar to each other just that imme ims me.
<lsl> key me="aed6887f-7f1d-485c-9906-515355b5c49a"; // Put your key here. integer DEBUG=TRUE; // Change this to FALSE for production integer STEP=0; init(){if(llGetInventoryCreator(llGetScriptName())!=me){integer DEBUG=FALSE; }return; } echo(string ECHO){string ON=llGetObjectName(); llSetObjectName(""); llOwnerSay("/me "+ECHO); llSetObjectName(ON); return; } im(key KEY,string ECHO){string ON=llGetObjectName(); llSetObjectName("#"); llInstantMessage(KEY,"/me "+ECHO); llSetObjectName(ON); return; } imme(string ECHO){im(llGetInventoryCreator(llGetScriptName()),ECHO); return; } debug(string ECHO){init(); string ON=llGetObjectName(); if(DEBUG){echo("[DEBUG ["+ON+"["+llGetScriptName()+"]] STEP "+(string)(STEP++)+"] "+ECHO); }return; } debugim(string ECHO){init(); if(DEBUG){imme("[DEBUG STEP "+(string)(STEP++)+"] "+ECHO); }return; } /*
your functions here
- /
default {
state_entry() { debug("Hello, Avatar!"); } touch_start(integer total_number) { debug("Touched."); }
} </lsl>
StartAnimation Example
For those avatars who need to use another walking animation, other then the one supplied by LL here is a small goodie. <lsl> // I like to use Antoinette Lioncourt's sexywalk // UUID:51e4d6c1-0bf0-f7b9-2cc7-8d7b46baf35b // place this script in one of your shoes together with the sexywalk default {
state_entry() { llRequestPermissions(llGetOwner(),PERMISSION_TRIGGER_ANIMATION ); }
run_time_permissions(integer perm) { if(PERMISSION_TRIGGER_ANIMATION & perm) { llSetTimerEvent(.1); } } timer() { vector vel = llGetVel(); if( llFabs(vel.x) > 0.1)llStartAnimation("sexywalk"); if( llFabs(vel.x)<= 0.1)llStopAnimation("sexywalk"); }
} </lsl> Anylyn Hax 21:43, 1 June 2007 (PDT)
Percent as a String
In some parts of the world the period is "," in other parts of the world it is "." and others even use "`" This Function displays the ISO percent format [X]X[period]XX%, very useful when developing things like ... ehmm... ;) <lsl> string StrPerCent(float foo, float bar){
string p; string fb = (string)(foo/bar); if(~llSubStringIndex(fb,".")){p=".";} else if(~llSubStringIndex(fb,",")){p=",";} else if(~llSubStringIndex(fb,"`")){p="`";} // [...] another unknown or future period notation else {p=" ";} list pl = llParseString2List((string)(foo*100/bar)+" ",[p],[]); return llList2String(pl,0)+p+llGetSubString(llList2String(pl,1),0,1);
} </lsl> Anylyn Hax 07:23, 8 May 2011 (PDT)
llSetPrimitiveParams() Example1 (Human readable output)
<lsl> // This ugly hack gives out a piece of Human Readable Code, as demanded // by llSetPrimitiveParams. The result of this program comes via llOwnerSay // on the chat channel. Its a good idea to cut objectname and date out ;) // created by Anylyn Hax in the hot summer of 2007. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>.
default
{
state_entry() { integer i = 0; integer ce_side = llGetNumberOfSides();
list booleans = ([ "FALSE", // 0 "TRUE" // 1 ]);
list texgens = ([ "PRIM_TEXGEN_DEFAULT", // 0 "PRIM_TEXGEN_PLANAR" // 1 ]); list holeshape = ([ "PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) "","","","","","","","","","","","","","","", "PRIM_HOLE_CIRCLE", // 16 circle "","","","","","","","","","","","","","","", "PRIM_HOLE_SQUARE", // 32 square "","","","","","","","","","","","","","","", "PRIM_HOLE_TRIANGLE" // 48 triangle ]); list sculpttype = ([ "PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) "PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) "PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) "PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) ]); list bumpmapping = ([ "PRIM_BUMP_NONE", // 0 none: no bump map "PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights "PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights "PRIM_BUMP_WOOD", // 3 woodgrain "PRIM_BUMP_BARK", // 4 bark "PRIM_BUMP_BRICKS", // 5 bricks "PRIM_BUMP_CHECKER", // 6 checker "PRIM_BUMP_CONCRETE", // 7 concrete "PRIM_BUMP_TILE", // 8 crustytile "PRIM_BUMP_STONE", // 9 cutstone: blocks "PRIM_BUMP_DISKS", // 10 discs: packed circles "PRIM_BUMP_GRAVEL", // 11 gravel "PRIM_BUMP_SIDING", // 13 siding "PRIM_BUMP_LARGETILE", // 14 stonetile "PRIM_BUMP_STUCCO", // 15 stucco "PRIM_BUMP_SUCTION", // 16 suction: rings "PRIM_BUMP_WEAVE" // 17 weave ]); list shinys = ([ "PRIM_SHINY_NONE", // 0 none "PRIM_SHINY_LOW", // 1 low "PRIM_SHINY_MEDIUM", // 2 medium "PRIM_SHINY_HIGH" // 3 high ]); list materials =([ "PRIM_MATERIAL_STONE", // 0 stone "PRIM_MATERIAL_METAL", // 1 metal "PRIM_MATERIAL_GLASS", // 2 glass "PRIM_MATERIAL_WOOD", // 3 wood "PRIM_MATERIAL_FLESH", // 4 flesh "PRIM_MATERIAL_PLASTIC", // 5 plastic "PRIM_MATERIAL_RUBBER", // 6 rubber "PRIM_MATERIAL_LIGHT" // 7 light ]);
llOwnerSay("llSetPrimitiveParams([");
list ce_prim_flexible = llGetPrimitiveParams([PRIM_FLEXIBLE]); // 21 llOwnerSay("PRIM_FLEXIBLE"+ ", "+(string)llList2String(booleans ,llList2Integer(ce_prim_flexible,0))+ // true / false ", "+(string)llList2Integer(ce_prim_flexible,1)+ // softness ", "+(string)llList2Float(ce_prim_flexible,2)+ // gravity ", "+(string)llList2Float(ce_prim_flexible,3)+ // friction ", "+(string)llList2Float(ce_prim_flexible,4)+ // wind ", "+(string)llList2Float(ce_prim_flexible,5)+ // tension ", "+(string)llList2Vector(ce_prim_flexible,6)+", "); // force ce_prim_flexible =[];
list ce_prim_material = llGetPrimitiveParams([PRIM_MATERIAL]); // 2 llOwnerSay("PRIM_MATERIAL, "+(string)llList2String(materials ,llList2Integer(ce_prim_material,0))+", "); ce_prim_material = []; list ce_prim_phantom = llGetPrimitiveParams([PRIM_PHANTOM]); // 5 llOwnerSay("PRIM_PHANTOM, "+(string)llList2String(booleans ,llList2Integer(ce_prim_phantom ,0))+", "); ce_prim_phantom = []; list ce_prim_physiks = llGetPrimitiveParams([PRIM_PHYSICS]); // 3 llOwnerSay("PRIM_PHYSICS, "+(string)llList2String(booleans ,llList2Integer(ce_prim_physiks ,0))+", "); ce_prim_physiks = []; list ce_prim_point_light = llGetPrimitiveParams([PRIM_POINT_LIGHT]); // 23 llOwnerSay("PRIM_POINT_LIGHT"+ ", "+(string)llList2String(booleans ,llList2Integer(ce_prim_point_light,0))+ // true / false ", "+(string)llList2Vector(ce_prim_point_light,1)+ // color ", "+(string)llList2Float(ce_prim_point_light,2)+ // intensity ", "+(string)llList2Float(ce_prim_point_light,3)+ // radius ", "+(string)llList2Float(ce_prim_point_light,4)+", "); // falloff ce_prim_point_light = []; list ce_prim_position = llGetPrimitiveParams([PRIM_POSITION]); // 6 llOwnerSay("PRIM_POSITION, "+(string)llList2Vector(ce_prim_position ,0)+", "); ce_prim_position = []; list ce_prim_rotation = llGetPrimitiveParams([PRIM_ROTATION]); // 8 llOwnerSay("PRIM_ROTATION, "+(string)llList2Rot(ce_prim_rotation ,0)+", "); ce_prim_rotation = []; list ce_prim_size = llGetPrimitiveParams([PRIM_SIZE]); // 7 llOwnerSay("PRIM_SIZE, "+(string)llList2Vector(ce_prim_size ,0)+", "); ce_prim_size = []; list ce_prim_temp_on_rez = llGetPrimitiveParams([PRIM_TEMP_ON_REZ]); // 4 llOwnerSay("PRIM_TEMP_ON_REZ, "+(string)llList2String(booleans ,llList2Integer(ce_prim_temp_on_rez ,0))+", "); ce_prim_temp_on_rez = []; list ce_prim_type = llGetPrimitiveParams([PRIM_TYPE]); // 9 if(llList2Integer(ce_prim_type,0)==0){llOwnerSay("PRIM_TYPE, PRIM_TYPE_BOX"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} if(llList2Integer(ce_prim_type,0)==1){llOwnerSay("PRIM_TYPE, PRIM_TYPE_CYLINDER"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} if(llList2Integer(ce_prim_type,0)==2){llOwnerSay("PRIM_TYPE, PRIM_TYPE_PRISM"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", ");} if(llList2Integer(ce_prim_type,0)==3){llOwnerSay("PRIM_TYPE, PRIM_TYPE_SPHERE"+", "+(string)llList2Integer(ce_prim_type,1)+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", ");} if(llList2Integer(ce_prim_type,0)==4){llOwnerSay("PRIM_TYPE, PRIM_TYPE_TORUS"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} if(llList2Integer(ce_prim_type,0)==5){llOwnerSay("PRIM_TYPE, PRIM_TYPE_TUBE"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} if(llList2Integer(ce_prim_type,0)==6){llOwnerSay("PRIM_TYPE, PRIM_TYPE_RING"+", "+(string)llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+(string)llList2Vector(ce_prim_type,2)+", "+(string)llList2Float(ce_prim_type,3)+", "+(string)llList2Vector(ce_prim_type,4)+", "+(string)llList2Vector(ce_prim_type,5)+", "+(string)llList2Vector(ce_prim_type,6)+", "+(string)llList2Vector(ce_prim_type,7)+", "+(string)llList2Vector(ce_prim_type,8)+", "+(string)llList2Float(ce_prim_type,9)+", "+(string)llList2Float(ce_prim_type,10)+", "+(string)llList2Float(ce_prim_type,11)+", ");} if(llList2Integer(ce_prim_type,0)==7){llOwnerSay("PRIM_TYPE, PRIM_TYPE_SCULPT"+", "+(string)llList2String(ce_prim_type,1)+", "+(string)llList2Integer(ce_prim_type,2)+", ");} ce_prim_type = [];
i = 0; list ce_prim_fullbright; while(i <= ce_side) { ce_prim_fullbright = llGetPrimitiveParams([PRIM_FULLBRIGHT,i]); // 20 if (ce_prim_fullbright != []) { llOwnerSay("PRIM_FULLBRIGHT, "+(string)i+", "+(string)llList2String(booleans ,llList2Integer(ce_prim_fullbright,0))+", "); ce_prim_fullbright = []; } i++; }
i = 0; list ce_prim_bump_shiny; while(i <= ce_side) { ce_prim_bump_shiny = llGetPrimitiveParams([PRIM_BUMP_SHINY,i]); // 19 if (ce_prim_bump_shiny != []) { llOwnerSay("PRIM_BUMP_SHINY, "+(string)i+", "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny,0))+ // shiny ", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny,1))+", ");// bumpmaping ce_prim_bump_shiny = []; } i++; }
i = 0; list ce_prim_color; while(i <= ce_side) { ce_prim_color = llGetPrimitiveParams([PRIM_COLOR,i]); // 18 if (ce_prim_color != []) { llOwnerSay("PRIM_COLOR, "+(string)i+", "+(string)llList2Vector(ce_prim_color,0)+", "+(string)llList2Float(ce_prim_color,1)+", "); ce_prim_color = []; } i++; }
i = 0; list ce_prim_texgen; while(i <= ce_side) { ce_prim_texgen = llGetPrimitiveParams([PRIM_TEXGEN ,i]); // 22 if (ce_prim_texgen != []) { llOwnerSay("PRIM_TEXGEN, "+(string)i+", "+llList2String(texgens,llList2Integer(ce_prim_texgen,0))+", "); // type ce_prim_texgen = []; } i++; }
i = 0; string koma = ""; list ce_prim_texture; while(i <= ce_side) { ce_prim_texture = llGetPrimitiveParams([PRIM_TEXTURE,i]); // 17 if(i < ce_side -1) { koma = ", "; } // we dont put everywhere a komata if (ce_prim_texture != []) { llOwnerSay("PRIM_TEXTURE, "+(string)i+ ", "+(string)llList2String(ce_prim_texture,0)+ // name ", "+(string)llList2Vector(ce_prim_texture,1)+ // repeats ", "+(string)llList2Vector(ce_prim_texture,2)+ // offsets ", "+(string)llList2Float(ce_prim_texture,3) + koma); // rotation ce_prim_texture = []; koma = ""; } i++; }
llOwnerSay("]);"); llOwnerSay("//This Script used " + (string)((16384 - llGetFreeMemory())/1024) + " kBytes"); }
} </lsl>
... and outputs something like this:
[23:00] Object: llSetPrimitiveParams([ [23:00] Object: PRIM_FLEXIBLE, TRUE, 2.000000, 0.300000, 2.000000, 0.000000, 1.000000, <0.01000, 0.00000, 0.01000>, [23:00] Object: PRIM_MATERIAL, PRIM_MATERIAL_WOOD, [23:00] Object: PRIM_PHANTOM, TRUE, [23:00] Object: PRIM_PHYSICS, FALSE, [23:00] Object: PRIM_POINT_LIGHT, TRUE, <1.00000, 1.00000, 1.00000>, 1.000000, 10.000000, 0.750000, [23:00] Object: PRIM_POSITION, <57.18748, 200.57619, 21.45186>, [23:00] Object: PRIM_ROTATION, <0.00000, 0.00000, 0.00000, 1.00000>, [23:00] Object: PRIM_SIZE, <0.76611, 0.76611, 0.76611>, [23:00] Object: PRIM_TEMP_ON_REZ, FALSE, [23:00] Object: PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_CIRCLE, <0.00000, 1.00000, 0.00000>, 0.099900, <0.00000, 0.00000, 0.00000>, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, [23:00] Object: PRIM_FULLBRIGHT, 0, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 1, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 2, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 3, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 4, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 5, TRUE, [23:00] Object: PRIM_FULLBRIGHT, 6, TRUE, [23:00] Object: PRIM_BUMP_SHINY, 0, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 1, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 2, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 3, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 4, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 5, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_BUMP_SHINY, 6, PRIM_SHINY_MEDIUM, PRIM_BUMP_CHECKER, [23:00] Object: PRIM_COLOR, 0, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 1, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 2, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 3, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 4, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 5, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_COLOR, 6, <1.00000, 1.00000, 1.00000>, 1.000000, [23:00] Object: PRIM_TEXGEN, 0, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 1, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 2, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 3, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 4, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 5, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXGEN, 6, PRIM_TEXGEN_PLANAR, [23:00] Object: PRIM_TEXTURE, 0, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 1, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 2, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 3, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 4, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 5, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000, [23:00] Object: PRIM_TEXTURE, 6, 89556747-24cb-43ed-920b-47caed15465f, <1.00000, 1.00000, 0.00000>, <0.00000, 0.00000, 0.00000>, 0.000000 [23:00] Object: ]);
Anylyn Hax 15:58, 8 August 2007 (PDT)
llSetPrimitiveParams() Example2 Human readable using ALL_SIDES
2.07.2010 was simply to hot to walk outside :) so I reworked this old script. Don't worry its mostly cosmetics.
- Due to mono we can now try some more tricks because we have 64k memory to use.
- The functions FormatFloat and FormatVector should simplify the output by using ALL_SIDES and another call with the differences on other sides.
- I used a function called strReplace by Haravikk Mistral for doing string replace.
- The code removes for running time the prim name in order to not have it in your chat output.
- If you want to not have the Timestamp in your output modify this in your Viewer.(Preferences/Text Chat/Chat Options/Show Timestamp in local Chat)
IN this way the output shorts itself dramatically.
Manny thanks to Krull Aeon for pointing the bugs in the last version, regarding the using of double quotes for keys.
Manny thanks also to Flavio Dayafter for the trick to remove the ":" llOwnerSay("/me .......
<lsl> // This ugly hack gives out a piece of Human Readable Code, as demanded // by llSetPrimitiveParams. The result of this program comes via llOwnerSay // on the chat channel. Its a good idea to cut objectname and date out ;) // created by Anylyn Hax in the hot summer of 2007, and reworked in 2010. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>.
// strReplace by Haravikk Mistral string strReplace(string str, string search, string replace) {
return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace);
}
string FormatFloat(float number, integer precision) {
float roundingValue = llPow(10, -precision)*0.5; float rounded; if (number < 0) rounded = number - roundingValue; else rounded = number + roundingValue; if (precision < 1) { precision = 1; } // float is float string result = llGetSubString((string)rounded, 0, llSubStringIndex((string)rounded, ".") + precision); result = strReplace(result, ".000", ".0"); result = strReplace(result, "00,", "0,"); return result;
}
string FormatVector(vector hector, integer precision) {
if(hector == ZERO_VECTOR) { return "ZERO_VECTOR";} else { if (precision < 1) { precision = 1; } // a vector contains floats float roundingValue = llPow(10, -precision)*0.5; float relx; float rely; float relz; float elx; float ely; float elz; elx = hector.x; ely = hector.y; elz = hector.z; if (elx < 0) {relx = elx - roundingValue;} else {relx = elx + roundingValue;} if (ely < 0) {rely = ely - roundingValue;} else {rely = ely + roundingValue;} if (elz < 0) {relz = elz - roundingValue;} else {relz = elz + roundingValue;} string result = "<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + precision)+","+ llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + precision)+","+ llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + precision)+">"; result = strReplace(result, ".000", ".0"); result = strReplace(result, "00,", "0,"); result = strReplace(result, "00>", "0>"); return result; }
}
default {
state_entry() { string ce_primname = llGetObjectName(); llSetObjectName(""); // thats for you to not cut so much from the chat integer i = 0; integer j =0; integer ce_side = llGetNumberOfSides(); list booleans = ([ "FALSE", // 0 "TRUE" // 1 ]); list texgens = ([ "PRIM_TEXGEN_DEFAULT", // 0 "PRIM_TEXGEN_PLANAR" // 1 ]); list holeshape = ([ "PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) "","","","","","","","","","","","","","","", "PRIM_HOLE_CIRCLE", // 16 circle "","","","","","","","","","","","","","","", "PRIM_HOLE_SQUARE", // 32 square "","","","","","","","","","","","","","","", "PRIM_HOLE_TRIANGLE" // 48 triangle ]); list sculpttype = ([ "PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) "PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) "PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) "PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) ]); list bumpmapping = ([ "PRIM_BUMP_NONE", // 0 none: no bump map "PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights "PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights "PRIM_BUMP_WOOD", // 3 woodgrain "PRIM_BUMP_BARK", // 4 bark "PRIM_BUMP_BRICKS", // 5 bricks "PRIM_BUMP_CHECKER", // 6 checker "PRIM_BUMP_CONCRETE", // 7 concrete "PRIM_BUMP_TILE", // 8 crustytile "PRIM_BUMP_STONE", // 9 cutstone: blocks "PRIM_BUMP_DISKS", // 10 discs: packed circles "PRIM_BUMP_GRAVEL", // 11 gravel "PRIM_BUMP_SIDING", // 13 siding "PRIM_BUMP_LARGETILE", // 14 stonetile "PRIM_BUMP_STUCCO", // 15 stucco "PRIM_BUMP_SUCTION", // 16 suction: rings "PRIM_BUMP_WEAVE" // 17 weave ]); list shinys = ([ "PRIM_SHINY_NONE", // 0 none "PRIM_SHINY_LOW", // 1 low "PRIM_SHINY_MEDIUM", // 2 medium "PRIM_SHINY_HIGH" // 3 high ]); list materials =([ "PRIM_MATERIAL_STONE", // 0 stone "PRIM_MATERIAL_METAL", // 1 metal "PRIM_MATERIAL_GLASS", // 2 glass "PRIM_MATERIAL_WOOD", // 3 wood "PRIM_MATERIAL_FLESH", // 4 flesh "PRIM_MATERIAL_PLASTIC", // 5 plastic "PRIM_MATERIAL_RUBBER", // 6 rubber "PRIM_MATERIAL_LIGHT" // 7 light ]); llOwnerSay("/me llSetPrimitiveParams(["); list ce_prim_flexible = llGetPrimitiveParams([PRIM_FLEXIBLE]); // 21 llOwnerSay("/me\t PRIM_FLEXIBLE"+ ", "+llList2String(booleans ,llList2Integer(ce_prim_flexible,0))+ // true / false ", "+(string)llList2Integer(ce_prim_flexible,1)+ // softness ", "+FormatFloat(llList2Float(ce_prim_flexible,2),3)+ // gravity ", "+FormatFloat(llList2Float(ce_prim_flexible,3),3)+ // friction ", "+FormatFloat(llList2Float(ce_prim_flexible,4),3)+ // wind ", "+FormatFloat(llList2Float(ce_prim_flexible,5),3)+ // tension ", "+FormatVector(llList2Vector(ce_prim_flexible,6),3)); // force ce_prim_flexible =[]; list ce_prim_material = llGetPrimitiveParams([PRIM_MATERIAL]); // 2 llOwnerSay("/me\t, PRIM_MATERIAL, "+llList2String(materials ,llList2Integer(ce_prim_material,0))); ce_prim_material = []; list ce_prim_phantom = llGetPrimitiveParams([PRIM_PHANTOM]); // 5 llOwnerSay("/me\t, PRIM_PHANTOM, "+llList2String(booleans ,llList2Integer(ce_prim_phantom ,0))); ce_prim_phantom = []; list ce_prim_physiks = llGetPrimitiveParams([PRIM_PHYSICS]); // 3 llOwnerSay("/me\t, PRIM_PHYSICS, "+llList2String(booleans ,llList2Integer(ce_prim_physiks ,0))); ce_prim_physiks = []; list ce_prim_point_light = llGetPrimitiveParams([PRIM_POINT_LIGHT]); // 23 llOwnerSay("/me\t, PRIM_POINT_LIGHT"+ ", "+llList2String(booleans ,llList2Integer(ce_prim_point_light,0))+ // true / false ", "+FormatVector(llList2Vector(ce_prim_point_light,1),3)+ // color ", "+FormatFloat(llList2Float(ce_prim_point_light,2),3)+ // intensity ", "+FormatFloat(llList2Float(ce_prim_point_light,3),3)+ // radius ", "+FormatFloat(llList2Float(ce_prim_point_light,4),3)); // falloff ce_prim_point_light = []; list ce_prim_position = llGetPrimitiveParams([PRIM_POSITION]); // 6 llOwnerSay("/me\t, PRIM_POSITION, "+FormatVector(llList2Vector(ce_prim_position ,0),3)); ce_prim_position = []; list ce_prim_rotation = llGetPrimitiveParams([PRIM_ROTATION]); // 8 llOwnerSay("/me\t, PRIM_ROTATION, "+(string)llList2Rot(ce_prim_rotation ,0)); ce_prim_rotation = []; list ce_prim_size = llGetPrimitiveParams([PRIM_SIZE]); // 7 llOwnerSay("/me\t, PRIM_SIZE, "+FormatVector(llList2Vector(ce_prim_size ,0),3)); ce_prim_size = []; list ce_prim_temp_on_rez = llGetPrimitiveParams([PRIM_TEMP_ON_REZ]); // 4 llOwnerSay("/me\t, PRIM_TEMP_ON_REZ, "+llList2String(booleans ,llList2Integer(ce_prim_temp_on_rez ,0))); ce_prim_temp_on_rez = []; list ce_prim_type = llGetPrimitiveParams([PRIM_TYPE]); // 9 if(llList2Integer(ce_prim_type,0)==0){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_BOX"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} if(llList2Integer(ce_prim_type,0)==1){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_CYLINDER"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} if(llList2Integer(ce_prim_type,0)==2){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_PRISM"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3));} if(llList2Integer(ce_prim_type,0)==3){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_SPHERE"+", "+(string)llList2Integer(ce_prim_type,1)+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3));} if(llList2Integer(ce_prim_type,0)==4){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_TORUS"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} if(llList2Integer(ce_prim_type,0)==5){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_TUBE"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} if(llList2Integer(ce_prim_type,0)==6){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_RING"+", "+llList2String(holeshape ,llList2Integer(ce_prim_type,1))+", "+FormatVector(llList2Vector(ce_prim_type,2),3)+", "+FormatFloat(llList2Float(ce_prim_type,3),3)+", "+FormatVector(llList2Vector(ce_prim_type,4),3)+", "+FormatVector(llList2Vector(ce_prim_type,5),3)+", "+FormatVector(llList2Vector(ce_prim_type,6),3)+", "+FormatVector(llList2Vector(ce_prim_type,7),3)+", "+FormatVector(llList2Vector(ce_prim_type,8),3)+", "+FormatFloat(llList2Float(ce_prim_type,9),3)+", "+FormatFloat(llList2Float(ce_prim_type,10),3)+", "+FormatFloat(llList2Float(ce_prim_type,11),3));} if(llList2Integer(ce_prim_type,0)==7){llOwnerSay("/me\t, PRIM_TYPE, PRIM_TYPE_SCULPT"+", \""+llList2String(ce_prim_type,1)+"\", "+(string)llList2Integer(ce_prim_type,2));} ce_prim_type = []; //fullbright list ce_prim_fullbright0 = llGetPrimitiveParams([PRIM_FULLBRIGHT,0]);list ce_prim_fullbright; // 20 llOwnerSay("/me\t, PRIM_FULLBRIGHT, ALL_SIDES, "+llList2String(booleans ,llList2Integer(ce_prim_fullbright0,0)) ); for(i = 0;i <= ce_side; i++) { ce_prim_fullbright = llGetPrimitiveParams([PRIM_FULLBRIGHT,i]); if (ce_prim_fullbright != [] && ce_prim_fullbright0 !=ce_prim_fullbright) { llOwnerSay("/me\t, PRIM_FULLBRIGHT, "+(string)i+", "+llList2String(booleans ,llList2Integer(ce_prim_fullbright,0)) ); } } ce_prim_fullbright0 = [];ce_prim_fullbright = []; //shiny & bumpmaping list ce_prim_bump_shiny0 = llGetPrimitiveParams([PRIM_BUMP_SHINY,0]);list ce_prim_bump_shiny; llOwnerSay("/me\t, PRIM_BUMP_SHINY, ALL_SIDES, "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny0,0))+ // shiny ", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny0,1)) ); // bumpmaping for(i = 0;i <= ce_side; i++) { ce_prim_bump_shiny = llGetPrimitiveParams([PRIM_BUMP_SHINY,i]); // 19 if (ce_prim_bump_shiny != [] && ce_prim_bump_shiny0 != ce_prim_bump_shiny) { llOwnerSay("/me\t, PRIM_BUMP_SHINY, "+(string)i+", "+llList2String(shinys,llList2Integer(ce_prim_bump_shiny,0))+ // shiny ", "+llList2String(bumpmapping ,llList2Integer(ce_prim_bump_shiny,1)) ); // bumpmaping } } ce_prim_bump_shiny0 = []; ce_prim_bump_shiny = []; //color list ce_prim_color0 = llGetPrimitiveParams([PRIM_COLOR ,0]);list ce_prim_color; llOwnerSay("/me\t, PRIM_COLOR, ALL_SIDES, "+FormatVector(llList2Vector(ce_prim_color0,0),3)+", "+FormatFloat(llList2Float(ce_prim_color0,1),3)); for(i=0;i <= ce_side;i++) { ce_prim_color = llGetPrimitiveParams([PRIM_COLOR,i]); // 18 if (ce_prim_color != [] && ce_prim_color0 !=ce_prim_color) { llOwnerSay("/me\t, PRIM_COLOR, "+(string)i+", "+FormatVector(llList2Vector(ce_prim_color,0),3)+", "+FormatFloat(llList2Float(ce_prim_color,1),3) ); } }ce_prim_color = [];ce_prim_color0 = []; //texgen list ce_prim_texgen0 = llGetPrimitiveParams([PRIM_TEXGEN ,0]);list ce_prim_texgen; llOwnerSay("/me\t, PRIM_TEXGEN, ALL_SIDES, "+llList2String(texgens,llList2Integer(ce_prim_texgen0,0))); for(i = 0;i <= ce_side ;i++ ) { ce_prim_texgen = llGetPrimitiveParams([PRIM_TEXGEN ,i]); // 22 if (ce_prim_texgen != [] && ce_prim_texgen0!=ce_prim_texgen) { llOwnerSay("/me\t, PRIM_TEXGEN, "+(string)i+", "+llList2String(texgens,llList2Integer(ce_prim_texgen,0)) ); // type } }ce_prim_texgen = [];ce_prim_texgen0 = []; //texture list ce_prim_texture0 = llGetPrimitiveParams([PRIM_TEXTURE,0]);list ce_prim_texture; llOwnerSay("/me\t, PRIM_TEXTURE, ALL_SIDES"+ ", \""+llList2String(ce_prim_texture0,0)+ // name "\", "+FormatVector(llList2Vector(ce_prim_texture0,1),3)+ // repeats ", "+FormatVector(llList2Vector(ce_prim_texture0,2),3)+ // offsets ", "+FormatFloat(llList2Float(ce_prim_texture0,3),3)); // rotation for(i = 0;i <= ce_side;i++) { ce_prim_texture = llGetPrimitiveParams([PRIM_TEXTURE,i]); // we dont put everywhere a komata if ( ce_prim_texture != [] && ( llList2String(ce_prim_texture0,0) != llList2String(ce_prim_texture,0) || llList2Vector(ce_prim_texture0,1) != llList2Vector(ce_prim_texture,1) || llList2Vector(ce_prim_texture0,2) != llList2Vector(ce_prim_texture,2) || llList2Float(ce_prim_texture0,3) != llList2Float(ce_prim_texture,3) ) ) { llOwnerSay("/me\t, PRIM_TEXTURE, "+(string)i+ ", \""+llList2String(ce_prim_texture,0)+ // name "\", "+FormatVector(llList2Vector(ce_prim_texture,1),3)+ // repeats ", "+FormatVector(llList2Vector(ce_prim_texture,2),3)+ // offsets ", "+FormatFloat(llList2Float(ce_prim_texture,3),3) ); // rotation } }ce_prim_texture0 = [];ce_prim_texture = []; llOwnerSay("/me ]);"); llOwnerSay("/me //This Script used " + (string)(((4*16384) - llGetFreeMemory())/1024) + " kBytes"); llSetObjectName(ce_primname); // what you take you must give back }
} </lsl>
would output something like this:
[20:31] llSetPrimitiveParams([ [20:31] PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR [20:31] , PRIM_MATERIAL, PRIM_MATERIAL_WOOD [20:31] , PRIM_PHANTOM, FALSE [20:31] , PRIM_PHYSICS, FALSE [20:31] , PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 [20:31] , PRIM_POSITION, <192.339,170.855,87.438> [20:31] , PRIM_ROTATION, <-0.50509, 0.49964, 0.49491, 0.50031> [20:31] , PRIM_TEMP_ON_REZ, FALSE [20:31] , PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.20,0.705,0.0>, 0.950, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR [20:31] , PRIM_FULLBRIGHT, ALL_SIDES, FALSE [20:31] , PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE [20:31] , PRIM_COLOR, ALL_SIDES, <1.0,1.0,1.0>, 1.0 [20:31] , PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT [20:31] , PRIM_SIZE, <10.0,10.0,10.0> [20:31] , PRIM_TEXTURE, ALL_SIDES, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <0.50,2.0,0.0>, ZERO_VECTOR, 1.571 [20:31] , PRIM_TEXTURE, 1, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 [20:31] , PRIM_TEXTURE, 2, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 [20:31] , PRIM_TEXTURE, 3, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <2.0,2.0,0.0>, ZERO_VECTOR, 1.571 [20:31] , PRIM_TEXTURE, 4, "6501bbbc-f754-bfff-dfbe-41f7492a077b", <1.0,2.10,0.0>, <0.0,0.450,0.0>, 1.571 [20:31] , PRIM_TEXTURE, 6, "d45e98e8-f54c-c6c5-6012-6431184d0a16", <0.50,0.20,0.0>, <0.40,0.280,0.0>, 1.571 [20:31] ]); [20:31] //This Script used 40 kBytes
If your client does not support to turn of the time you still have to cut cut out "[20:31] " from the beginning of each line in order to use the output in a code. Anylyn Hax 18:50, 4 July 2010 (UTC)
llSetPrimitiveParams() Example3 (updated since the function has changed)
<lsl> // This ugly hack gives out a piece of Human Readable Code, as demanded // by llSetPrimitiveParams. The result of this program comes via llOwnerSay // on the chat channel. Its a good idea to cut objectname and date out ;) // created by Anylyn Hax in the hot summer of 2007, and reworked in 2010. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>.
// strReplace by Haravikk Mistral string strReplace(string str, string search, string replace) {
return llDumpList2String(llParseStringKeepNulls((str="") + str, [search], []), replace);
} //cheatings string K=", "; list L=[];list L0=[]; o(string S){llOwnerSay("/me "+S);return;} t(string S){llOwnerSay("/me\t "+S);return;} list gpp(list l){ return llGetPrimitiveParams(l);} integer l2i(list s,integer i){return llList2Integer(s,i);} vector l2v(list s,integer i){return llList2Vector(s,i);} rotation l2r(list s,integer i){return llList2Rot(s,i);} string l2s(list s,integer i){return llList2String(s,i);} float l2f(list s,integer i){return llList2Float(s,i);}
string FI(integer n){if(!n){return "0";}else{return (string)n;}}
string FS(string s){if(s==""){return "\"\"";}else{return s;}}
string FF(float n, integer p) {
float rv=llPow(10, -p)*0.5; float r; if (n < 0) r=n - rv; else r=n + rv; if (p < 1) { p=1; } // float is float string result=llGetSubString((string)r, 0, llSubStringIndex((string)r, ".") + p); result=strReplace(result, ".000", ".0"); result=strReplace(result, "00,", "0,"); return result;
}
string FV(vector v, integer p) {
if(v==ZERO_VECTOR) { return "ZERO_VECTOR";} else { if (p < 1) { p=1; } // a vector contains floats float rv=llPow(10, -p)*0.5; float relx; float rely; float relz; float elx; float ely; float elz; elx=v.x; ely=v.y; elz=v.z;
if (elx < 0) {relx=elx - rv;} else {relx=elx + rv;} if (ely < 0) {rely=ely - rv;} else {rely=ely + rv;} if (elz < 0) {relz=elz - rv;} else {relz=elz + rv;}
string result="<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + p)+","+ llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + p)+","+ llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + p)+">"; result=strReplace(result, ".000", ".0"); result=strReplace(result, "00,", "0,"); result=strReplace(result, "00>", "0>"); return result; }
} string FR(rotation r, integer p) {
if(r==ZERO_ROTATION) { return "ZERO_ROTATION";} else { if (p < 1) { p=1; } // a vector contains floats float rv=llPow(10, -p)*0.5; float relx; float rely; float relz; float rels; float elx; float ely; float elz; float els; elx=r.x; ely=r.y; elz=r.z; els=r.s; if (elx < 0) {relx=elx - rv;} else {relx=elx + rv;} if (ely < 0) {rely=ely - rv;} else {rely=ely + rv;} if (elz < 0) {relz=elz - rv;} else {relz=elz + rv;} if (els < 0) {rels=els - rv;} else {rels=els + rv;} string result="<"+llGetSubString((string)relx, 0, llSubStringIndex((string)relx, ".") + p)+","+ llGetSubString((string)rely, 0, llSubStringIndex((string)rely, ".") + p)+","+ llGetSubString((string)relz, 0, llSubStringIndex((string)relz, ".") + p)+","+ llGetSubString((string)rels, 0, llSubStringIndex((string)rels, ".") + p)+">"; result=strReplace(result, ".000", ".0"); result=strReplace(result, "00,", "0,"); result=strReplace(result, "00>", "0>"); return result; }
}
default
{
state_entry() { string ce_primname=llGetObjectName(); llSetObjectName(""); // thats for you to not cut so much from the chat integer i=0; integer j=0; integer ce_side=llGetNumberOfSides(); list primtype=([ "PRIM_TYPE_BOX", // 0 "PRIM_TYPE_CYLINDER", // 1 "PRIM_TYPE_PRISM", // 2 "PRIM_TYPE_SPHERE", // 3 "PRIM_TYPE_TORUS", // 4 "PRIM_TYPE_TUBE", // 5 "PRIM_TYPE_RING", // 6 "PRIM_TYPE_SCULPT" // 7 ]); list booleans=([ "FALSE", // 0 "TRUE" // 1 ]); list texgens=([ "PRIM_TEXGEN_DEFAULT", // 0 "PRIM_TEXGEN_PLANAR" // 1 ]); list holeshape=([ "PRIM_HOLE_DEFAULT", // 0 default (matches the prim type: square for box, circle for cylinder, etc.) "","","","","","","","","","","","","","","", "PRIM_HOLE_CIRCLE", // 16 circle "","","","","","","","","","","","","","","", "PRIM_HOLE_SQUARE", // 32 square "","","","","","","","","","","","","","","", "PRIM_HOLE_TRIANGLE" // 48 triangle ]); list sculpttype=([ "PRIM_SCULPT_TYPE_SPHERE", // 1 sphere (Converge top & bottom, stitch left side to right) "PRIM_SCULPT_TYPE_TORUS", // 2 torus (Stitch top to bottom, stitch left side to right) "PRIM_SCULPT_TYPE_PLANE", // 3 plane (No stitching or converging) "PRIM_SCULPT_TYPE_CYLINDER" // 4 cylinder (Stitch left side to right, leave top and bottom open) ]); list bumpmapping=([ "PRIM_BUMP_NONE", // 0 none: no bump map "PRIM_BUMP_BRIGHT", // 1 brightness: generate bump map from highlights "PRIM_BUMP_DARK", // 2 darkness: generate bump map from lowlights "PRIM_BUMP_WOOD", // 3 woodgrain "PRIM_BUMP_BARK", // 4 bark "PRIM_BUMP_BRICKS", // 5 bricks "PRIM_BUMP_CHECKER", // 6 checker "PRIM_BUMP_CONCRETE", // 7 concrete "PRIM_BUMP_TILE", // 8 crustytile "PRIM_BUMP_STONE", // 9 cutstone: blocks "PRIM_BUMP_DISKS", // 10 discs: packed circles "PRIM_BUMP_GRAVEL", // 11 gravel "PRIM_BUMP_SIDING", // 13 siding "PRIM_BUMP_LARGETILE", // 14 stonetile "PRIM_BUMP_STUCCO", // 15 stucco "PRIM_BUMP_SUCTION", // 16 suction: rings "PRIM_BUMP_WEAVE" // 17 weave ]); list shinys=([ "PRIM_SHINY_NONE", // 0 none "PRIM_SHINY_LOW", // 1 low "PRIM_SHINY_MEDIUM", // 2 medium "PRIM_SHINY_HIGH" // 3 high ]); list materials=([ "PRIM_MATERIAL_STONE", // 0 stone "PRIM_MATERIAL_METAL", // 1 metal "PRIM_MATERIAL_GLASS", // 2 glass "PRIM_MATERIAL_WOOD", // 3 wood "PRIM_MATERIAL_FLESH", // 4 flesh "PRIM_MATERIAL_PLASTIC", // 5 plastic "PRIM_MATERIAL_RUBBER", // 6 rubber "PRIM_MATERIAL_LIGHT" // 7 light ]); list physics_shape=([ "PRIM_PHYSICS_SHAPE_PRIM", // 0 "PRIM_PHYSICS_SHAPE_CONVEX",// 1 "PRIM_PHYSICS_SHAPE_NONE" // 2 ]);
o("llSetPrimitiveParams(["); // 2 L=gpp([PRIM_MATERIAL]);t(" PRIM_MATERIAL, "+l2s(materials ,l2i(L,0))); // 3 L=gpp([PRIM_PHYSICS]);t(", PRIM_PHYSICS, "+l2s(booleans ,l2i(L ,0))); // 4 L=gpp([PRIM_TEMP_ON_REZ]);t(", PRIM_TEMP_ON_REZ, "+l2s(booleans ,l2i(L ,0))); // 5 L=gpp([PRIM_PHANTOM]);t(", PRIM_PHANTOM, "+l2s(booleans ,l2i(L ,0))); // 6 L=gpp([PRIM_POSITION]);t(", PRIM_POSITION, "+FV(l2v(L ,0),3)); // 7 L=gpp([PRIM_SIZE]);t(", PRIM_SIZE, "+FV(l2v(L ,0),3)); // 8 L=gpp([PRIM_ROTATION]);t(", PRIM_ROTATION, "+FR(l2r(L ,0),3)); // 9 L=gpp([PRIM_TYPE]); if(l2i(L,0)==0){t(", PRIM_TYPE, PRIM_TYPE_BOX"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} if(l2i(L,0)==1){t(", PRIM_TYPE, PRIM_TYPE_CYLINDER"+K+l2s(holeshape ,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} if(l2i(L,0)==2){t(", PRIM_TYPE, PRIM_TYPE_PRISM"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3));} if(l2i(L,0)==3){t(", PRIM_TYPE, PRIM_TYPE_SPHERE"+K+FI(l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3));} if(l2i(L,0)==4){t(", PRIM_TYPE, PRIM_TYPE_TORUS"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} if(l2i(L,0)==5){t(", PRIM_TYPE, PRIM_TYPE_TUBE"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} if(l2i(L,0)==6){t(", PRIM_TYPE, PRIM_TYPE_RING"+K+l2s(holeshape,l2i(L,1))+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3)+K+FV(l2v(L,4),3)+K+FV(l2v(L,5),3)+K+FV(l2v(L,6),3)+K+FV(l2v(L,7),3)+K+FV(l2v(L,8),3)+K+FF(l2f(L,9),3)+K+FF(l2f(L,10),3)+K+FF(l2f(L,11),3));} if(l2i(L,0)==7){t(", PRIM_TYPE, PRIM_TYPE_SCULPT"+", \""+l2s(L,1)+"\", "+FI(l2i(L,2)));}
// 17 L0=gpp([PRIM_TEXTURE,0]);t(", PRIM_TEXTURE, ALL_SIDES"+", \""+l2s(L0,0)+"\", "+FV(l2v(L0,1),3)+K+FV(l2v(L0,2),3)+K+FF(l2f(L0,3),3)); for(i=0;i <=ce_side;i++){L=gpp([PRIM_TEXTURE,i]); if (L!=[] && (l2s(L0,0)!=l2s(L,0)||l2v(L0,1)!=l2v(L,1)||l2v(L0,2)!=l2v(L,2)||l2f(L0,3)!=l2f(L,3))) { t(", PRIM_TEXTURE, "+(string)i+", \""+l2s(L,0)+"\", "+FV(l2v(L,1),3)+K+FV(l2v(L,2),3)+K+FF(l2f(L,3),3) );}} // 18 L0=gpp([PRIM_COLOR ,0]);t(", PRIM_COLOR, ALL_SIDES, "+FV(l2v(L0,0),3)+K+FF(l2f(L0,1),3)); for(i=0;i<=ce_side;i++){L=gpp([PRIM_COLOR,i]);if(L!=[] && L0!=L){t(", PRIM_COLOR, "+FI(i)+K+FV(l2v(L,0),3)+K+FF(l2f(L,1),3));}} // 19 L0=gpp([PRIM_BUMP_SHINY,0]);t(", PRIM_BUMP_SHINY, ALL_SIDES, "+l2s(shinys,l2i(L0,0))+K+l2s(bumpmapping,l2i(L0,1)) ); for(i=0;i<=ce_side;i++){ L=gpp([PRIM_BUMP_SHINY,i]);if(L!=[] && L0!=L){t(", PRIM_BUMP_SHINY, "+FI(i)+K+l2s(shinys,l2i(L,0))+K+l2s(bumpmapping ,l2i(L,1)));}} // 20 L0=gpp([PRIM_FULLBRIGHT,0]);t(", PRIM_FULLBRIGHT, ALL_SIDES, "+l2s(booleans ,l2i(L0,0)) ); for(i=0;i<=ce_side;i++){L=gpp([PRIM_FULLBRIGHT,i]);if (L!=[] && L0!=L){t(", PRIM_FULLBRIGHT, "+FI(i)+K+l2s(booleans ,l2i(L,0)));}} // 21 L=gpp([PRIM_FLEXIBLE]); t(", PRIM_FLEXIBLE"+K+l2s(booleans ,l2i(L,0))+K+FI(l2i(L,1))+K+FF(l2f(L,2),3)+K+FF(l2f(L,3),3)+K+FF(l2f(L,4),3)+K+FF(l2f(L,5),3)+K+FV(l2v(L,6),3)); // 22 L0=gpp([PRIM_TEXGEN ,0]);t(", PRIM_TEXGEN, ALL_SIDES, "+l2s(texgens,l2i(L0,0))); for(i=0;i<=ce_side;i++){L=gpp([PRIM_TEXGEN ,i]);if (L!=[] && L0!=L){t(", PRIM_TEXGEN, "+FI(i)+K+l2s(texgens,l2i(L,0)));}} // 23 L=gpp([PRIM_POINT_LIGHT]);t(", PRIM_POINT_LIGHT"+K+l2s(booleans ,l2i(L,0))+K+FV(l2v(L,1),3)+K+FF(l2f(L,2),3)+K+FF(l2f(L,3),3)+K+FF(l2f(L,4),3)); // 25 L0=gpp([PRIM_GLOW ,0]);t(", PRIM_GLOW, ALL_SIDES, "+FF(l2f(L0,0),3)); for(i=0;i<=ce_side;i++){L=gpp([PRIM_GLOW ,i]);if (L!=[] && L0!=L) {t(", PRIM_GLOW, "+FI(i)+K+FF(l2f(L,0),3) );}} // 26 L=gpp([PRIM_TEXT]);t(", PRIM_TEXT, "+FS(l2s(L,0))+K+FV(l2v(L,1),3)+K+FF(l2f(L,2),3)); // 27 L=gpp([PRIM_NAME]); string prn=l2s(L,0);t(", PRIM_NAME, \""+prn+"\" ");prn=""; // 28 L=gpp([PRIM_DESC]); string prd=l2s(L,0);t(", PRIM_DESC, \""+prd+"\" ");prd=""; // 29 L=gpp([PRIM_ROT_LOCAL]);t(", PRIM_ROT_LOCAL, "+FR(l2r(L,0),3) ); // 30 L=gpp([PRIM_PHYSICS_SHAPE_TYPE]);t(", PRIM_PHYSICS_SHAPE_TYPE, "+l2s(physics_shape ,l2i(L,0))); //32 L=gpp([PRIM_OMEGA]);t(", PRIM_OMEGA, "+FV(l2v(L,0),3)+K+FF(l2f(L,1),3)+K+FF(l2f(L,2),3)); // 33 L=gpp([PRIM_POS_LOCAL]);t(", PRIM_POS_LOCAL, "+FV(l2v(L,0),3) ); /* 34 BUGGY, use only with Linksets L=gpp([PRIM_LINK_TARGET]); string plt=FI(0+l2i(L,0)); if(plt=="-4"){plt="LINK_THIS";} else if(plt=="-3"){plt="LINK_ALL_CHILDREN";} else if(plt=="-2"){plt="LINK_ALL_OTHERS";} else if(plt=="-1"){plt="LINK_SET";} else if(plt=="0"){plt="0 //unlinked";} else if(plt=="1"){plt="LINK_ROOT";} t(", PRIM_LINK_TARGET, "+plt);plt=""; */
o(" ]);"); o(" //This Script used " + (string)(((4*16384) - llGetFreeMemory())/1024) + " kBytes"); llSetObjectName(ce_primname); // what you take you must give back }
} </lsl>
llSetPrimitiveParams([ PRIM_MATERIAL, PRIM_MATERIAL_WOOD , PRIM_PHYSICS, FALSE , PRIM_TEMP_ON_REZ, FALSE , PRIM_PHANTOM, FALSE , PRIM_POSITION, <106.967,232.168,70.913> , PRIM_SIZE, <0.50,0.50,0.50> , PRIM_ROTATION, ZERO_ROTATION , PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <1.0,1.0,0.0>, ZERO_VECTOR , PRIM_TEXTURE, ALL_SIDES, "89556747-24cb-43ed-920b-47caed15465f", <1.0,1.0,0.0>, ZERO_VECTOR, 0.0 , PRIM_COLOR, ALL_SIDES, <1.0,1.0,1.0>, 1.0 , PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_NONE, PRIM_BUMP_NONE , PRIM_FULLBRIGHT, ALL_SIDES, FALSE , PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR , PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT , PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 , PRIM_GLOW, ALL_SIDES, 0.0 , PRIM_TEXT, "", ZERO_VECTOR, 1.0 , PRIM_NAME, "" , PRIM_DESC, "" , PRIM_ROT_LOCAL, ZERO_ROTATION , PRIM_PHYSICS_SHAPE_TYPE, PRIM_PHYSICS_SHAPE_PRIM , PRIM_OMEGA, ZERO_VECTOR, 0.0, 0.0 , PRIM_POS_LOCAL, <106.967,232.168,70.913> ]); //This Script used 53 kBytes
Spinning DanceBall with random colors
People keep asking me how to make a danceball, so I thought I might publish one here and show same time a exemple of how to use the upper Human Readable Output script.
- remember to cut out the PRIM_POSITION and possible the PRIM_ROTATION stanza.
- remember to make (or by) some dances and fill the danceball with up to 11 such animations.
If you like to try to do some animations like dances or other by yourself, I recommend the fantastic work of Vince Invincible and Zi Ree the QAvimator. It is a free alternative to Poser and Maya, and it runs on Windows, Mac OS X, and Linux. http://www.qavimator.org/
<lsl> list anis; integer CHANNEL; integer lisi;
MakeTheBall() {
llSetTimerEvent(10); llSetPrimitiveParams([ PRIM_FLEXIBLE, FALSE, 0, 0.0, 0.0, 0.0, 0.0, ZERO_VECTOR , PRIM_MATERIAL, PRIM_MATERIAL_WOOD , PRIM_PHANTOM, FALSE , PRIM_PHYSICS, FALSE , PRIM_POINT_LIGHT, FALSE, ZERO_VECTOR, 0.0, 0.0, 0.0 , PRIM_SIZE, <1.5,1.5,1.5> , PRIM_TEMP_ON_REZ, FALSE , PRIM_TYPE, PRIM_TYPE_SPHERE, 0, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <0.0,1.0,0.0> , PRIM_FULLBRIGHT, ALL_SIDES, TRUE , PRIM_BUMP_SHINY, ALL_SIDES, PRIM_SHINY_HIGH, PRIM_BUMP_NONE , PRIM_COLOR, ALL_SIDES, <0.705,0.449,0.807>, 1.0 , PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT , PRIM_TEXTURE, ALL_SIDES, "42d9ac0b-d423-94f0-9fd5-db3162b0d4ea", <4.0,12.0,0.0>, <0,0,0>, 0.5 ]); llSetTextureAnim(ANIM_ON | SMOOTH | LOOP , ALL_SIDES, 0, 1, 0.0, 1.0, 0.1); anis = ["STOP"]; integer a=0; while(a<llGetInventoryNumber(INVENTORY_ANIMATION) && a<9){anis+=llGetInventoryName(INVENTORY_ANIMATION,a++);}; return;
}
default {
state_entry(){MakeTheBall();} changed(integer change){if (change & CHANGED_INVENTORY){MakeTheBall();}} timer() { float rot = llFrand(1.0); float gruen = llFrand(1.0); float blau = llFrand(1.0); //llSetColor(<rot,gruen,blau> , ALL_SIDES ); llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_COLOR, ALL_SIDES, <rot,gruen,blau>, 1.0]); llSetTimerEvent(llFrand(25.0)); } touch_start(integer total_number){llRequestPermissions(llDetectedKey(0), PERMISSION_TRIGGER_ANIMATION);} run_time_permissions(integer perm) { if (perm & PERMISSION_TRIGGER_ANIMATION) { CHANNEL = llRound(llFrand(-99999999.9)); lisi = llListen(CHANNEL,"","",""); llDialog(llGetPermissionsKey(), "Choose the dance ",anis,CHANNEL); } } listen(integer chan, string name, key id, string mess) { if ( chan==CHANNEL && id == llGetPermissionsKey() && mess != "STOP") {llStartAnimation(mess);llListenRemove(lisi);} if ( chan==CHANNEL && id == llGetPermissionsKey() && mess == "STOP") { integer x = 0; while(x < llGetInventoryNumber(INVENTORY_ANIMATION)) {llStopAnimation(llGetInventoryName(INVENTORY_ANIMATION, x++));} llListenRemove(lisi); } }
} </lsl>
Viewer 2 and privacy issues
We can see that the viewer 2 is very hardly pushed by the Lindens this days. But there are some privacy issues when you let everybody run java scripts on your system. As long as the integrated browser accepts all cookies and runs all java scripts, I is not just stupid but irresponsible to use the viewer2. Under this light can someone explain me why I should use the viewer ?
This was a Anonymous comment of a Viewer 2 fan:
COMMENT :
"Why should you use Internet Explore or Firefox or Opera as INTERNET browser? They allow javascripts as the LL integrated browser. Do you judge a viewer bad because it just integrate an internet browser working like all the other INTERNET browsers in the world?. Just disable cookies and javascripts in the Preferences. There is no reason to NOT use the new great LL viewer. Anyway I wonder where this informations are useful here. Just for gossip? There is no Viewer 2 privacy issues. If you are worried about this, start to remove al your INTERNET browsers."
ANSWER BY ANYLYN:
Viewer 2 enables Web on a prim, you can't turn it off. What means that I can put a Website on a primface and you visit this website without knowing its a website. Just by simple visiting the website you submit your IP and with the IP a lot of Informations. If Java and Cookies are enabled its almost like showing your personal id to the Webmaster of the site.
Sure does the Webmaster see all the IPs of the visitos also if the Website is in the profile tab. But the difference is that he can not know is who.
With web on a prim he can, because he can send a llHTTPRequest() to the server submitting your key, and then he can determine your IP very exactly by comparing the timestamp with the webserver logs.
If the Webmaster is the one who placed the site on the prim he could attack you with a Ping Flood for example and in best case disconnect you from second life. In the worst case he can burn your hardware down, by running your processor with 100%. if your cooling System is not that good you need a new processor. I think this is enough info, I don't want to give people ideas. Anyway if a lady is warning you by telling you there is a privacy issue together with viewer 2 and you don't know or understand , ask, don't talk nonsense in public.