Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Tiny Prims Fix_Small_Prims_Improved  

Fix_Small_Prims_Improved

Fix_Small_Prims_Improved

Category: Tiny Prims
By : Innula Zenovka
Created: 2010-11-16 Edited: 2010-11-16
Worlds: Second Life

the Zip file

Download all files for Fix_Small_Prims_Improved
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Fix_Small_Prims_Improved_1.lsl
1 /*based on the wonderful script, Fix Small Prims by Emma Nowhere, http://wiki.secondlife.com/wiki/Fix_Small_Prims, updated by Innula Zenovka to use llGetLinkPrimitiveParams and llSetLinkPrimitiveParamsFast.
2
3 Issued under the "do what the hell you like with it, but you if you scam people by selling it on its own I shall be so cross" licence
4
5 This works by finding all prims in a linkset that can't be shrunk any further and, when you click "fix", slightly increasing the size on any axis that's at the minimun, this allowing you to shrink them some more. Click "rerun" if you hit the minimun size again, to find the small prims again, and then click "fix" to fix them. Click Delete Script when you are done*/
6
7 list options =["Fix", "Delete Script", "ReRun"];
8 list start_scale;
9 list to_fix;
10 integer i;
11 integer max;
12 integer rescaleX = FALSE;
13 integer rescaleY = FALSE;
14 integer rescaleZ = FALSE;
15 integer chan;
16 vector scale;
17
18 integer fncStrideCount(list lstSource, integer intStride)
19 {
20 return llGetListLength(lstSource) / intStride;
21 }
22
23 // Returns a Stride from a List
24 list fncGetStride(list lstSource, integer intIndex, integer intStride)
25 {
26 integer intNumStrides = fncStrideCount(lstSource, intStride);
27
28 if(intNumStrides != 0 && intIndex < intNumStrides)
29 {
30 integer intOffset = intIndex * intStride;
31 return llList2List(lstSource, intOffset, intOffset + (intStride - 1));
32 }
33 return [];
34 }
35 default {
36 state_entry() {
37 chan = (integer)("0x"+llGetSubString((string)llGetKey(),-8,-1));
38 to_fix=[];
39 llListen(chan, "", llGetOwner(), "");
40 max = llGetNumberOfPrims();
41 llOwnerSay("checking for small prims");
42 for (i = 1; i <= max; ++i) {
43 scale = llList2Vector(llGetLinkPrimitiveParams(i,[PRIM_SIZE]), 0);
44 start_scale +=[i] +[scale]; //record start sizes
45 if(scale.x < .015) {
46 scale.x = .015;
47 rescaleX = TRUE;
48 }
49 if(scale.y < .015) {
50 scale.y = .015;
51 rescaleY = TRUE;
52 }
53
54 if(scale.z < .015) {
55 scale.z = .015;
56 rescaleZ = TRUE;
57 }
58 if(rescaleX || rescaleY || rescaleZ) {
59 to_fix +=[i] +[scale]; // add new sizes to list
60 llOwnerSay("need to fix linknumber "+(string)i);
61 rescaleX = FALSE;
62 rescaleY = FALSE;
63 rescaleZ = FALSE;
64 }
65 }
66 if(llGetListLength(to_fix)==0){
67 llOwnerSay("no prims are at the minimum size");
68 }
69 else{
70 llDialog(llGetOwner(),"Please choose one",options,chan);
71 }
72 }
73
76 llDialog(llGetOwner(),"Please choose one",options,chan);
77 }
78 }
79
80 listen(integer channel, string name, key id, string msg) {
81 msg=llToLower(msg);
82 if(msg=="fix"){
83 max=llGetListLength(to_fix)/2;
84 for(i=0;i<max;i++){
85 list temp = fncGetStride(to_fix, i, 2);
86 llOwnerSay("fixing linknumber "+(string)llList2Integer(temp,i));
87 llSetLinkPrimitiveParamsFast(llList2Integer(temp,i),[PRIM_SIZE,llList2Vector(temp,i+1)]);
88 }
89 }
90 else if(msg=="restore"){
91 llOwnerSay("going back to start size");
92 max=llGetListLength(start_scale)/2;
93 for(i=0;i<max;i++){
94 list temp = fncGetStride(start_scale, i, 2);
95 llSetLinkPrimitiveParamsFast(llList2Integer(temp,i),[PRIM_SIZE,llList2Vector(temp,i+1)]);
96 }
97 }
98
99 else if(msg=="delete script"){
100 llOwnerSay("deleting script");
102 }
103 else if(msg=="rerun"){
105 }
106
107 }
108
109 }

Back to the Best Free Tools in Second Life and OpenSim.