From 740466e367af3afc39e9ca199207dc52c78f27cb Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 4 Jul 2019 02:02:34 +1000 Subject: New OhSilly Threat level detector, and actually use it. Tries to work in all case. --- 1AOor2.lsl | 62 ++++++++++++++++++++++++++++---------------------------------- 1 file changed, 28 insertions(+), 34 deletions(-) (limited to '1AOor2.lsl') 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; integer lMENU = -21; // OhSillyThreat detector -list OhSillyThreats = []; -list OhSillyTreats = // OpenSim threat level. -[ -// "osKey2Name", // low -// "osGetAvatarList", // none - "osGetNotecard", // very high (describes what they where when making this decision) -// "osMakeNotecard", // high (describes what they where when making this decision) -// "osGetRezzingObject", // none - "osMessageObject", // low - "osAvatarPlayAnimation", // very high - "osAvatarStopAnimation", // very high - "osForceOtherSit", // very high - "osSetSpeed" // moderate -]; +integer doAnim = TRUE; +integer doSit = FALSE; +integer doSpeed = TRUE; d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} @@ -102,6 +91,10 @@ string inKey2Name(key k) return k; } +animBegin(key u, string a){if (doAnim) osAvatarPlayAnimation(u, a); else llStartAnimation(a);} +animEnd(key u, string a){if (doAnim) osAvatarStopAnimation(u, a); else llStopAnimation(a);} +speed(key u, float s){if (doSpeed) osSetSpeed(u, s);} + integer listFindString(list lst, string name, integer stride) { integer f = llListFindList(lst, [name]); @@ -201,6 +194,13 @@ dynamicMenu(key id, string menu, string name, string title, string entries, stri integer Chosen; linky(integer num, string message, key id) { + if (DEBUG_CHANNEL == num) + { + if ("osAvatarPlayAnimation" == message) doAnim = (integer) id; + if ("osAvatarStopAnimation" == message) doAnim = (integer) id; + if ("osForceOtherSit" == message) doSit = (integer) id; + if ("osSetSpeed" == message) doSpeed = FALSE; + } if ((id != ScriptKey) && (id != NULL_KEY)) return; list input = llParseStringKeepNulls(message, [lSEP], []); key them = llList2Key(input, 0); @@ -234,16 +234,6 @@ d("linky RESET_DONE"); laterInit(); s(Owner, "Finished starting up " + getSetting("VERSION") + " in " + (string) (llGetTimeOfDay() - Start)); } - else if (DEBUG_CHANNEL == num) - { - key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); - integer f = llListFindList(OhSillyThreats, [message]); - if (-1 == f) OhSillyThreats += [message]; - else d("OhSillyThreats detected the function " + message + "() again!" ); - D("Oh Silly threat system prevented " + message + "()" - + "\n in " + id + " \t" + llKey2Name(id) - + "\n part of " + root + " \t" + llKey2Name(root)); - } } // END boilerplate, mostly. @@ -274,10 +264,10 @@ integer doThing(key id, string button, string fr, string cmd, string data, integ else if ("checkAO" == cmd) checkAO(); else if ("SMILE" == cmd) { // The built in express_* animations are too short, but live with it. - osAvatarStopAnimation(llGetOwner(), Smile); + animEnd(llGetOwner(), Smile); Smile = llList2String(Smiles, (integer) llFrand(2.5)); addEvent(3.0 + llFrand(5.0), cmd); - osAvatarPlayAnimation(llGetOwner(), Smile); + animBegin(llGetOwner(), Smile); } else if ("LESS_-" == cmd) { @@ -469,8 +459,10 @@ integer doThing(key id, string button, string fr, string cmd, string data, integ osNpcSit(Stalkee, llGetKey(), OS_NPC_SIT_NOW); else { - llInstantMessage(Stalkee, "Please sit on the big gold heart."); -// osForceOtherSit(Stalkee/*, llGetKey()*/); + if (doSit) + osForceOtherSit(Stalkee/*, llGetKey()*/); + else + llInstantMessage(Stalkee, "Please sit on the big gold heart."); } newPose(id, llList2Key(p, 1), llList2List(p, 2, -1)); } @@ -1450,7 +1442,7 @@ stopAnims(key avatar) for (i = 0; i < l; i++) { string anim = llList2String(anims, i); - if (anim != "") osAvatarStopAnimation(avatar, anim); + if (anim != "") animEnd(avatar, anim); } } } @@ -1550,6 +1542,8 @@ checkAO() integer fast; integer i; integer f; float dpth; if (NULL_KEY != TheirKey) return; +// doAnim = (integer) getSetting("osAnim"); +// doSpeed = (integer) getSetting("osSpeed"); if (Attached) { // if (llGetAgentInfo(Owner) & AGENT_ALWAYS_RUN) fast = 1; else fast = 0; @@ -1565,7 +1559,7 @@ checkAO() { stopAnims(Owner); AOspeed = 1.0; - osSetSpeed(Owner, 1.0); + speed(Owner, 1.0); return; } string oldAnim = newAnim; @@ -1635,7 +1629,7 @@ checkAO() else AOspeed = 4.0; } else AOspeed = 1.0; - if (0.0 < AOspeed) osSetSpeed(Owner, AOspeed + ((AOspeed / 2) * (fast + (2 * (integer) getSetting("super"))))); + if (0.0 < AOspeed) speed(Owner, AOspeed + ((AOspeed / 2) * (fast + (2 * (integer) getSetting("super"))))); else AOspeed = 1.0; for (f = 0; f < l; f += pSTRIDE) { @@ -1673,7 +1667,7 @@ checkAO() for (i = llGetListLength(anims) - 1; i >= 0; --i) { string a = llList2String(anims, i); - if (checkAnim(a)) osAvatarPlayAnimation(id, a); + if (checkAnim(a)) animBegin(id, a); } } } @@ -1691,7 +1685,7 @@ stopMe(key id, integer f) integer i; //d("stopMe " + llKey2Name(id) + " " + llList2String(Sitters, f + pANIMS)); for (i = llGetListLength(anims) - 1; i >= 0; --i) - osAvatarStopAnimation(id, llList2String(anims, i)); + animEnd(id, llList2String(anims, i)); } checkLag() @@ -1833,4 +1827,4 @@ d("\n\n1AOor2 sending RESET @ " + (string) Start + "\n"); } } } -} +} \ No newline at end of file -- cgit v1.1