corrade-lsl-templates – Diff between revs 5 and 29

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 5 Rev 29
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2014 - License: CC BY 2.0 //
3 /////////////////////////////////////////////////////////////////////////// 3 ///////////////////////////////////////////////////////////////////////////
4 // 4 //
5 // This is an automatic teleporter, sitter and animator for the Corrade 5 // This is an automatic teleporter, sitter and animator for the Corrade
6 // Second Life / OpenSim bot. You can find more details about the bot 6 // Second Life / OpenSim bot. You can find more details about the bot
7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade 7 // by following the URL: http://was.fm/secondlife/scripted_agents/corrade
8 // 8 //
9 // The sit script works together with a "configuration" notecard and an 9 // The sit script works together with a "configuration" notecard and an
10 // animation that must both be placed in the same primitive as this script. 10 // animation that must both be placed in the same primitive as this script.
11 // The purpose of this script is to demonstrate sitting with Corrade and 11 // The purpose of this script is to demonstrate sitting with Corrade and
12 // you are free to use, change, and commercialize it under the GNU/GPLv3 12 // you are free to use, change, and commercialize it under the CC BY 2.0
13 // license at: http://www.gnu.org/licenses/gpl.html 13 // license at: https://creativecommons.org/licenses/by/2.0
14 // 14 //
15 /////////////////////////////////////////////////////////////////////////// 15 ///////////////////////////////////////////////////////////////////////////
16   16  
17 /////////////////////////////////////////////////////////////////////////// 17 ///////////////////////////////////////////////////////////////////////////
18 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 18 // Copyright (C) 2014 Wizardry and Steamworks - License: CC BY 2.0 //
19 /////////////////////////////////////////////////////////////////////////// 19 ///////////////////////////////////////////////////////////////////////////
20 string wasKeyValueGet(string k, string data) { 20 string wasKeyValueGet(string k, string data) {
21 if(llStringLength(data) == 0) return ""; 21 if(llStringLength(data) == 0) return "";
22 if(llStringLength(k) == 0) return ""; 22 if(llStringLength(k) == 0) return "";
23 list a = llParseString2List(data, ["&", "="], []); 23 list a = llParseString2List(data, ["&", "="], []);
24 integer i = llListFindList(a, [ k ]); 24 integer i = llListFindList(a, [ k ]);
25 if(i != -1) return llList2String(a, i+1); 25 if(i != -1) return llList2String(a, i+1);
26 return ""; 26 return "";
27 } 27 }
28 28
29 /////////////////////////////////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////////
30 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 30 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
31 /////////////////////////////////////////////////////////////////////////// 31 ///////////////////////////////////////////////////////////////////////////
32 string wasKeyValueEncode(list data) { 32 string wasKeyValueEncode(list data) {
33 list k = llList2ListStrided(data, 0, -1, 2); 33 list k = llList2ListStrided(data, 0, -1, 2);
34 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 34 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
35 data = []; 35 data = [];
36 do { 36 do {
37 data += llList2String(k, 0) + "=" + llList2String(v, 0); 37 data += llList2String(k, 0) + "=" + llList2String(v, 0);
38 k = llDeleteSubList(k, 0, 0); 38 k = llDeleteSubList(k, 0, 0);
39 v = llDeleteSubList(v, 0, 0); 39 v = llDeleteSubList(v, 0, 0);
40 } while(llGetListLength(k) != 0); 40 } while(llGetListLength(k) != 0);
41 return llDumpList2String(data, "&"); 41 return llDumpList2String(data, "&");
42 } 42 }
43   43  
44 /////////////////////////////////////////////////////////////////////////// 44 ///////////////////////////////////////////////////////////////////////////
45 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 45 // Copyright (C) 2013 Wizardry and Steamworks - License: CC BY 2.0 //
46 /////////////////////////////////////////////////////////////////////////// 46 ///////////////////////////////////////////////////////////////////////////
47 integer wasListCountExclude(list input, list exclude) { 47 integer wasListCountExclude(list input, list exclude) {
48 if(llGetListLength(input) == 0) return 0; 48 if(llGetListLength(input) == 0) return 0;
49 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1) 49 if(llListFindList(exclude, (list)llList2String(input, 0)) == -1)
50 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 50 return 1 + wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
51 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude); 51 return wasListCountExclude(llDeleteSubList(input, 0, 0), exclude);
52 } 52 }
53   53  
54 /////////////////////////////////////////////////////////////////////////// 54 ///////////////////////////////////////////////////////////////////////////
55 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 55 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
56 /////////////////////////////////////////////////////////////////////////// 56 ///////////////////////////////////////////////////////////////////////////
57 // escapes a string in conformance with RFC1738 57 // escapes a string in conformance with RFC1738
58 string wasURLEscape(string i) { 58 string wasURLEscape(string i) {
59 string o = ""; 59 string o = "";
60 do { 60 do {
61 string c = llGetSubString(i, 0, 0); 61 string c = llGetSubString(i, 0, 0);
62 i = llDeleteSubString(i, 0, 0); 62 i = llDeleteSubString(i, 0, 0);
63 if(c == "") jump continue; 63 if(c == "") jump continue;
64 if(c == " ") { 64 if(c == " ") {
65 o += "+"; 65 o += "+";
66 jump continue; 66 jump continue;
67 } 67 }
68 if(c == "\n") { 68 if(c == "\n") {
69 o += "%0D" + llEscapeURL(c); 69 o += "%0D" + llEscapeURL(c);
70 jump continue; 70 jump continue;
71 } 71 }
72 o += llEscapeURL(c); 72 o += llEscapeURL(c);
73 @continue; 73 @continue;
74 } while(i != ""); 74 } while(i != "");
75 return o; 75 return o;
76 } 76 }
77   77  
78 /////////////////////////////////////////////////////////////////////////// 78 ///////////////////////////////////////////////////////////////////////////
79 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 79 // Copyright (C) 2015 Wizardry and Steamworks - License: CC BY 2.0 //
80 /////////////////////////////////////////////////////////////////////////// 80 ///////////////////////////////////////////////////////////////////////////
81 // unescapes a string in conformance with RFC1738 81 // unescapes a string in conformance with RFC1738
82 string wasURLUnescape(string i) { 82 string wasURLUnescape(string i) {
83 return llUnescapeURL( 83 return llUnescapeURL(
84 llDumpList2String( 84 llDumpList2String(
85 llParseString2List( 85 llParseString2List(
86 llDumpList2String( 86 llDumpList2String(
87 llParseString2List( 87 llParseString2List(
88 i, 88 i,
89 ["+"], 89 ["+"],
90 [] 90 []
91 ), 91 ),
92 " " 92 " "
93 ), 93 ),
94 ["%0D%0A"], 94 ["%0D%0A"],
95 [] 95 []
96 ), 96 ),
97 "\n" 97 "\n"
98 ) 98 )
99 ); 99 );
100 } 100 }
101   101  
102 // corrade data 102 // corrade data
103 string CORRADE = ""; 103 string CORRADE = "";
104 string GROUP = ""; 104 string GROUP = "";
105 string PASSWORD = ""; 105 string PASSWORD = "";
106 string PUNISHMENT = ""; 106 string PUNISHMENT = "";
107 list SPLIT = []; 107 list SPLIT = [];
108 list ANNOUNCE = []; 108 list ANNOUNCE = [];
109   109  
110 // for holding the callback URL 110 // for holding the callback URL
111 string callback = ""; 111 string callback = "";
112   112  
113 // for notecard reading 113 // for notecard reading
114 integer line = 0; 114 integer line = 0;
115 115
116 // key-value data will be read into this list 116 // key-value data will be read into this list
117 list tuples = []; 117 list tuples = [];
118 // blacklisted words will be here 118 // blacklisted words will be here
119 list badwords = []; 119 list badwords = [];
120   120  
121 default { 121 default {
122 state_entry() { 122 state_entry() {
123 if(llGetInventoryType("configuration") != INVENTORY_NOTECARD) { 123 if(llGetInventoryType("configuration") != INVENTORY_NOTECARD) {
124 llOwnerSay("Sorry, could not find a configuration inventory notecard."); 124 llOwnerSay("Sorry, could not find a configuration inventory notecard.");
125 return; 125 return;
126 } 126 }
127 // DEBUG 127 // DEBUG
128 llOwnerSay("Reading configuration file..."); 128 llOwnerSay("Reading configuration file...");
129 llGetNotecardLine("configuration", line); 129 llGetNotecardLine("configuration", line);
130 } 130 }
131 dataserver(key id, string data) { 131 dataserver(key id, string data) {
132 if(data == EOF) { 132 if(data == EOF) {
133 // invariant, length(tuples) % 2 == 0 133 // invariant, length(tuples) % 2 == 0
134 if(llGetListLength(tuples) % 2 != 0) { 134 if(llGetListLength(tuples) % 2 != 0) {
135 llOwnerSay("Error in configuration notecard."); 135 llOwnerSay("Error in configuration notecard.");
136 return; 136 return;
137 } 137 }
138 CORRADE = llList2String( 138 CORRADE = llList2String(
139 tuples, 139 tuples,
140 llListFindList( 140 llListFindList(
141 tuples, 141 tuples,
142 [ 142 [
143 "corrade" 143 "corrade"
144 ] 144 ]
145 ) 145 )
146 +1); 146 +1);
147 if(CORRADE == "") { 147 if(CORRADE == "") {
148 llOwnerSay("Error in configuration notecard: corrade"); 148 llOwnerSay("Error in configuration notecard: corrade");
149 return; 149 return;
150 } 150 }
151 GROUP = llList2String( 151 GROUP = llList2String(
152 tuples, 152 tuples,
153 llListFindList( 153 llListFindList(
154 tuples, 154 tuples,
155 [ 155 [
156 "group" 156 "group"
157 ] 157 ]
158 ) 158 )
159 +1); 159 +1);
160 if(GROUP == "") { 160 if(GROUP == "") {
161 llOwnerSay("Error in configuration notecard: password"); 161 llOwnerSay("Error in configuration notecard: password");
162 return; 162 return;
163 } 163 }
164 PASSWORD = llList2String( 164 PASSWORD = llList2String(
165 tuples, 165 tuples,
166 llListFindList( 166 llListFindList(
167 tuples, 167 tuples,
168 [ 168 [
169 "password" 169 "password"
170 ] 170 ]
171 ) 171 )
172 +1); 172 +1);
173 if(PASSWORD == "") { 173 if(PASSWORD == "") {
174 llOwnerSay("Error in configuration notecard: password"); 174 llOwnerSay("Error in configuration notecard: password");
175 return; 175 return;
176 } 176 }
177 PUNISHMENT = llList2String( 177 PUNISHMENT = llList2String(
178 tuples, 178 tuples,
179 llListFindList( 179 llListFindList(
180 tuples, 180 tuples,
181 [ 181 [
182 "punishment" 182 "punishment"
183 ] 183 ]
184 ) 184 )
185 +1); 185 +1);
186 if(PUNISHMENT == "") { 186 if(PUNISHMENT == "") {
187 llOwnerSay("Error in configuration notecard: punishment"); 187 llOwnerSay("Error in configuration notecard: punishment");
188 return; 188 return;
189 } 189 }
190 string split = llList2String( 190 string split = llList2String(
191 tuples, 191 tuples,
192 llListFindList( 192 llListFindList(
193 tuples, 193 tuples,
194 [ 194 [
195 "split" 195 "split"
196 ] 196 ]
197 ) 197 )
198 +1 198 +1
199 ); 199 );
200 do { 200 do {
201 SPLIT += llGetSubString(split, 0, 0); 201 SPLIT += llGetSubString(split, 0, 0);
202 split = llDeleteSubString(split, 0, 0); 202 split = llDeleteSubString(split, 0, 0);
203 } while(llStringLength(split) != 0); 203 } while(llStringLength(split) != 0);
204 if(SPLIT == []) { 204 if(SPLIT == []) {
205 llOwnerSay("Error in configuration notecard: split"); 205 llOwnerSay("Error in configuration notecard: split");
206 return; 206 return;
207 } 207 }
208 ANNOUNCE = llCSV2List( 208 ANNOUNCE = llCSV2List(
209 llList2String( 209 llList2String(
210 tuples, 210 tuples,
211 llListFindList( 211 llListFindList(
212 tuples, 212 tuples,
213 [ 213 [
214 "announce" 214 "announce"
215 ] 215 ]
216 ) 216 )
217 +1 217 +1
218 ) 218 )
219 ); 219 );
220 if(ANNOUNCE == []) { 220 if(ANNOUNCE == []) {
221 llOwnerSay("Error in configuration notecard: announce"); 221 llOwnerSay("Error in configuration notecard: announce");
222 return; 222 return;
223 } 223 }
224 // DEBUG 224 // DEBUG
225 llOwnerSay("Read configuration notecard..."); 225 llOwnerSay("Read configuration notecard...");
226 state words; 226 state words;
227 } 227 }
228 if(data == "") jump continue; 228 if(data == "") jump continue;
229 integer i = llSubStringIndex(data, "#"); 229 integer i = llSubStringIndex(data, "#");
230 if(i != -1) data = llDeleteSubString(data, i, -1); 230 if(i != -1) data = llDeleteSubString(data, i, -1);
231 list o = llParseString2List(data, ["="], []); 231 list o = llParseString2List(data, ["="], []);
232 // get rid of starting and ending quotes 232 // get rid of starting and ending quotes
233 string k = llDumpList2String( 233 string k = llDumpList2String(
234 llParseString2List( 234 llParseString2List(
235 llStringTrim( 235 llStringTrim(
236 llList2String( 236 llList2String(
237 o, 237 o,
238 0 238 0
239 ), 239 ),
240 STRING_TRIM), 240 STRING_TRIM),
241 ["\""], [] 241 ["\""], []
242 ), "\""); 242 ), "\"");
243 string v = llDumpList2String( 243 string v = llDumpList2String(
244 llParseString2List( 244 llParseString2List(
245 llStringTrim( 245 llStringTrim(
246 llList2String( 246 llList2String(
247 o, 247 o,
248 1 248 1
249 ), 249 ),
250 STRING_TRIM), 250 STRING_TRIM),
251 ["\""], [] 251 ["\""], []
252 ), "\""); 252 ), "\"");
253 if(k == "" || v == "") jump continue; 253 if(k == "" || v == "") jump continue;
254 tuples += k; 254 tuples += k;
255 tuples += v; 255 tuples += v;
256 @continue; 256 @continue;
257 llGetNotecardLine("configuration", ++line); 257 llGetNotecardLine("configuration", ++line);
258 } 258 }
259 on_rez(integer num) { 259 on_rez(integer num) {
260 llResetScript(); 260 llResetScript();
261 } 261 }
262 changed(integer change) { 262 changed(integer change) {
263 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 263 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
264 llResetScript(); 264 llResetScript();
265 } 265 }
266 } 266 }
267 } 267 }
268   268  
269 state words { 269 state words {
270 state_entry() { 270 state_entry() {
271 if(llGetInventoryType("badwords") != INVENTORY_NOTECARD) { 271 if(llGetInventoryType("badwords") != INVENTORY_NOTECARD) {
272 llOwnerSay("Sorry, could not find a blacklist inventory notecard."); 272 llOwnerSay("Sorry, could not find a blacklist inventory notecard.");
273 return; 273 return;
274 } 274 }
275 // DEBUG 275 // DEBUG
276 llOwnerSay("Reading badwords notecard..."); 276 llOwnerSay("Reading badwords notecard...");
277 line = 0; 277 line = 0;
278 llGetNotecardLine("badwords", line); 278 llGetNotecardLine("badwords", line);
279 } 279 }
280 dataserver(key id, string data) { 280 dataserver(key id, string data) {
281 if(data == EOF) { 281 if(data == EOF) {
282 // DEBUG 282 // DEBUG
283 llOwnerSay("Read badwords notcard..."); 283 llOwnerSay("Read badwords notcard...");
284 state url; 284 state url;
285 } 285 }
286 if(data == "") jump continue; 286 if(data == "") jump continue;
287 badwords += data; 287 badwords += data;
288 @continue; 288 @continue;
289 llGetNotecardLine("badwords", ++line); 289 llGetNotecardLine("badwords", ++line);
290 } 290 }
291 on_rez(integer num) { 291 on_rez(integer num) {
292 llResetScript(); 292 llResetScript();
293 } 293 }
294 changed(integer change) { 294 changed(integer change) {
295 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 295 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
296 llResetScript(); 296 llResetScript();
297 } 297 }
298 } 298 }
299 } 299 }
300 300
301 state url { 301 state url {
302 state_entry() { 302 state_entry() {
303 // DEBUG 303 // DEBUG
304 llOwnerSay("Requesting URL..."); 304 llOwnerSay("Requesting URL...");
305 llRequestURL(); 305 llRequestURL();
306 } 306 }
307 http_request(key id, string method, string body) { 307 http_request(key id, string method, string body) {
308 if(method != URL_REQUEST_GRANTED) return; 308 if(method != URL_REQUEST_GRANTED) return;
309 callback = body; 309 callback = body;
310 // DEBUG 310 // DEBUG
311 llOwnerSay("Got URL..."); 311 llOwnerSay("Got URL...");
312 state detect; 312 state detect;
313 } 313 }
314 on_rez(integer num) { 314 on_rez(integer num) {
315 llResetScript(); 315 llResetScript();
316 } 316 }
317 changed(integer change) { 317 changed(integer change) {
318 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 318 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
319 llResetScript(); 319 llResetScript();
320 } 320 }
321 } 321 }
322 } 322 }
323 323
324 state detect { 324 state detect {
325 state_entry() { 325 state_entry() {
326 // DEBUG 326 // DEBUG
327 llOwnerSay("Detecting if Corrade is online..."); 327 llOwnerSay("Detecting if Corrade is online...");
328 llSetTimerEvent(5); 328 llSetTimerEvent(5);
329 } 329 }
330 timer() { 330 timer() {
331 llRequestAgentData((key)CORRADE, DATA_ONLINE); 331 llRequestAgentData((key)CORRADE, DATA_ONLINE);
332 } 332 }
333 dataserver(key id, string data) { 333 dataserver(key id, string data) {
334 if(data != "1") { 334 if(data != "1") {
335 // DEBUG 335 // DEBUG
336 llOwnerSay("Corrade is not online, sleeping..."); 336 llOwnerSay("Corrade is not online, sleeping...");
337 llSetTimerEvent(30); 337 llSetTimerEvent(30);
338 return; 338 return;
339 } 339 }
340 state notify; 340 state notify;
341 } 341 }
342 on_rez(integer num) { 342 on_rez(integer num) {
343 llResetScript(); 343 llResetScript();
344 } 344 }
345 changed(integer change) { 345 changed(integer change) {
346 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 346 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
347 llResetScript(); 347 llResetScript();
348 } 348 }
349 } 349 }
350 } 350 }
351 351
352 state notify { 352 state notify {
353 state_entry() { 353 state_entry() {
354 // DEBUG 354 // DEBUG
355 llOwnerSay("Binding to the group chat notification..."); 355 llOwnerSay("Binding to the group chat notification...");
356 llInstantMessage( 356 llInstantMessage(
357 (key)CORRADE, 357 (key)CORRADE,
358 wasKeyValueEncode( 358 wasKeyValueEncode(
359 [ 359 [
360 "command", "notify", 360 "command", "notify",
361 "group", wasURLEscape(GROUP), 361 "group", wasURLEscape(GROUP),
362 "password", wasURLEscape(PASSWORD), 362 "password", wasURLEscape(PASSWORD),
363 "action", "set", 363 "action", "set",
364 "type", "group", 364 "type", "group",
365 "URL", wasURLEscape(callback), 365 "URL", wasURLEscape(callback),
366 "callback", wasURLEscape(callback) 366 "callback", wasURLEscape(callback)
367 ] 367 ]
368 ) 368 )
369 ); 369 );
370 } 370 }
371 http_request(key id, string method, string body) { 371 http_request(key id, string method, string body) {
372 llHTTPResponse(id, 200, "OK"); 372 llHTTPResponse(id, 200, "OK");
373 if(wasKeyValueGet("command", body) != "notify" || 373 if(wasKeyValueGet("command", body) != "notify" ||
374 wasKeyValueGet("success", body) != "True") { 374 wasKeyValueGet("success", body) != "True") {
375 // DEBUG 375 // DEBUG
376 llOwnerSay("Failed to bind to the group chat notification..."); 376 llOwnerSay("Failed to bind to the group chat notification...");
377 state detect; 377 state detect;
378 } 378 }
379 // DEBUG 379 // DEBUG
380 llOwnerSay("Permission notification installed..."); 380 llOwnerSay("Permission notification installed...");
381 state main; 381 state main;
382 } 382 }
383 on_rez(integer num) { 383 on_rez(integer num) {
384 llResetScript(); 384 llResetScript();
385 } 385 }
386 changed(integer change) { 386 changed(integer change) {
387 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 387 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
388 llResetScript(); 388 llResetScript();
389 } 389 }
390 } 390 }
391 } 391 }
392   392  
393 state main { 393 state main {
394 state_entry() { 394 state_entry() {
395 // DEBUG 395 // DEBUG
396 llOwnerSay("Waiting for badwords..."); 396 llOwnerSay("Waiting for badwords...");
397 } 397 }
398 http_request(key id, string method, string body) { 398 http_request(key id, string method, string body) {
399 llHTTPResponse(id, 200, "OK"); 399 llHTTPResponse(id, 200, "OK");
400 400
401 // split the input 401 // split the input
402 list input = llParseString2List( 402 list input = llParseString2List(
403 wasURLUnescape( 403 wasURLUnescape(
404 wasKeyValueGet( 404 wasKeyValueGet(
405 "message", 405 "message",
406 body 406 body
407 ) 407 )
408 ), 408 ),
409 SPLIT, []); 409 SPLIT, []);
410 410
411 // now find badwords 411 // now find badwords
412 string badword = ""; 412 string badword = "";
413 do { 413 do {
414 badword = llList2String(input, 0); 414 badword = llList2String(input, 0);
415 if(llListFindList(badwords, (list)badword) != -1) jump punish; 415 if(llListFindList(badwords, (list)badword) != -1) jump punish;
416 input = llDeleteSubList(input, 0, 0); 416 input = llDeleteSubList(input, 0, 0);
417 } while(llGetListLength(input) != 0); 417 } while(llGetListLength(input) != 0);
418 return; 418 return;
419 419
420 @punish; 420 @punish;
421   421  
422 string firstname = wasURLUnescape(wasKeyValueGet("firstname", body)); 422 string firstname = wasURLUnescape(wasKeyValueGet("firstname", body));
423 string lastname = wasURLUnescape(wasKeyValueGet("lastname", body)); 423 string lastname = wasURLUnescape(wasKeyValueGet("lastname", body));
424 424
425 if(PUNISHMENT == "eject") { 425 if(PUNISHMENT == "eject") {
426 llOwnerSay("Ejecting: " + firstname + " " + lastname); 426 llOwnerSay("Ejecting: " + firstname + " " + lastname);
427 llInstantMessage((key)CORRADE, 427 llInstantMessage((key)CORRADE,
428 wasKeyValueEncode( 428 wasKeyValueEncode(
429 [ 429 [
430 "command", "eject", 430 "command", "eject",
431 "group", wasURLEscape(GROUP), 431 "group", wasURLEscape(GROUP),
432 "password", wasURLEscape(PASSWORD), 432 "password", wasURLEscape(PASSWORD),
433 "firstname", wasURLEscape(firstname), 433 "firstname", wasURLEscape(firstname),
434 "lastname", wasURLEscape(lastname) 434 "lastname", wasURLEscape(lastname)
435 ] 435 ]
436 ) 436 )
437 ); 437 );
438 jump announce; 438 jump announce;
439 } 439 }
440 440
441 llOwnerSay("Muting: " + firstname + " " + lastname); 441 llOwnerSay("Muting: " + firstname + " " + lastname);
442 llInstantMessage((key)CORRADE, 442 llInstantMessage((key)CORRADE,
443 wasKeyValueEncode( 443 wasKeyValueEncode(
444 [ 444 [
445 "command", "moderate", 445 "command", "moderate",
446 "group", wasURLEscape(GROUP), 446 "group", wasURLEscape(GROUP),
447 "password", wasURLEscape(PASSWORD), 447 "password", wasURLEscape(PASSWORD),
448 "firstname", wasURLEscape(firstname), 448 "firstname", wasURLEscape(firstname),
449 "lastname", wasURLEscape(lastname), 449 "lastname", wasURLEscape(lastname),
450 "type", "text", 450 "type", "text",
451 "silence", "true" 451 "silence", "true"
452 ] 452 ]
453 ) 453 )
454 ); 454 );
455 455
456 @announce; 456 @announce;
457   457  
458 // Go through the list of avatars to announce and 458 // Go through the list of avatars to announce and
459 // tell them who has been ajected and for what word 459 // tell them who has been ajected and for what word
460 integer i = llGetListLength(ANNOUNCE)-1; 460 integer i = llGetListLength(ANNOUNCE)-1;
461 do { 461 do {
462 string full = llList2String(ANNOUNCE, i); 462 string full = llList2String(ANNOUNCE, i);
463 list name = llParseString2List(full, [" "], []); 463 list name = llParseString2List(full, [" "], []);
464 llInstantMessage((key)CORRADE, 464 llInstantMessage((key)CORRADE,
465 wasKeyValueEncode( 465 wasKeyValueEncode(
466 [ 466 [
467 "command", "tell", 467 "command", "tell",
468 "group", wasURLEscape(GROUP), 468 "group", wasURLEscape(GROUP),
469 "password", wasURLEscape(PASSWORD), 469 "password", wasURLEscape(PASSWORD),
470 "entity", "avatar", 470 "entity", "avatar",
471 "firstname", wasURLEscape(llList2String(name, 0)), 471 "firstname", wasURLEscape(llList2String(name, 0)),
472 "lastname", wasURLEscape(llList2String(name, 1)), 472 "lastname", wasURLEscape(llList2String(name, 1)),
473 "message", wasURLEscape( 473 "message", wasURLEscape(
474 "The avatar " + 474 "The avatar " +
475 firstname + 475 firstname +
476 " " + 476 " " +
477 lastname + 477 lastname +
478 " was ejecteded from: " + 478 " was ejecteded from: " +
479 GROUP + " for saying: \"" + 479 GROUP + " for saying: \"" +
480 badword + "\"." 480 badword + "\"."
481 ) 481 )
482 ] 482 ]
483 ) 483 )
484 ); 484 );
485 } while(--i>-1); 485 } while(--i>-1);
486 } 486 }
487 on_rez(integer num) { 487 on_rez(integer num) {
488 llResetScript(); 488 llResetScript();
489 } 489 }
490 changed(integer change) { 490 changed(integer change) {
491 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) { 491 if((change & CHANGED_INVENTORY) || (change & CHANGED_REGION_START)) {
492 llResetScript(); 492 llResetScript();
493 } 493 }
494 } 494 }
495 } 495 }
496   496