User:Anylyn Hax

From Second Life Wiki
Revision as of 10:29, 4 July 2010 by Anylyn Hax (talk | contribs)
Jump to navigation Jump to search
Anylyn Hax, 500 L$ / 30 min _ _


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)

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)(You still need to remove ":" from the beginning of each row.) 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.

<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 noallsides = FALSE; // there is no such thing like a free meal ...
       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("\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("\t, PRIM_MATERIAL, "+llList2String(materials ,llList2Integer(ce_prim_material,0)));
       ce_prim_material = [];

       list ce_prim_phantom =      llGetPrimitiveParams([PRIM_PHANTOM]);           // 5
       llOwnerSay("\t, PRIM_PHANTOM, "+llList2String(booleans ,llList2Integer(ce_prim_phantom ,0)));
       ce_prim_phantom = [];

       list ce_prim_physiks =      llGetPrimitiveParams([PRIM_PHYSICS]);           // 3
       llOwnerSay("\t, PRIM_PHYSICS, "+llList2String(booleans ,llList2Integer(ce_prim_physiks ,0)));
       ce_prim_physiks = [];

       list ce_prim_point_light =  llGetPrimitiveParams([PRIM_POINT_LIGHT]);       // 23
       llOwnerSay("\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("\t, PRIM_POSITION, "+FormatVector(llList2Vector(ce_prim_position ,0),3));
       ce_prim_position = [];

       list ce_prim_rotation =     llGetPrimitiveParams([PRIM_ROTATION]);          // 8
       llOwnerSay("\t, PRIM_ROTATION, "+(string)llList2Rot(ce_prim_rotation ,0));
       ce_prim_rotation = [];

       list ce_prim_size =         llGetPrimitiveParams([PRIM_SIZE]);              // 7
       llOwnerSay("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("\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("]);");
       llOwnerSay("//This Script used " + (string)(((4*16384) - llGetFreeMemory())/1024) + " kBytes");
       llSetObjectName(ce_primname);
   }

</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]  Object: //This Script used 40 kBytes

You still have to cut cut out "[20:31]  :" from the beginning of each line in order to use the output in a code.

View the issues Anylyn Hax has filed at jira.secondlife.com