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  

Fix_Small_Prims

Fix Small Prims.lsl

Category: Tiny Prims
By : Emma Nowhere
Created: 2010-01-10 Edited: 2010-01-10
Worlds: Second Life

the Zip file

Download all files for Fix_Small_Prims
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Fix_Small_Prims_1.lsl
1
2
3 ///////////////////////////////////////////////////////////////////////////////
4 // FixSmallPrims
5 // by Emma Nowhere
6 //
7 // How to use:
8 // 1. Install this script in the root prim of a linked set of prims (aka "linkset")
9 // 2. Type /1fspsetup to copy copy scripts into all the prims in the linkset
10 // 3. Take the linkset into inventory
11 // 4. Re-rez the linkset from inventory
12 // 5. Select the linkset and choose "Set Scripts to Running in Selection" under the Tools menu
13 // 6. Type /1fsprun to fix all the small prims
14 // 7. Resize the linkset object to the desired size
15 // 8. Type /1fspcleanup to remove the scripts from the linkset
16
17 integer CHANNEL = 1;
18
19 vector backupScale = ZERO_VECTOR;
20 integer backupStored = FALSE;
21
22 integer rescaleX = FALSE;
23 integer rescaleY = FALSE;
24 integer rescaleZ = FALSE;
25
26 backup() {
27 if(!backupStored) {
28 backupScale = llGetScale();
29 backupStored = TRUE;
30 }
31 }
32
33 restore() {
34 if(backupStored) {
35 llSetScale(backupScale);
36 }
37 rescaleX = FALSE;
38 rescaleY = FALSE;
39 rescaleZ = FALSE;
40 }
41
42 cleanup() {
43 vector scale = llGetScale();
44
45 if(rescaleX) {
46 scale.x = backupScale.x;
47 }
48
49 if(rescaleY) {
50 scale.y = backupScale.y;
51 }
52
53 if(rescaleZ) {
54 scale.z = backupScale.z;
55 }
56
57 if(rescaleX || rescaleY || rescaleZ) {
58 llSay(0, "Cleaning scale of linked prim #" + (string)llGetLinkNumber());
59 llSetScale(scale);
60 }
61
63 }
64
65 process() {
66 restore();
67 backup();
68
69 vector scale = llGetScale();
70
71 if(scale.x < .015) {
72 scale.x = .015;
73 rescaleX = TRUE;
74 }
75
76 if(scale.y < .015) {
77 scale.y = .015;
78 rescaleY = TRUE;
79 }
80
81 if(scale.z < .015) {
82 scale.z = .015;
83 rescaleZ = TRUE;
84 }
85
86 if(rescaleX || rescaleY || rescaleZ) {
87 llSay(0, "Fixing size of linked prim #" + (string)llGetLinkNumber());
88 llSetScale(scale);
89 }
90 }
91
92 GiveScriptToLinkedPrims()
93 {
95 integer i = 0;
96 for (i = 2; i <= p; i++)
97 {
98 key prim = llGetLinkKey(i);
100 }
101 }
102
103 default
104 {
106 {
107 integer linkNum = llGetLinkNumber();
108 if(linkNum < 2) llListen(CHANNEL, "", llGetOwner(), "");
109 }
110
111 on_rez(integer start_param) {
112 integer linkNum = llGetLinkNumber();
113 if(linkNum < 2) llSay(0, "FixSmallPrims Installed");
114 }
115
116 listen(integer channel, string name, key id, string message)
117 {
118 if(message == "fspsetup")
119 {
120 GiveScriptToLinkedPrims();
121 }
122 else
123 {
124 llMessageLinked(LINK_SET, 0, message, NULL_KEY);
125 }
126 }
127
128 link_message(integer sender_num, integer num, string str, key id)
129 {
130 integer linkNum = llGetLinkNumber();
131
132 if(str == "fsptest") {
133 llSay(0, "Script is installed and running in linked prim #" + (string)linkNum);
134 }
135 else if(str == "fspbackup") {
136 backup();
137 }
138 else if(str == "fsprestore") {
139 restore();
140 }
141 else if(str == "fspcleanup") {
142 cleanup();
143 }
144 else if(str == "fsprun") {
145 process();
146 }
147
148 }
149 }
150
151
152
153 // END //

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