aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/1AOor2.lsl
diff options
context:
space:
mode:
authoronefang2019-07-04 02:02:34 +1000
committeronefang2019-07-04 02:02:34 +1000
commit740466e367af3afc39e9ca199207dc52c78f27cb (patch)
tree0fcdbe0092aef4b6d048e8e6cf95fa9d1a959a8d /1AOor2.lsl
parentBump version to 0.12 test (diff)
download1ring-740466e367af3afc39e9ca199207dc52c78f27cb.zip
1ring-740466e367af3afc39e9ca199207dc52c78f27cb.tar.gz
1ring-740466e367af3afc39e9ca199207dc52c78f27cb.tar.bz2
1ring-740466e367af3afc39e9ca199207dc52c78f27cb.tar.xz
New OhSilly Threat level detector, and actually use it.
Tries to work in all case.
Diffstat (limited to '1AOor2.lsl')
-rw-r--r--1AOor2.lsl62
1 files changed, 28 insertions, 34 deletions
diff --git a/1AOor2.lsl b/1AOor2.lsl
index 39b1184..96ef48b 100644
--- a/1AOor2.lsl
+++ b/1AOor2.lsl
@@ -56,20 +56,9 @@ integer lDYNAMIC = -20;
56integer lMENU = -21; 56integer lMENU = -21;
57 57
58// OhSillyThreat detector 58// OhSillyThreat detector
59list OhSillyThreats = []; 59integer doAnim = TRUE;
60list OhSillyTreats = // OpenSim threat level. 60integer doSit = FALSE;
61[ 61integer doSpeed = TRUE;
62// "osKey2Name", // low
63// "osGetAvatarList", // none
64 "osGetNotecard", // very high (describes what they where when making this decision)
65// "osMakeNotecard", // high (describes what they where when making this decision)
66// "osGetRezzingObject", // none
67 "osMessageObject", // low
68 "osAvatarPlayAnimation", // very high
69 "osAvatarStopAnimation", // very high
70 "osForceOtherSit", // very high
71 "osSetSpeed" // moderate
72];
73 62
74d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} 63d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);}
75D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} 64D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);}
@@ -102,6 +91,10 @@ string inKey2Name(key k)
102 return k; 91 return k;
103} 92}
104 93
94animBegin(key u, string a){if (doAnim) osAvatarPlayAnimation(u, a); else llStartAnimation(a);}
95animEnd(key u, string a){if (doAnim) osAvatarStopAnimation(u, a); else llStopAnimation(a);}
96speed(key u, float s){if (doSpeed) osSetSpeed(u, s);}
97
105integer listFindString(list lst, string name, integer stride) 98integer listFindString(list lst, string name, integer stride)
106{ 99{
107 integer f = llListFindList(lst, [name]); 100 integer f = llListFindList(lst, [name]);
@@ -201,6 +194,13 @@ dynamicMenu(key id, string menu, string name, string title, string entries, stri
201integer Chosen; 194integer Chosen;
202linky(integer num, string message, key id) 195linky(integer num, string message, key id)
203{ 196{
197 if (DEBUG_CHANNEL == num)
198 {
199 if ("osAvatarPlayAnimation" == message) doAnim = (integer) id;
200 if ("osAvatarStopAnimation" == message) doAnim = (integer) id;
201 if ("osForceOtherSit" == message) doSit = (integer) id;
202 if ("osSetSpeed" == message) doSpeed = FALSE;
203 }
204 if ((id != ScriptKey) && (id != NULL_KEY)) return; 204 if ((id != ScriptKey) && (id != NULL_KEY)) return;
205 list input = llParseStringKeepNulls(message, [lSEP], []); 205 list input = llParseStringKeepNulls(message, [lSEP], []);
206 key them = llList2Key(input, 0); 206 key them = llList2Key(input, 0);
@@ -234,16 +234,6 @@ d("linky RESET_DONE");
234 laterInit(); 234 laterInit();
235 s(Owner, "Finished starting up " + getSetting("VERSION") + " in " + (string) (llGetTimeOfDay() - Start)); 235 s(Owner, "Finished starting up " + getSetting("VERSION") + " in " + (string) (llGetTimeOfDay() - Start));
236 } 236 }
237 else if (DEBUG_CHANNEL == num)
238 {
239 key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0);
240 integer f = llListFindList(OhSillyThreats, [message]);
241 if (-1 == f) OhSillyThreats += [message];
242 else d("OhSillyThreats detected the function " + message + "() again!" );
243 D("Oh Silly threat system prevented " + message + "()"
244 + "\n in " + id + " \t" + llKey2Name(id)
245 + "\n part of " + root + " \t" + llKey2Name(root));
246 }
247} 237}
248// END boilerplate, mostly. 238// END boilerplate, mostly.
249 239
@@ -274,10 +264,10 @@ integer doThing(key id, string button, string fr, string cmd, string data, integ
274 else if ("checkAO" == cmd) checkAO(); 264 else if ("checkAO" == cmd) checkAO();
275 else if ("SMILE" == cmd) 265 else if ("SMILE" == cmd)
276 { // The built in express_* animations are too short, but live with it. 266 { // The built in express_* animations are too short, but live with it.
277 osAvatarStopAnimation(llGetOwner(), Smile); 267 animEnd(llGetOwner(), Smile);
278 Smile = llList2String(Smiles, (integer) llFrand(2.5)); 268 Smile = llList2String(Smiles, (integer) llFrand(2.5));
279 addEvent(3.0 + llFrand(5.0), cmd); 269 addEvent(3.0 + llFrand(5.0), cmd);
280 osAvatarPlayAnimation(llGetOwner(), Smile); 270 animBegin(llGetOwner(), Smile);
281 } 271 }
282 else if ("LESS_-" == cmd) 272 else if ("LESS_-" == cmd)
283 { 273 {
@@ -469,8 +459,10 @@ integer doThing(key id, string button, string fr, string cmd, string data, integ
469 osNpcSit(Stalkee, llGetKey(), OS_NPC_SIT_NOW); 459 osNpcSit(Stalkee, llGetKey(), OS_NPC_SIT_NOW);
470 else 460 else
471 { 461 {
472 llInstantMessage(Stalkee, "Please sit on the big gold heart."); 462 if (doSit)
473// osForceOtherSit(Stalkee/*, llGetKey()*/); 463 osForceOtherSit(Stalkee/*, llGetKey()*/);
464 else
465 llInstantMessage(Stalkee, "Please sit on the big gold heart.");
474 } 466 }
475 newPose(id, llList2Key(p, 1), llList2List(p, 2, -1)); 467 newPose(id, llList2Key(p, 1), llList2List(p, 2, -1));
476 } 468 }
@@ -1450,7 +1442,7 @@ stopAnims(key avatar)
1450 for (i = 0; i < l; i++) 1442 for (i = 0; i < l; i++)
1451 { 1443 {
1452 string anim = llList2String(anims, i); 1444 string anim = llList2String(anims, i);
1453 if (anim != "") osAvatarStopAnimation(avatar, anim); 1445 if (anim != "") animEnd(avatar, anim);
1454 } 1446 }
1455 } 1447 }
1456} 1448}
@@ -1550,6 +1542,8 @@ checkAO()
1550 integer fast; integer i; integer f; float dpth; 1542 integer fast; integer i; integer f; float dpth;
1551 if (NULL_KEY != TheirKey) return; 1543 if (NULL_KEY != TheirKey) return;
1552 1544
1545// doAnim = (integer) getSetting("osAnim");
1546// doSpeed = (integer) getSetting("osSpeed");
1553 if (Attached) 1547 if (Attached)
1554 { 1548 {
1555// if (llGetAgentInfo(Owner) & AGENT_ALWAYS_RUN) fast = 1; else fast = 0; 1549// if (llGetAgentInfo(Owner) & AGENT_ALWAYS_RUN) fast = 1; else fast = 0;
@@ -1565,7 +1559,7 @@ checkAO()
1565 { 1559 {
1566 stopAnims(Owner); 1560 stopAnims(Owner);
1567 AOspeed = 1.0; 1561 AOspeed = 1.0;
1568 osSetSpeed(Owner, 1.0); 1562 speed(Owner, 1.0);
1569 return; 1563 return;
1570 } 1564 }
1571 string oldAnim = newAnim; 1565 string oldAnim = newAnim;
@@ -1635,7 +1629,7 @@ checkAO()
1635 else AOspeed = 4.0; 1629 else AOspeed = 4.0;
1636 } 1630 }
1637 else AOspeed = 1.0; 1631 else AOspeed = 1.0;
1638 if (0.0 < AOspeed) osSetSpeed(Owner, AOspeed + ((AOspeed / 2) * (fast + (2 * (integer) getSetting("super"))))); 1632 if (0.0 < AOspeed) speed(Owner, AOspeed + ((AOspeed / 2) * (fast + (2 * (integer) getSetting("super")))));
1639 else AOspeed = 1.0; 1633 else AOspeed = 1.0;
1640 for (f = 0; f < l; f += pSTRIDE) 1634 for (f = 0; f < l; f += pSTRIDE)
1641 { 1635 {
@@ -1673,7 +1667,7 @@ checkAO()
1673 for (i = llGetListLength(anims) - 1; i >= 0; --i) 1667 for (i = llGetListLength(anims) - 1; i >= 0; --i)
1674 { 1668 {
1675 string a = llList2String(anims, i); 1669 string a = llList2String(anims, i);
1676 if (checkAnim(a)) osAvatarPlayAnimation(id, a); 1670 if (checkAnim(a)) animBegin(id, a);
1677 } 1671 }
1678 } 1672 }
1679 } 1673 }
@@ -1691,7 +1685,7 @@ stopMe(key id, integer f)
1691 integer i; 1685 integer i;
1692//d("stopMe " + llKey2Name(id) + " " + llList2String(Sitters, f + pANIMS)); 1686//d("stopMe " + llKey2Name(id) + " " + llList2String(Sitters, f + pANIMS));
1693 for (i = llGetListLength(anims) - 1; i >= 0; --i) 1687 for (i = llGetListLength(anims) - 1; i >= 0; --i)
1694 osAvatarStopAnimation(id, llList2String(anims, i)); 1688 animEnd(id, llList2String(anims, i));
1695} 1689}
1696 1690
1697checkLag() 1691checkLag()
@@ -1833,4 +1827,4 @@ d("\n\n1AOor2 sending RESET @ " + (string) Start + "\n");
1833 } 1827 }
1834 } 1828 }
1835 } 1829 }
1836} 1830} \ No newline at end of file