corrade-lsl-templates – Diff between revs 8 and 10

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 8 Rev 10
1 /////////////////////////////////////////////////////////////////////////// 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 // 2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 //
3 /////////////////////////////////////////////////////////////////////////// 3 ///////////////////////////////////////////////////////////////////////////
4 // 4 //
5 // A module that invites people to the group members. 5 // A module that invites people to the group members.
6 // 6 //
7 /////////////////////////////////////////////////////////////////////////// 7 ///////////////////////////////////////////////////////////////////////////
8   8  
9 /////////////////////////////////////////////////////////////////////////// 9 ///////////////////////////////////////////////////////////////////////////
10 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 // 10 // Copyright (C) 2014 Wizardry and Steamworks - License: GNU GPLv3 //
11 /////////////////////////////////////////////////////////////////////////// 11 ///////////////////////////////////////////////////////////////////////////
12 string wasKeyValueGet(string k, string data) { 12 string wasKeyValueGet(string k, string data) {
13 if(llStringLength(data) == 0) return ""; 13 if(llStringLength(data) == 0) return "";
14 if(llStringLength(k) == 0) return ""; 14 if(llStringLength(k) == 0) return "";
15 list a = llParseString2List(data, ["&", "="], []); 15 list a = llParseString2List(data, ["&", "="], []);
16 integer i = llListFindList(a, [ k ]); 16 integer i = llListFindList(a, [ k ]);
17 if(i != -1) return llList2String(a, i+1); 17 if(i != -1) return llList2String(a, i+1);
18 return ""; 18 return "";
19 } 19 }
20 20
21 /////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////
22 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 // 22 // Copyright (C) 2013 Wizardry and Steamworks - License: GNU GPLv3 //
23 /////////////////////////////////////////////////////////////////////////// 23 ///////////////////////////////////////////////////////////////////////////
24 string wasKeyValueEncode(list data) { 24 string wasKeyValueEncode(list data) {
25 list k = llList2ListStrided(data, 0, -1, 2); 25 list k = llList2ListStrided(data, 0, -1, 2);
26 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2); 26 list v = llList2ListStrided(llDeleteSubList(data, 0, 0), 0, -1, 2);
27 data = []; 27 data = [];
28 do { 28 do {
29 data += llList2String(k, 0) + "=" + llList2String(v, 0); 29 data += llList2String(k, 0) + "=" + llList2String(v, 0);
30 k = llDeleteSubList(k, 0, 0); 30 k = llDeleteSubList(k, 0, 0);
31 v = llDeleteSubList(v, 0, 0); 31 v = llDeleteSubList(v, 0, 0);
32 } while(llGetListLength(k) != 0); 32 } while(llGetListLength(k) != 0);
33 return llDumpList2String(data, "&"); 33 return llDumpList2String(data, "&");
34 } 34 }
35   35  
36 /////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////
37 // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 // 37 // Copyright (C) 2011 Wizardry and Steamworks - License: GNU GPLv3 //
38 /////////////////////////////////////////////////////////////////////////// 38 ///////////////////////////////////////////////////////////////////////////
39 // http://was.fm/secondlife/wanderer 39 // http://was.fm/secondlife/wanderer
40 vector wasCirclePoint(float radius) { 40 vector wasCirclePoint(float radius) {
41 float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); 41 float x = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2);
42 float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2); 42 float y = llPow(-1, 1 + (integer) llFrand(2)) * llFrand(radius*2);
43 if(llPow(x,2) + llPow(y,2) <= llPow(radius,2)) 43 if(llPow(x,2) + llPow(y,2) <= llPow(radius,2))
44 return <x, y, 0>; 44 return <x, y, 0>;
45 return wasCirclePoint(radius); 45 return wasCirclePoint(radius);
46 } 46 }
47   47  
48 /////////////////////////////////////////////////////////////////////////// 48 ///////////////////////////////////////////////////////////////////////////
49 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 49 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 //
50 /////////////////////////////////////////////////////////////////////////// 50 ///////////////////////////////////////////////////////////////////////////
51 // escapes a string in conformance with RFC1738 51 // escapes a string in conformance with RFC1738
52 string wasURLEscape(string i) { 52 string wasURLEscape(string i) {
53 string o = ""; 53 string o = "";
54 do { 54 do {
55 string c = llGetSubString(i, 0, 0); 55 string c = llGetSubString(i, 0, 0);
56 i = llDeleteSubString(i, 0, 0); 56 i = llDeleteSubString(i, 0, 0);
57 if(c == "") jump continue; 57 if(c == "") jump continue;
58 if(c == " ") { 58 if(c == " ") {
59 o += "+"; 59 o += "+";
60 jump continue; 60 jump continue;
61 } 61 }
62 if(c == "\n") { 62 if(c == "\n") {
63 o += "%0D" + llEscapeURL(c); 63 o += "%0D" + llEscapeURL(c);
64 jump continue; 64 jump continue;
65 } 65 }
66 o += llEscapeURL(c); 66 o += llEscapeURL(c);
67 @continue; 67 @continue;
68 } while(i != ""); 68 } while(i != "");
69 return o; 69 return o;
70 } 70 }
71   71  
72 /////////////////////////////////////////////////////////////////////////// 72 ///////////////////////////////////////////////////////////////////////////
73 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 73 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 //
74 /////////////////////////////////////////////////////////////////////////// 74 ///////////////////////////////////////////////////////////////////////////
75 list wasCSVToList(string csv) { 75 list wasCSVToList(string csv) {
76 list l = []; 76 list l = [];
77 list s = []; 77 list s = [];
78 string m = ""; 78 string m = "";
79 do { 79 do {
80 string a = llGetSubString(csv, 0, 0); 80 string a = llGetSubString(csv, 0, 0);
81 csv = llDeleteSubString(csv, 0, 0); 81 csv = llDeleteSubString(csv, 0, 0);
82 if(a == ",") { 82 if(a == ",") {
83 if(llList2String(s, -1) != "\"") { 83 if(llList2String(s, -1) != "\"") {
84 l += m; 84 l += m;
85 m = ""; 85 m = "";
86 jump continue; 86 jump continue;
87 } 87 }
88 m += a; 88 m += a;
89 jump continue; 89 jump continue;
90 } 90 }
91 if(a == "\"" && llGetSubString(csv, 0, 0) == a) { 91 if(a == "\"" && llGetSubString(csv, 0, 0) == a) {
92 m += a; 92 m += a;
93 csv = llDeleteSubString(csv, 0, 0); 93 csv = llDeleteSubString(csv, 0, 0);
94 jump continue; 94 jump continue;
95 } 95 }
96 if(a == "\"") { 96 if(a == "\"") {
97 if(llList2String(s, -1) != a) { 97 if(llList2String(s, -1) != a) {
98 s += a; 98 s += a;
99 jump continue; 99 jump continue;
100 } 100 }
101 s = llDeleteSubList(s, -1, -1); 101 s = llDeleteSubList(s, -1, -1);
102 jump continue; 102 jump continue;
103 } 103 }
104 m += a; 104 m += a;
105 @continue; 105 @continue;
106 } while(csv != ""); 106 } while(csv != "");
107 // postcondition: length(s) = 0 107 // postcondition: length(s) = 0
108 return l + m; 108 return l + m;
109 } 109 }
110   110  
111 /////////////////////////////////////////////////////////////////////////// 111 ///////////////////////////////////////////////////////////////////////////
112 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 112 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 //
113 /////////////////////////////////////////////////////////////////////////// 113 ///////////////////////////////////////////////////////////////////////////
114 string wasListToCSV(list l) { 114 string wasListToCSV(list l) {
115 list v = []; 115 list v = [];
116 do { 116 do {
117 string a = llDumpList2String( 117 string a = llDumpList2String(
118 llParseStringKeepNulls( 118 llParseStringKeepNulls(
119 llList2String( 119 llList2String(
120 l, 120 l,
121 0 121 0
122 ), 122 ),
123 ["\""], 123 ["\""],
124 [] 124 []
125 ), 125 ),
126 "\"\"" 126 "\"\""
127 ); 127 );
128 if(llParseStringKeepNulls( 128 if(llParseStringKeepNulls(
129 a, 129 a,
130 [" ", ",", "\n", "\""], [] 130 [" ", ",", "\n", "\""], []
131 ) != 131 ) !=
132 (list) a 132 (list) a
133 ) a = "\"" + a + "\""; 133 ) a = "\"" + a + "\"";
134 v += a; 134 v += a;
135 l = llDeleteSubList(l, 0, 0); 135 l = llDeleteSubList(l, 0, 0);
136 } while(l != []); 136 } while(l != []);
137 return llDumpList2String(v, ","); 137 return llDumpList2String(v, ",");
138 } 138 }
139   139  
140 /////////////////////////////////////////////////////////////////////////// 140 ///////////////////////////////////////////////////////////////////////////
141 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 // 141 // Copyright (C) 2015 Wizardry and Steamworks - License: GNU GPLv3 //
142 /////////////////////////////////////////////////////////////////////////// 142 ///////////////////////////////////////////////////////////////////////////
143 // unescapes a string in conformance with RFC1738 143 // unescapes a string in conformance with RFC1738
144 string wasURLUnescape(string i) { 144 string wasURLUnescape(string i) {
145 return llUnescapeURL( 145 return llUnescapeURL(
146 llDumpList2String( 146 llDumpList2String(
147 llParseString2List( 147 llParseString2List(
148 llDumpList2String( 148 llDumpList2String(
149 llParseString2List( 149 llParseString2List(
150 i, 150 i,
151 ["+"], 151 ["+"],
152 [] 152 []
153 ), 153 ),
154 " " 154 " "
155 ), 155 ),
156 ["%0D%0A"], 156 ["%0D%0A"],
157 [] 157 []
158 ), 158 ),
159 "\n" 159 "\n"
160 ) 160 )
161 ); 161 );
162 } 162 }
163   163  
164 // configuration data 164 // configuration data
165 string configuration = ""; 165 string configuration = "";
166 // callback URL 166 // callback URL
167 string URL = ""; 167 string URL = "";
168 // store message over state. 168 // store message over state.
169 string data = ""; 169 string data = "";
170 string firstname = ""; 170 string firstname = "";
171 string lastname = ""; 171 string lastname = "";
172   172  
173 default { 173 default {
174 state_entry() { 174 state_entry() {
175 llOwnerSay("[Invite] Starting..."); 175 llOwnerSay("[Invite] Starting...");
176 llSetTimerEvent(10); 176 llSetTimerEvent(10);
177 } 177 }
178 link_message(integer sender, integer num, string message, key id) { 178 link_message(integer sender, integer num, string message, key id) {
179 if(id != "configuration") return; 179 if(id != "configuration") return;
180 llOwnerSay("[Invite] Got configuration..."); 180 llOwnerSay("[Invite] Got configuration...");
181 configuration = message; 181 configuration = message;
182 state listen_group; 182 state listen_group;
183 } 183 }
184 timer() { 184 timer() {
185 llOwnerSay("[Invite] Requesting configuration..."); 185 llOwnerSay("[Invite] Requesting configuration...");
186 llMessageLinked(LINK_THIS, 0, "configuration", NULL_KEY); 186 llMessageLinked(LINK_THIS, 0, "configuration", NULL_KEY);
187 } 187 }
188 on_rez(integer num) { 188 on_rez(integer num) {
189 llResetScript(); 189 llResetScript();
190 } 190 }
191 changed(integer change) { 191 changed(integer change) {
192 if((change & CHANGED_INVENTORY) || 192 if((change & CHANGED_INVENTORY) ||
193 (change & CHANGED_REGION_START) || 193 (change & CHANGED_REGION_START) ||
194 (change & CHANGED_OWNER)) { 194 (change & CHANGED_OWNER)) {
195 llResetScript(); 195 llResetScript();
196 } 196 }
197 } 197 }
198 state_exit() { 198 state_exit() {
199 llSetTimerEvent(0); 199 llSetTimerEvent(0);
200 } 200 }
201 } 201 }
202   202  
203 state listen_group { 203 state listen_group {
204 state_entry() { 204 state_entry() {
205 // DEBUG 205 // DEBUG
206 llOwnerSay("[Invite] Waiting for group messages..."); 206 llOwnerSay("[Invite] Waiting for group messages...");
207 } 207 }
208 link_message(integer sender, integer num, string message, key id) { 208 link_message(integer sender, integer num, string message, key id) {
209 // We only care about notifications now. 209 // We only care about notifications now.
210 if(id != "notification") 210 if(id != "notification")
211 return; 211 return;
212 212
213 // This script only processes group notifications. 213 // This script only processes group notifications.
214 if(wasKeyValueGet("type", message) != "group") 214 if(wasKeyValueGet("type", message) != "group")
215 return; 215 return;
216 216
217 // Get the sent message. 217 // Get the sent message.
218 data = wasURLUnescape( 218 data = wasURLUnescape(
219 wasKeyValueGet( 219 wasKeyValueGet(
220 "message", 220 "message",
221 message 221 message
222 ) 222 )
223 ); 223 );
224 224
225 if(llGetSubString(data, 0, 0) != 225 if(llGetSubString(data, 0, 0) !=
226 wasKeyValueGet("command", configuration)) 226 wasKeyValueGet("command", configuration))
227 return; 227 return;
228 228
-   229 list command = llParseString2List(data,
229 list command = llParseString2List(data, ["@", " "], []); 230 [wasKeyValueGet("command", configuration), " "], []);
230 if(llList2String(command, 0) != "invite") 231 if(llList2String(command, 0) != "invite")
231 return; 232 return;
232 233
233 // Remove command. 234 // Remove command.
234 command = llDeleteSubList(command, 0, 0); 235 command = llDeleteSubList(command, 0, 0);
235 236
236 // Dump the rest of the message. 237 // Dump the rest of the message.
237 data = llDumpList2String(command, " "); 238 data = llDumpList2String(command, " ");
238 239
239 // Get an URL. 240 // Get an URL.
240 state url; 241 state url;
241 } 242 }
242 on_rez(integer num) { 243 on_rez(integer num) {
243 llResetScript(); 244 llResetScript();
244 } 245 }
245 changed(integer change) { 246 changed(integer change) {
246 if((change & CHANGED_INVENTORY) || 247 if((change & CHANGED_INVENTORY) ||
247 (change & CHANGED_REGION_START) || 248 (change & CHANGED_REGION_START) ||
248 (change & CHANGED_OWNER)) { 249 (change & CHANGED_OWNER)) {
249 llResetScript(); 250 llResetScript();
250 } 251 }
251 } 252 }
252 } 253 }
253   254  
254 state url { 255 state url {
255 state_entry() { 256 state_entry() {
256 // DEBUG 257 // DEBUG
257 llOwnerSay("[Invite] Requesting URL..."); 258 llOwnerSay("[Invite] Requesting URL...");
258 llRequestURL(); 259 llRequestURL();
259 } 260 }
260 http_request(key id, string method, string body) { 261 http_request(key id, string method, string body) {
261 if(method != URL_REQUEST_GRANTED) return; 262 if(method != URL_REQUEST_GRANTED) return;
262 URL = body; 263 URL = body;
263 // DEBUG 264 // DEBUG
264 llOwnerSay("[Invite] Got URL..."); 265 llOwnerSay("[Invite] Got URL...");
265 state search; 266 state search;
266 } 267 }
267 on_rez(integer num) { 268 on_rez(integer num) {
268 llResetScript(); 269 llResetScript();
269 } 270 }
270 changed(integer change) { 271 changed(integer change) {
271 if((change & CHANGED_INVENTORY) || 272 if((change & CHANGED_INVENTORY) ||
272 (change & CHANGED_REGION_START) || 273 (change & CHANGED_REGION_START) ||
273 (change & CHANGED_OWNER)) { 274 (change & CHANGED_OWNER)) {
274 llResetScript(); 275 llResetScript();
275 } 276 }
276 } 277 }
277 } 278 }
278   279  
279 state search { 280 state search {
280 state_entry() { 281 state_entry() {
281 // DEBUG 282 // DEBUG
282 llOwnerSay("[Invite] Searching for agent."); 283 llOwnerSay("[Invite] Searching for agent.");
283 llInstantMessage( 284 llInstantMessage(
284 wasKeyValueGet( 285 wasKeyValueGet(
285 "corrade", 286 "corrade",
286 configuration 287 configuration
287 ), 288 ),
288 wasKeyValueEncode( 289 wasKeyValueEncode(
289 [ 290 [
290 "command", "directorysearch", 291 "command", "directorysearch",
291 "group", wasURLEscape( 292 "group", wasURLEscape(
292 wasKeyValueGet( 293 wasKeyValueGet(
293 "group", 294 "group",
294 configuration 295 configuration
295 ) 296 )
296 ), 297 ),
297 "password", wasURLEscape( 298 "password", wasURLEscape(
298 wasKeyValueGet( 299 wasKeyValueGet(
299 "password", 300 "password",
300 configuration 301 configuration
301 ) 302 )
302 ), 303 ),
303 "type", "people", 304 "type", "people",
304 "name", wasURLEscape(data), 305 "name", wasURLEscape(data),
305 /*"sift", wasURLEscape( 306 /*"sift", wasURLEscape(
306 wasListToCSV( 307 wasListToCSV(
307 [ 308 [
308 "match", 309 "match",
309 wasURLEscape("(?i),?([^,$]*" + data +"[^,$]*),?") 310 wasURLEscape("(?i),?([^,$]*" + data +"[^,$]*),?")
310 ] 311 ]
311 ) 312 )
312 ),*/ 313 ),*/
313 "callback", wasURLEscape(URL) 314 "callback", wasURLEscape(URL)
314 ] 315 ]
315 ) 316 )
316 ); 317 );
317 llSetTimerEvent(60); 318 llSetTimerEvent(60);
318 } 319 }
319 http_request(key id, string method, string body) { 320 http_request(key id, string method, string body) {
320 llHTTPResponse(id, 200, "OK"); 321 llHTTPResponse(id, 200, "OK");
321 if(wasKeyValueGet("command", body) != "directorysearch" || 322 if(wasKeyValueGet("command", body) != "directorysearch" ||
322 wasKeyValueGet("success", body) != "True") { 323 wasKeyValueGet("success", body) != "True") {
323 // DEBUG 324 // DEBUG
324 llOwnerSay("[Invite] Unable to search for agent: " + 325 llOwnerSay("[Invite] Unable to search for agent: " +
325 wasURLUnescape( 326 wasURLUnescape(
326 wasKeyValueGet("error", body) 327 wasKeyValueGet("error", body)
327 ) 328 )
328 ); 329 );
329 llReleaseURL(URL); 330 llReleaseURL(URL);
330 state listen_group; 331 state listen_group;
331 } 332 }
332 333
333 list first_last = llParseString2List(data, [" "], []); 334 list first_last = llParseString2List(data, [" "], []);
334 firstname = llList2String(first_last, 0); 335 firstname = llList2String(first_last, 0);
335 lastname = llList2String(first_last, 1); 336 lastname = llList2String(first_last, 1);
336 337
337 list found_agent = wasCSVToList( 338 list found_agent = wasCSVToList(
338 wasURLUnescape( 339 wasURLUnescape(
339 wasKeyValueGet("data", body) 340 wasKeyValueGet("data", body)
340 ) 341 )
341 ); 342 );
342 343
343 if(llToUpper( 344 if(llToUpper(
344 llList2String( 345 llList2String(
345 found_agent, 346 found_agent,
346 llListFindList( 347 llListFindList(
347 found_agent, 348 found_agent,
348 (list)"FirstName" 349 (list)"FirstName"
349 ) + 1 350 ) + 1
350 ) 351 )
351 ) != llToUpper(firstname) || 352 ) != llToUpper(firstname) ||
352 llToUpper( 353 llToUpper(
353 llList2String( 354 llList2String(
354 found_agent, 355 found_agent,
355 llListFindList( 356 llListFindList(
356 found_agent, 357 found_agent,
357 (list)"LastName" 358 (list)"LastName"
358 ) + 1 359 ) + 1
359 ) 360 )
360 ) != llToUpper(lastname)) { 361 ) != llToUpper(lastname)) {
361 data = "Agent not found."; 362 data = "Agent not found.";
362 llReleaseURL(URL); 363 llReleaseURL(URL);
363 state tell; 364 state tell;
364 } 365 }
365 366
366 state invite; 367 state invite;
367 } 368 }
368 timer() { 369 timer() {
369 llReleaseURL(URL); 370 llReleaseURL(URL);
370 state listen_group; 371 state listen_group;
371 } 372 }
372 on_rez(integer num) { 373 on_rez(integer num) {
373 llResetScript(); 374 llResetScript();
374 } 375 }
375 changed(integer change) { 376 changed(integer change) {
376 if((change & CHANGED_INVENTORY) || 377 if((change & CHANGED_INVENTORY) ||
377 (change & CHANGED_REGION_START) || 378 (change & CHANGED_REGION_START) ||
378 (change & CHANGED_OWNER)) { 379 (change & CHANGED_OWNER)) {
379 llResetScript(); 380 llResetScript();
380 } 381 }
381 } 382 }
382 state_exit() { 383 state_exit() {
383 llSetTimerEvent(0); 384 llSetTimerEvent(0);
384 } 385 }
385 } 386 }
386   387  
387 state invite { 388 state invite {
388 state_entry() { 389 state_entry() {
389 // DEBUG 390 // DEBUG
390 llOwnerSay("[Invite] inviting..."); 391 llOwnerSay("[Invite] inviting...");
391 llInstantMessage( 392 llInstantMessage(
392 wasKeyValueGet( 393 wasKeyValueGet(
393 "corrade", 394 "corrade",
394 configuration 395 configuration
395 ), 396 ),
396 wasKeyValueEncode( 397 wasKeyValueEncode(
397 [ 398 [
398 "command", "invite", 399 "command", "invite",
399 "group", wasURLEscape( 400 "group", wasURLEscape(
400 wasKeyValueGet( 401 wasKeyValueGet(
401 "group", 402 "group",
402 configuration 403 configuration
403 ) 404 )
404 ), 405 ),
405 "password", wasURLEscape( 406 "password", wasURLEscape(
406 wasKeyValueGet( 407 wasKeyValueGet(
407 "password", 408 "password",
408 configuration 409 configuration
409 ) 410 )
410 ), 411 ),
411 "firstname", firstname, 412 "firstname", firstname,
412 "lastname", lastname, 413 "lastname", lastname,
413 "soft", "True", 414 "soft", "True",
414 "verify", "False", 415 "verify", "False",
415 "callback", wasURLEscape(URL) 416 "callback", wasURLEscape(URL)
416 ] 417 ]
417 ) 418 )
418 ); 419 );
419 llSetTimerEvent(60); 420 llSetTimerEvent(60);
420 } 421 }
421 http_request(key id, string method, string body) { 422 http_request(key id, string method, string body) {
422 llHTTPResponse(id, 200, "OK"); 423 llHTTPResponse(id, 200, "OK");
423 llReleaseURL(URL); 424 llReleaseURL(URL);
424 if(wasKeyValueGet("command", body) != "invite" || 425 if(wasKeyValueGet("command", body) != "invite" ||
425 wasKeyValueGet("success", body) != "True") { 426 wasKeyValueGet("success", body) != "True") {
426 // DEBUG 427 // DEBUG
427 llOwnerSay("[Eject] Unable to invite agent: " + 428 llOwnerSay("[Eject] Unable to invite agent: " +
428 wasURLUnescape( 429 wasURLUnescape(
429 wasKeyValueGet("error", body) 430 wasKeyValueGet("error", body)
430 ) 431 )
431 ); 432 );
432 state listen_group; 433 state listen_group;
433 } 434 }
434 435
435 data = "Butters (Jym) was sent to pick them up!"; 436 data = "Butters (Jym) was sent to pick them up!";
436 437
437 state tell; 438 state tell;
438 } 439 }
439 timer() { 440 timer() {
440 llReleaseURL(URL); 441 llReleaseURL(URL);
441 state listen_group; 442 state listen_group;
442 } 443 }
443 on_rez(integer num) { 444 on_rez(integer num) {
444 llResetScript(); 445 llResetScript();
445 } 446 }
446 changed(integer change) { 447 changed(integer change) {
447 if((change & CHANGED_INVENTORY) || 448 if((change & CHANGED_INVENTORY) ||
448 (change & CHANGED_REGION_START) || 449 (change & CHANGED_REGION_START) ||
449 (change & CHANGED_OWNER)) { 450 (change & CHANGED_OWNER)) {
450 llResetScript(); 451 llResetScript();
451 } 452 }
452 } 453 }
453 state_exit() { 454 state_exit() {
454 llSetTimerEvent(0); 455 llSetTimerEvent(0);
455 } 456 }
456 } 457 }
457   458  
458 state tell { 459 state tell {
459 state_entry() { 460 state_entry() {
460 // DEBUG 461 // DEBUG
461 llOwnerSay("[Invite] Sending to group."); 462 llOwnerSay("[Invite] Sending to group.");
462 llInstantMessage( 463 llInstantMessage(
463 wasKeyValueGet( 464 wasKeyValueGet(
464 "corrade", 465 "corrade",
465 configuration 466 configuration
466 ), 467 ),
467 wasKeyValueEncode( 468 wasKeyValueEncode(
468 [ 469 [
469 "command", "tell", 470 "command", "tell",
470 "group", wasURLEscape( 471 "group", wasURLEscape(
471 wasKeyValueGet( 472 wasKeyValueGet(
472 "group", 473 "group",
473 configuration 474 configuration
474 ) 475 )
475 ), 476 ),
476 "password", wasURLEscape( 477 "password", wasURLEscape(
477 wasKeyValueGet( 478 wasKeyValueGet(
478 "password", 479 "password",
479 configuration 480 configuration
480 ) 481 )
481 ), 482 ),
482 "entity", "group", 483 "entity", "group",
483 "message", wasURLEscape(data) 484 "message", wasURLEscape(data)
484 ] 485 ]
485 ) 486 )
486 ); 487 );
487 state listen_group; 488 state listen_group;
488 } 489 }
489 } 490 }
490   491