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
Resizer Resize_Script  

Resize_Script

*DS* Resize Script (m/c/t) by Daemonika...

Category: Resizer
By : Daemonika Nightfire
Created: 2013-06-24 Edited: 2013-06-24
Worlds: Second Life

the Zip file

Download all files for Resize_Script
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. Resize_Script_1.lsl
1
2
3 key owner;
4 integer new = TRUE;
5
6 integer LinkSet = TRUE;
7 integer Prim;
8
9 integer Channel;
10 integer Listener;
11 Chan()
12 {
13 llListenRemove(Listener);
14 Channel = (integer)(llFrand(999999.0) * -1);
15 Listener = llListen(Channel, "", owner, "");
17 }
18
19 menu1()
20 {
21 Chan();
22 if(new)
23 {
24 llDialog(owner, "\nYour first run or reset of this script.\nDo you whish to save current parameters?",
25 ["Save","Later"], Channel);
26 }
27 else
28 {
29 llDialog(owner, "\nselect an option\nThis = touched Prim\nAll = complete Object",
30 ["This","All","Done"], Channel);
31 }
32 }
33
34 menu2()
35 {
36 Chan();
37 llDialog(owner, "\n+ - = resize\nSave = record all parameters\nRestore = restore saved parameters",
38 ["Save","Restore","Done","-1%","-5%","-10%","+1%","+5%","+10%"], Channel);
39 }
40
41 default
42 {
44 {
45 owner = llGetOwner();
46 llWhisper(0,"/me " + llGetScriptName() + " Free Memory: " + (string)llGetFreeMemory() + " bytes.");
47 }
48
49 touch_start(integer total_number)
50 {
51 owner = llGetOwner();
52 if(llDetectedKey(0) == owner)
53 {
54 if(llGetAttached() != 0)
55 {
56 if(llGetAgentInfo(owner) & AGENT_SITTING)
57 {
58 Prim = llDetectedLinkNumber(0);
59 menu1();
60 }
61 else
62 {
63 llOwnerSay("Please use a posing stand for resizing!");
64 }
65 }
66 else
67 {
68 Prim = llDetectedLinkNumber(0);
69 menu1();
70 }
71 }
72 }
73
74 listen(integer channel, string name, key id, string msg)
75 {
76 float shift = 0;
77 vector position;
78 vector size;
79 list link;
80 integer i;
81
82 if(msg == "This")
83 {
84 LinkSet = FALSE;
85 menu2();
86 }
87 else if(msg == "All")
88 {
89 LinkSet = TRUE;
90 menu2();
91 }
92 else if(msg == "Done" || msg == "Later")
93 {
94 llListenRemove(Listener);
96 }
97 else if(msg == "-1%")
98 {
99 shift = 0.99;
100 }
101 else if(msg == "-5%")
102 {
103 shift = 0.95;
104 }
105 else if(msg == "-10%")
106 {
107 shift = 0.9;
108 }
109 else if(msg == "+1%")
110 {
111 shift = 1.01;
112 }
113 else if(msg == "+5%")
114 {
115 shift = 1.05;
116 }
117 else if(msg == "+10%")
118 {
119 shift = 1.1;
120 }
121
122 // Record
123 else if(msg == "Save")
124 {
125 llOwnerSay("Please wait...");
126 if(!LinkSet)
127 {
128 link = llGetLinkPrimitiveParams(Prim, [PRIM_SIZE , PRIM_POSITION]);
129 position = llList2Vector(link, 1);
130 position = (position - llGetRootPosition()) / llGetRootRotation();
131 size = llList2Vector(link, 0);
132
133 llSetLinkPrimitiveParamsFast(Prim,[PRIM_DESC,(string)size + "#" + (string)position]);
134 }
135 else
136 {
137 for(i = 0; i <= llGetNumberOfPrims(); i++)
138 {
139 link = llGetLinkPrimitiveParams(i, [PRIM_SIZE , PRIM_POSITION]);
140 size = llList2Vector(link, 0);
141 position = llList2Vector(link, 1);
142 position = (position - llGetRootPosition()) / llGetRootRotation();
143
144 if(i > 1)
145 {
146 llSetLinkPrimitiveParamsFast(i,[PRIM_DESC,(string)size + "#" + (string)position]);
147 }
148 else
149 {
150 llSetLinkPrimitiveParamsFast(i,[PRIM_DESC,(string)size]);
151 }
152 }
153 new = FALSE;
154 }
155 llOwnerSay("All parameters are stored");
156 menu2();
157 }
158
159 // Restore
160 else if(msg == "Restore")
161 {
162 if(!new)
163 {
164 llOwnerSay("Please wait...");
165 if(!LinkSet)
166 {
167 link = llGetLinkPrimitiveParams(Prim, [PRIM_DESC]);
168 list parsed = llParseString2List(llList2CSV(link), ["#"], []);
169 string vect = llList2String(parsed, 0);
170 size = (vector)vect;
171
172 llSetLinkPrimitiveParamsFast(Prim, [PRIM_SIZE, size]);
173 }
174 else
175 {
176 for(i = 0; i <= llGetNumberOfPrims(); i++)
177 {
178 link = llGetLinkPrimitiveParams(i, [PRIM_DESC]);
179 list parsed = llParseString2List(llList2CSV(link), ["#"], []);
180 string vect = llList2String(parsed, 0);
181 size = (vector)vect;
182 string posi = llList2String(parsed, 1);
183 position = (vector)posi;
184
185 if(i > 1)
186 {
187 llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, size, PRIM_POSITION, position]);
188 }
189 else
190 {
191 llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, size]);
192 }
193 }
194 }
195 llOwnerSay("All stored parameters restored.");
196 menu2();
197 }
198 else if(new)
199 {
200 llOwnerSay("Please first save all paremeters to use this.");
201 }
202 }
203
204 // Resize
205 if(shift != 0)
206 {
207 llOwnerSay("Please wait...");
208 if(!LinkSet)
209 {
210 link = llGetLinkPrimitiveParams(Prim, [PRIM_SIZE]);
211 size = llList2Vector(link, 0) * shift;
212
213 llSetLinkPrimitiveParamsFast(Prim, [PRIM_SIZE, size]);
214 }
215 else
216 {
217 for(i = 0; i <= llGetNumberOfPrims(); i++)
218 {
219 link = llGetLinkPrimitiveParams(i, [PRIM_SIZE, PRIM_POSITION]);
220 size = llList2Vector(link, 0) * shift;
221 position = llList2Vector(link, 1);
222 position = (position - llGetRootPosition()) / llGetRootRotation() * shift;
223
224 if(i > 1)
225 {
226 llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, size, PRIM_POSITION, position]);
227 }
228 else
229 {
230 llSetLinkPrimitiveParamsFast(i, [PRIM_SIZE, size]);
231 }
232 }
233 }
234 llOwnerSay("Finish.");
235 menu2();
236 }
237 }
238
239 timer()
240 {
242 llListenRemove(Listener);
243 llOwnerSay("Listener timeout, please touch again to use the menu.");
244 }
245
246 on_rez(integer Dae)
247 {
248 if(new)
249 {
251 }
252 }
253 }

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