aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/1AOor2.lsl
diff options
context:
space:
mode:
authoronefang2021-09-06 21:15:36 +1000
committeronefang2021-09-06 21:15:36 +1000
commit10e2f77d57ecc5e306900b112d70c2600f941ae4 (patch)
treee634b6ac7d20886b9fe256b8c69696a011e4e0b6 /1AOor2.lsl
parentOops, left this out of the OhSilly sit commit. (diff)
download1ring-10e2f77d57ecc5e306900b112d70c2600f941ae4.zip
1ring-10e2f77d57ecc5e306900b112d70c2600f941ae4.tar.gz
1ring-10e2f77d57ecc5e306900b112d70c2600f941ae4.tar.bz2
1ring-10e2f77d57ecc5e306900b112d70c2600f941ae4.tar.xz
Various common tweaks.
New instant message logger. Check if a prim still exists before sending it a message. New dynamic menu return option. Check menu commands at startup.
Diffstat (limited to '1AOor2.lsl')
-rw-r--r--1AOor2.lsl77
1 files changed, 70 insertions, 7 deletions
diff --git a/1AOor2.lsl b/1AOor2.lsl
index 111a3d5..e336ab7 100644
--- a/1AOor2.lsl
+++ b/1AOor2.lsl
@@ -45,6 +45,8 @@ integer lSUBSTITUTE = -7;
45integer lSUBSTITUTE_DONE = -8; 45integer lSUBSTITUTE_DONE = -8;
46integer lNEXT_WORD = -9; 46integer lNEXT_WORD = -9;
47integer lNEXT_WORD_DONE = -10; 47integer lNEXT_WORD_DONE = -10;
48integer lCHECK = -11;
49integer lCHECK_DONE = -12;
48integer lCONTROL = -13; 50integer lCONTROL = -13;
49integer lCONTROL_DONE = -14; 51integer lCONTROL_DONE = -14;
50integer lCMD = -15; 52integer lCMD = -15;
@@ -64,6 +66,7 @@ d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);}
64D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} 66D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);}
65s(string m) {s(Owner, m);} 67s(string m) {s(Owner, m);}
66s(key id, string m) {if (id == Owner) llOwnerSay(m); else llInstantMessage(id, m);} 68s(key id, string m) {if (id == Owner) llOwnerSay(m); else llInstantMessage(id, m);}
69S(string m) {llInstantMessage(Owner, llGetScriptName() + ": " + m);}
67sendScript(integer cmd, list args) {sendScript(LibraryKey, cmd, ScriptName, args);} 70sendScript(integer cmd, list args) {sendScript(LibraryKey, cmd, ScriptName, args);}
68sendScript(key them, integer cmd, list args) {sendScript(them, cmd, inKey2Name(them), args);} 71sendScript(key them, integer cmd, list args) {sendScript(them, cmd, inKey2Name(them), args);}
69sendScript(integer cmd, string name, list args) {sendScript(LibraryKey, cmd, name, args);} 72sendScript(integer cmd, string name, list args) {sendScript(LibraryKey, cmd, name, args);}
@@ -71,9 +74,16 @@ sendScript(key them, integer cmd, string name, list args)
71{ 74{
72 llMessageLinked(LINK_SET, cmd, llDumpList2String([ScriptKey, name] + args, lSEP), them); 75 llMessageLinked(LINK_SET, cmd, llDumpList2String([ScriptKey, name] + args, lSEP), them);
73} 76}
77integer pingPrim(key k)
78{
79 if (NULL_KEY != k)
80 return (0 != llGetListLength(llGetObjectDetails(k, [OBJECT_DESC])));
81 return FALSE;
82}
74sendPrim(key them, string cmd, list args) 83sendPrim(key them, string cmd, list args)
75{ 84{
76 osMessageObject(them, llDumpList2String([ScriptName, cmd] + args, lSEP)); 85 if (pingPrim(them))
86 osMessageObject(them, llDumpList2String([ScriptName, cmd] + args, lSEP));
77} 87}
78addEvent(float delay, string cmds) 88addEvent(float delay, string cmds)
79{ 89{
@@ -188,7 +198,11 @@ list readCard(string card)
188 198
189dynamicMenu(key id, string menu, string name, string title, string entries, string command) 199dynamicMenu(key id, string menu, string name, string title, string entries, string command)
190{ 200{
191 sendScript(lDYNAMIC, [id, menu, name, title, entries, command]); 201 dynamicMenu(id, menu, name, title, entries, command, 1);
202}
203dynamicMenu(key id, string menu, string name, string title, string entries, string command, integer ret)
204{
205 sendScript(lDYNAMIC, [id, menu, name, title, entries, command, ret]);
192} 206}
193 207
194integer Chosen; 208integer Chosen;
@@ -206,16 +220,27 @@ linky(integer num, string message, key id)
206 key them = llList2Key(input, 0); 220 key them = llList2Key(input, 0);
207 string fr = llList2Key(input, 1); 221 string fr = llList2Key(input, 1);
208//d("linky " + num + " " + message); 222//d("linky " + num + " " + message);
209 if (lCMD == num) 223 if ((lCHECK == num) || (lCMD == num))
210 { 224 {
211//d("link CHAT " + llDumpList2String(input, " ~ "));
212 if ((fr == (ScriptName + ".")) || (fr == "*.")) 225 if ((fr == (ScriptName + ".")) || (fr == "*."))
213 { 226 {
214 key a = llList2Key(input, 3); 227 key a = llList2Key(input, 3);
215 string button = llList2String(input, 4); 228 string button = llList2String(input, 4);
216 integer r = doThing(a, button, fr, 229 integer r;
230 if (lCHECK == num)
231 {
232//d("link CHECK " + llDumpList2String(input, " ~ "));
233 r = checkThing(a, button, fr,
217 llList2String(input, 5), llList2String(input, 6), llList2Integer(input, 2)); 234 llList2String(input, 5), llList2String(input, 6), llList2Integer(input, 2));
218 sendScript(lCMD_DONE, [button, a, r]); 235 sendScript(num - 1, [llList2String(input, 6), a, r]);
236 }
237 else
238 {
239//d("link CHAT " + llDumpList2String(input, " ~ "));
240 r = doThing(a, button, fr,
241 llList2String(input, 5), llList2String(input, 6), llList2Integer(input, 2));
242 sendScript(num - 1, [button, a, r]);
243 }
219 } 244 }
220 } 245 }
221 else if (lRESET_DONE == num) 246 else if (lRESET_DONE == num)
@@ -237,6 +262,44 @@ d("linky RESET_DONE");
237} 262}
238// END boilerplate, mostly. 263// END boilerplate, mostly.
239 264
265integer checkThing(key id, string button, string fr, string cmd, string data, integer source)
266{
267 if ((fr != (ScriptName + ".") && ("*." != fr))) return TRUE;
268 if (("POSE" == cmd) || ("SINGLE_POSE" == cmd))
269 {
270//d("CHECKING " + data);
271 // POSE piggyback,~,piggyback-sit
272 list p = llParseStringKeepNulls(llGetSubString(data, 5, -1), [",", "|"], []);
273 string name = llList2String(p, 0);
274 integer l = llGetListLength(p);
275 integer i;
276
277 p = llListReplaceList(p, [], 0, 0);
278 l--;
279 for (i = 0; i < l; i++)
280 {
281 string a = llList2String(p, i);
282 integer e = FALSE;
283 integer f = FALSE;
284 list ae = splitEmote(a);
285 string an = llList2String(ae, 0);
286
287 // Coz LSL doesn't short circuit, and we don't want to checkAnim("~")
288 if ("~" == an)
289 e = TRUE;
290 else if (!checkAnim(an, TRUE))
291 e = TRUE;
292 if (e)
293 {
294 p = llListReplaceList(p, [], i, i);
295 i--; l--;
296 }
297 }
298 savePose(name, llDumpList2String(p, "|"), "", "");
299 }
300 return TRUE;
301}
302
240integer doThing(key id, string button, string fr, string cmd, string data, integer source) 303integer doThing(key id, string button, string fr, string cmd, string data, integer source)
241{ 304{
242 integer set = -1; 305 integer set = -1;
@@ -375,7 +438,7 @@ integer doThing(key id, string button, string fr, string cmd, string data, integ
375 keys += "|COUPLE_WITH " + llList2String(b, i); 438 keys += "|COUPLE_WITH " + llList2String(b, i);
376 names += "|" + llList2String(b, i + 2); 439 names += "|" + llList2String(b, i + 2);
377 } 440 }
378 dynamicMenu(Owner, "couples", What, " Pick someone to '" + What + "' with -", 441 dynamicMenu(Owner, menu, What, " Pick someone to '" + What + "' with -",
379 llGetSubString(names, 1, -1), llGetSubString(keys, 1, -1)); 442 llGetSubString(names, 1, -1), llGetSubString(keys, 1, -1));
380 PIN = (integer) llFrand(DEBUG_CHANNEL - 2) + 2; 443 PIN = (integer) llFrand(DEBUG_CHANNEL - 2) + 2;
381 vector RefPos = llGetPos(); 444 vector RefPos = llGetPos();