diff options
author | onefang | 2019-07-04 02:02:34 +1000 |
---|---|---|
committer | onefang | 2019-07-04 02:02:34 +1000 |
commit | 740466e367af3afc39e9ca199207dc52c78f27cb (patch) | |
tree | 0fcdbe0092aef4b6d048e8e6cf95fa9d1a959a8d | |
parent | Bump version to 0.12 test (diff) | |
download | 1ring-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.
-rw-r--r-- | .1AOor2.settings.txt | 3 | ||||
-rw-r--r-- | .1AOor2.theme.txt | 3 | ||||
-rw-r--r-- | .1ring.theme.txt | 1 | ||||
-rw-r--r-- | 1AOor2.lsl | 62 | ||||
-rw-r--r-- | 1chatter.lsl | 40 | ||||
-rw-r--r-- | 1ring.lsl | 42 | ||||
-rw-r--r-- | OhSillyThreatDetector.lsl | 167 | ||||
-rw-r--r-- | ~1AOor2.setting.data.txt | 16 | ||||
-rw-r--r-- | ~1ring.command.data.txt | 5 |
9 files changed, 244 insertions, 95 deletions
diff --git a/.1AOor2.settings.txt b/.1AOor2.settings.txt index 9ef4a07..1600f01 100644 --- a/.1AOor2.settings.txt +++ b/.1AOor2.settings.txt | |||
@@ -1,2 +1,5 @@ | |||
1 | AO=1 | 1 | AO=1 |
2 | SUPER=0 | 2 | SUPER=0 |
3 | OSANIM=1 | ||
4 | OSSIT=0 | ||
5 | OSSPEED=1 | ||
diff --git a/.1AOor2.theme.txt b/.1AOor2.theme.txt index e8627b5..6bba809 100644 --- a/.1AOor2.theme.txt +++ b/.1AOor2.theme.txt | |||
@@ -41,6 +41,9 @@ TOMENU sits | CHOOSE_STATE | |||
41 | TOMENU stands | CHOOSE_STATE | 41 | TOMENU stands | CHOOSE_STATE |
42 | TOMENU swims | CHOOSE_STATE | 42 | TOMENU swims | CHOOSE_STATE |
43 | TOMENU walks | CHOOSE_STATE | 43 | TOMENU walks | CHOOSE_STATE |
44 | TOGGLE osAnim | ||
45 | TOGGLE osSit | ||
46 | TOGGLE osSpeed | ||
44 | 47 | ||
45 | MENU dances | Dance menu | ALL | 48 | MENU dances | Dance menu | ALL |
46 | POSE cherished | cherished-m | cherished-f | 49 | POSE cherished | cherished-m | cherished-f |
diff --git a/.1ring.theme.txt b/.1ring.theme.txt index 2807d7e..834a32d 100644 --- a/.1ring.theme.txt +++ b/.1ring.theme.txt | |||
@@ -55,6 +55,7 @@ TOMENU title | |||
55 | TOMENU title colour | 55 | TOMENU title colour |
56 | TOGGLE record | 56 | TOGGLE record |
57 | TOGGLE typing | 57 | TOGGLE typing |
58 | BUTTON OhSilly probe | OHSILLYPROBE | ||
58 | 59 | ||
59 | MENU mood | moods menu:\nLaugh\nCheeky\nHappy\nNone\nSad\nAngry\nCry\nTantrum | WEARER | 60 | MENU mood | moods menu:\nLaugh\nCheeky\nHappy\nNone\nSad\nAngry\nCry\nTantrum | WEARER |
60 | BUTTON △ better | 61 | BUTTON △ better |
@@ -56,20 +56,9 @@ integer lDYNAMIC = -20; | |||
56 | integer lMENU = -21; | 56 | integer lMENU = -21; |
57 | 57 | ||
58 | // OhSillyThreat detector | 58 | // OhSillyThreat detector |
59 | list OhSillyThreats = []; | 59 | integer doAnim = TRUE; |
60 | list OhSillyTreats = // OpenSim threat level. | 60 | integer doSit = FALSE; |
61 | [ | 61 | integer 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 | ||
74 | d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} | 63 | d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} |
75 | D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} | 64 | D(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 | ||
94 | animBegin(key u, string a){if (doAnim) osAvatarPlayAnimation(u, a); else llStartAnimation(a);} | ||
95 | animEnd(key u, string a){if (doAnim) osAvatarStopAnimation(u, a); else llStopAnimation(a);} | ||
96 | speed(key u, float s){if (doSpeed) osSetSpeed(u, s);} | ||
97 | |||
105 | integer listFindString(list lst, string name, integer stride) | 98 | integer 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 | |||
201 | integer Chosen; | 194 | integer Chosen; |
202 | linky(integer num, string message, key id) | 195 | linky(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 | ||
1697 | checkLag() | 1691 | checkLag() |
@@ -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 |
diff --git a/1chatter.lsl b/1chatter.lsl index b3df84e..3ed1bac 100644 --- a/1chatter.lsl +++ b/1chatter.lsl | |||
@@ -1444,6 +1444,26 @@ d("lSCAN " + llDumpList2String(input, " ~ ")); | |||
1444 | listen(integer channel, string name, key id, string message) | 1444 | listen(integer channel, string name, key id, string message) |
1445 | { | 1445 | { |
1446 | //d("listen " + channel + ", " + llKey2Name(id) + "-> " + message + " " + llGetListLength(Musers)); | 1446 | //d("listen " + channel + ", " + llKey2Name(id) + "-> " + message + " " + llGetListLength(Musers)); |
1447 | // Catch OhSillyThreatLevel messages, from the probe. | ||
1448 | if (channel == DEBUG_CHANNEL) | ||
1449 | { | ||
1450 | key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); | ||
1451 | if (llGetLinkKey(LINK_ROOT) == root) | ||
1452 | { | ||
1453 | integer f = llSubStringIndex(message, "permission denied. "); | ||
1454 | if (-1 != f) | ||
1455 | { | ||
1456 | list e = llParseStringKeepNulls(llGetSubString(message, 0, -f), [" "], []); | ||
1457 | string function = llList2String(e, 0); | ||
1458 | if (("OSSL" == llList2String(e, 0)) && ("Runtime" == llList2String(e, 1)) && ("Error:" == llList2String(e, 2))) | ||
1459 | function = llList2String(e, 3); | ||
1460 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, "0"); | ||
1461 | llOwnerSay("Found naughty function " + function); | ||
1462 | return; | ||
1463 | } | ||
1464 | } | ||
1465 | } | ||
1466 | |||
1447 | // See if it's a prefix on the prefix channel, strip off the prefix and feed the remains to doThing(). | 1467 | // See if it's a prefix on the prefix channel, strip off the prefix and feed the remains to doThing(). |
1448 | if (channel == (integer) getSetting("1ring.CHANNEL")) | 1468 | if (channel == (integer) getSetting("1ring.CHANNEL")) |
1449 | { | 1469 | { |
@@ -1472,26 +1492,6 @@ d("listen 1ring.CHANNEL " + message + " -> " + button + " " + cmd + " " + data); | |||
1472 | return; | 1492 | return; |
1473 | } | 1493 | } |
1474 | } | 1494 | } |
1475 | |||
1476 | // Catch OhSillyThreatLevel messages. | ||
1477 | if (channel == DEBUG_CHANNEL) | ||
1478 | { | ||
1479 | key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); | ||
1480 | if ((llGetLinkKey(LINK_ROOT) == root) && ("OSSL Runtime Error: os" == llGetSubString(message, 0, 21))) | ||
1481 | { | ||
1482 | string function = llGetSubString(message, 20, -1); | ||
1483 | integer f = llSubStringIndex(function, " "); | ||
1484 | if (-1 != f) | ||
1485 | { | ||
1486 | if (" permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission." == llGetSubString(function, f, -1)) | ||
1487 | { | ||
1488 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, llGetSubString(function, 0, f - 1), id); | ||
1489 | llRegionSay(DEBUG_CHANNEL, "OPENSIM SUCKS!"); | ||
1490 | return; | ||
1491 | } | ||
1492 | } | ||
1493 | } | ||
1494 | } | ||
1495 | } | 1495 | } |
1496 | 1496 | ||
1497 | no_sensor() | 1497 | no_sensor() |
@@ -56,20 +56,7 @@ integer lDYNAMIC = -20; | |||
56 | integer lMENU = -21; | 56 | integer lMENU = -21; |
57 | 57 | ||
58 | // OhSillyThreat detector | 58 | // OhSillyThreat detector |
59 | list OhSillyThreats = []; | 59 | integer doSpeed = FALSE; |
60 | list OhSillyTreats = // OpenSim threat level. | ||
61 | [ | ||
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 | 60 | ||
74 | d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} | 61 | d(string m) {if (DEBUG) llInstantMessage(Owner, llGetScriptName() + ": " + m);} |
75 | D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} | 62 | D(string m) {llRegionSay(DEBUG_CHANNEL, llGetScriptName() + ": " + m);} |
@@ -103,6 +90,8 @@ string inKey2Name(key k) | |||
103 | return k; | 90 | return k; |
104 | } | 91 | } |
105 | 92 | ||
93 | speed(key u, float s){if (doSpeed) osSetSpeed(u, s);} | ||
94 | |||
106 | integer listFindString(list lst, string name, integer stride) | 95 | integer listFindString(list lst, string name, integer stride) |
107 | { | 96 | { |
108 | integer f = llListFindList(lst, [name]); | 97 | integer f = llListFindList(lst, [name]); |
@@ -215,6 +204,10 @@ dynamicMenu(key id, string menu, string name, string title, string entries, stri | |||
215 | 204 | ||
216 | linky(integer num, string message, key id) | 205 | linky(integer num, string message, key id) |
217 | { | 206 | { |
207 | if (DEBUG_CHANNEL == num) | ||
208 | { | ||
209 | if ("osSetSpeed" == message) doSpeed = (integer) id; | ||
210 | } | ||
218 | if ((id != ScriptKey) && (id != NULL_KEY)) return; | 211 | if ((id != ScriptKey) && (id != NULL_KEY)) return; |
219 | list input = llParseStringKeepNulls(message, [lSEP], []); | 212 | list input = llParseStringKeepNulls(message, [lSEP], []); |
220 | key them = llList2Key(input, 0); | 213 | key them = llList2Key(input, 0); |
@@ -266,19 +259,6 @@ d("linky RESET_DONE"); | |||
266 | laterInit(); | 259 | laterInit(); |
267 | s("Finished starting up " + getSetting("VERSION") + " in " + (string) (llGetTimeOfDay() - Start)); | 260 | s("Finished starting up " + getSetting("VERSION") + " in " + (string) (llGetTimeOfDay() - Start)); |
268 | } | 261 | } |
269 | else if (DEBUG_CHANNEL == num) | ||
270 | { | ||
271 | key root = llList2Key(llGetObjectDetails(id, [OBJECT_ROOT]), 0); | ||
272 | integer f = llListFindList(OhSillyThreats, [message]); | ||
273 | |||
274 | if (-1 == f) | ||
275 | OhSillyThreats += [message]; | ||
276 | else | ||
277 | d("OhSillyThreats detected the function " + message + "() again!" ); | ||
278 | s("Oh Silly threat system prevented " + message + "()" | ||
279 | + "\n in " + id + " \t" + llKey2Name(id) | ||
280 | + "\n part of " + root + " \t" + llKey2Name(root)); | ||
281 | } | ||
282 | } | 262 | } |
283 | // END boilerplate, mostly. | 263 | // END boilerplate, mostly. |
284 | 264 | ||
@@ -629,6 +609,8 @@ s("YAY! Freeeeeee at last!!!!!"); | |||
629 | osMessageObject(LeashKey, "URL|" + data); | 609 | osMessageObject(LeashKey, "URL|" + data); |
630 | d("New URL " + URL); | 610 | d("New URL " + URL); |
631 | } | 611 | } |
612 | else if ("OHSILLYPROBE" == cmd) | ||
613 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, "OHSILLYPROBE", llGetKey()); | ||
632 | else if ("▲" == cmd) | 614 | else if ("▲" == cmd) |
633 | ; | 615 | ; |
634 | else if (-1 == listFindString(Settings, fr + cmd, sSTRIDE)) | 616 | else if (-1 == listFindString(Settings, fr + cmd, sSTRIDE)) |
@@ -853,9 +835,9 @@ goto(key this) | |||
853 | if (dist > (RANGE + bb)) | 835 | if (dist > (RANGE + bb)) |
854 | { | 836 | { |
855 | if (dist > (2.0 * (RANGE + bb))) | 837 | if (dist > (2.0 * (RANGE + bb))) |
856 | osSetSpeed(Owner, 2.0); | 838 | speed(Owner, 2.0); |
857 | else | 839 | else |
858 | osSetSpeed(Owner, 1.0); | 840 | speed(Owner, 1.0); |
859 | 841 | ||
860 | llStopMoveToTarget(); | 842 | llStopMoveToTarget(); |
861 | if (0 != tid) | 843 | if (0 != tid) |
@@ -899,7 +881,7 @@ stopGoto(integer all) | |||
899 | llTargetRemove(tid); | 881 | llTargetRemove(tid); |
900 | tid = 0; | 882 | tid = 0; |
901 | } | 883 | } |
902 | osSetSpeed(Owner, 1.0); | 884 | speed(Owner, 1.0); |
903 | if (all) | 885 | if (all) |
904 | { | 886 | { |
905 | Stalkee = NULL_KEY; | 887 | Stalkee = NULL_KEY; |
diff --git a/OhSillyThreatDetector.lsl b/OhSillyThreatDetector.lsl index 4f17ed6..24b3e43 100644 --- a/OhSillyThreatDetector.lsl +++ b/OhSillyThreatDetector.lsl | |||
@@ -1,6 +1,6 @@ | |||
1 | 1 | ||
2 | // Detect when OpenSim reports a function was used that triggered a threat level warning. | 2 | // Detect when OpenSim reports a function was used that triggered a threat level warning. |
3 | // Coz their official method doesn't work, and often their threat levels are set way too high. | 3 | // Coz their official method doesn't always work, and often their threat levels are set way too high. |
4 | 4 | ||
5 | // This script will send a link message with number DEBUG_CHANNEL, message being the name of the naughty function, | 5 | // This script will send a link message with number DEBUG_CHANNEL, message being the name of the naughty function, |
6 | // and key of the prim containing the naughty script. It's up to the naughty script to catch this link message | 6 | // and key of the prim containing the naughty script. It's up to the naughty script to catch this link message |
@@ -9,12 +9,66 @@ | |||
9 | // Since it sniffs on DEBUG_CHANNEL messages, and a script can't hear any message sent by scripts in the same prim, | 9 | // Since it sniffs on DEBUG_CHANNEL messages, and a script can't hear any message sent by scripts in the same prim, |
10 | // you'll need to put this script in a prim without the naughty scripts you want to check. | 10 | // you'll need to put this script in a prim without the naughty scripts you want to check. |
11 | 11 | ||
12 | // Naturally it looks as if OpenSim has decided that scripts sniffing DEBUG_CHANNEL is a bad idee now. | ||
13 | |||
14 | // Bits of this where taken from the script at the bottom of http://opensimulator.org/wiki/Threat_level | ||
15 | |||
16 | |||
17 | // OSSL Function Availability Tester | ||
18 | // | ||
19 | // Demonstrates a method by which a script may determine whether or not it is permitted to call | ||
20 | // various OSSL functions. | ||
21 | |||
22 | integer WhichProbeFunction; // to tell us which function we're probing | ||
23 | // OpenSim lies. | ||
24 | list FunctionNames = | ||
25 | [ | ||
26 | // "osAvatarName2Key", // low (it fails anyway) | ||
27 | "osAvatarPlayAnimation", // very high | ||
28 | "osAvatarStopAnimation", // very high | ||
29 | "osForceOtherSit", // very high | ||
30 | // "osGetAgentIP", // severe | ||
31 | // "osGetAgents", // none (it fails anyway) | ||
32 | "osGetAvatarList", // none (it fails anyway) | ||
33 | "osMakeNotecard", // high (describes what they where when making this decision) | ||
34 | "osGetNotecard", // very high (describes what they where when making this decision) | ||
35 | "osGetInventoryDesc", // - | ||
36 | "osGetNotecardLine", // very high (describes what they where when making this decision) | ||
37 | "osGetNumberOfNotecardLines", // very high | ||
38 | "osGetRegionSize", // - (it fails anyway) | ||
39 | "osGetRezzingObject", // none (it fails anyway) | ||
40 | "osIsNpc", // - (it fails anyway) | ||
41 | "osKey2Name", // low (it fails anyway) | ||
42 | "osMessageObject", // low (it fails anyway) | ||
43 | "osNpcSit", // high | ||
44 | "osSetSpeed", // moderate | ||
45 | "osTeleportAgent" // severe (it works anyway) | ||
46 | ]; | ||
47 | list FunctionPermitted = []; // 0 = not permitted, 1 = permitted | ||
48 | |||
49 | startProbe() | ||
50 | { | ||
51 | // llSay(0, "Probing OhSilly threat system to see what OpenSim script functions we are allowed use -"); | ||
52 | WhichProbeFunction = -1; | ||
53 | integer i = llGetListLength(FunctionNames); | ||
54 | FunctionPermitted = []; | ||
55 | while (i--) | ||
56 | FunctionPermitted += [-1]; | ||
57 | llRemoveInventory("OhSillyThreatCard"); | ||
58 | llSetTimerEvent(0.25); // check only four functions a second, just to be nice. | ||
59 | } | ||
60 | |||
61 | // The default state uses the timer to call all the OSSL functions we're interested in using, in turn. | ||
62 | // If the function call fails, the timer event handler will abend, but the script doesn't crash. We can | ||
63 | // use this fact to check all of our desired functions in turn, and then pass control to the Running | ||
64 | // state once we've checked them all. | ||
12 | default | 65 | default |
13 | { | 66 | { |
14 | state_entry() | 67 | state_entry() |
15 | { | 68 | { |
16 | // llSay(DEBUG_CHANNEL, "G'day, I'm " + llGetKey() + " part of " + llGetLinkKey(LINK_ROOT)); | ||
17 | llListen(DEBUG_CHANNEL, "", NULL_KEY, ""); | 69 | llListen(DEBUG_CHANNEL, "", NULL_KEY, ""); |
70 | //llSay(DEBUG_CHANNEL, "G'day, I'm " + llGetKey() + " part of " + llGetLinkKey(LINK_ROOT) | ||
71 | // + "\nOpenSim sucks with their OhSilly threat system!"); | ||
18 | } | 72 | } |
19 | 73 | ||
20 | listen(integer channel, string name, key id, string message) | 74 | listen(integer channel, string name, key id, string message) |
@@ -28,7 +82,7 @@ default | |||
28 | /* Threat level errors look like this (at least in OpenSim 0.8.2) - | 82 | /* Threat level errors look like this (at least in OpenSim 0.8.2) - |
29 | OSSL Runtime Error: osSetStateEvents permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission. | 83 | OSSL Runtime Error: osSetStateEvents permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission. |
30 | 84 | ||
31 | There is also (OpenSim 0.9 at least) - | 85 | There is also (OpenSim 0.9.1 at least) - |
32 | Max Zephyr script | 86 | Max Zephyr script |
33 | OSSL Runtime Error: permission denied. All OS functions are disabled.(script: oc_settings event: changed primID:487baa88-d6e5-420c-b18c-f47f5bbd7de4 at <127.9408, 128.0009, 25.75689>) | 87 | OSSL Runtime Error: permission denied. All OS functions are disabled.(script: oc_settings event: changed primID:487baa88-d6e5-420c-b18c-f47f5bbd7de4 at <127.9408, 128.0009, 25.75689>) |
34 | 88 | ||
@@ -42,18 +96,111 @@ From the source (NOTE: first version has no function name) - | |||
42 | ("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function | 96 | ("{0} permission denied. Script creator is not in the list of users allowed to execute this function and prim owner also has no permission.", function |
43 | ("{0} permission denied. Script permissions error.", function | 97 | ("{0} permission denied. Script permissions error.", function |
44 | 98 | ||
45 | OpenSim 0.9.0.1 doesn't include the "OSSL Runtime Error: " bit at the beginning anymore. | 99 | OpenSim 0.9.1 seems to not even send it to the DEBUG_CHANNEL for scripts anymore. |
46 | OpenSim 0.9.2 seems to not even send it to the DEBUG_CHANNEL for scripts anymore. | ||
47 | */ | 100 | */ |
48 | if ((llGetLinkKey(LINK_ROOT) == root) && ("OSSL Runtime Error: " == llGetSubString(message, 0, 19))) | 101 | if (llGetLinkKey(LINK_ROOT) == root) |
49 | { | 102 | { |
50 | list e = llParseStringKeepNulls(llGetSubString(message, 20, -1), [" "], []); | 103 | integer f = llSubStringIndex(message, "permission denied. "); |
51 | //llOwnerSay(llList2String(e, 0)); | 104 | if (-1 != f) |
52 | if (("permission" == llList2String(e, 1)) && ("denied" == llList2String(e, 2))) | ||
53 | { | 105 | { |
106 | list e = llParseStringKeepNulls(llGetSubString(message, 0, -f), [" "], []); | ||
54 | string function = llList2String(e, 0); | 107 | string function = llList2String(e, 0); |
55 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, id); | 108 | if (("OSSL" == llList2String(e, 0)) && ("Runtime" == llList2String(e, 1)) && ("Error:" == llList2String(e, 2))) |
109 | function = llList2String(e, 3); | ||
110 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, function, "0"); | ||
111 | llOwnerSay("Found naughty function " + function); | ||
112 | llRegionSay(DEBUG_CHANNEL, "OPENSIM SUCKS!"); | ||
56 | } | 113 | } |
57 | } | 114 | } |
58 | } | 115 | } |
116 | |||
117 | link_message(integer sender, integer num, string message, key id) | ||
118 | { | ||
119 | if ((DEBUG_CHANNEL == num) && ("OHSILLYPROBE" == message)) startProbe(); | ||
120 | else | ||
121 | { | ||
122 | integer f = llListFindList(FunctionNames, [message]); | ||
123 | if (-1 != f) | ||
124 | { | ||
125 | FunctionPermitted = llListReplaceList(FunctionPermitted, [(integer) id], f, f); | ||
126 | // llSay(0, "BROKEN " + message + " " + id); | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | |||
131 | // As noted above, this script wont hear itself when the below tests dump an error. | ||
132 | timer() | ||
133 | { | ||
134 | string name = llList2String(FunctionNames, ++WhichProbeFunction); | ||
135 | string BogusKey = "12345678-1234-1234-1234-123456789abc"; // it doesn't need to be valid | ||
136 | if ("" == name) | ||
137 | { | ||
138 | llSetTimerEvent(0.0); // stop the timer | ||
139 | llRemoveInventory("OhSillyThreatCard"); | ||
140 | string s = "The OpenSim script functions we are allowed to use - "; | ||
141 | string t = "The Opensim script functions we are NOT ALLOWED to use - "; | ||
142 | integer i = llGetListLength(FunctionNames); | ||
143 | while (i--) | ||
144 | { | ||
145 | integer p = llList2Integer(FunctionPermitted, i); | ||
146 | if (-1 == p) p = 0; | ||
147 | llMessageLinked(LINK_SET, DEBUG_CHANNEL, | ||
148 | llList2String(FunctionNames, i), (string) p); | ||
149 | if (p) | ||
150 | s += llList2String(FunctionNames, i) + "() "; | ||
151 | else | ||
152 | t += llList2String(FunctionNames, i) + "() "; | ||
153 | } | ||
154 | // llSay(0, s); | ||
155 | llSay(0, t); | ||
156 | return; | ||
157 | } | ||
158 | // llOwnerSay("Checking OpenSim function " + name + "()"); // say status | ||
159 | if ("osAvatarName2Key" == name) | ||
160 | osAvatarName2Key("John", "Smith"); | ||
161 | else if ("osAvatarPlayAnimation" == name) | ||
162 | osAvatarPlayAnimation(BogusKey, BogusKey); | ||
163 | else if ("osAvatarStopAnimation" == name) | ||
164 | osAvatarStopAnimation(BogusKey, BogusKey); | ||
165 | else if ("osForceOtherSit" == name) | ||
166 | osForceOtherSit(BogusKey, llGetKey()); | ||
167 | else if ("osGetAgentIP" == name) | ||
168 | osGetAgentIP(BogusKey); | ||
169 | else if ("osGetAgents" == name) | ||
170 | osGetAgents(); | ||
171 | else if ("osGetAvatarList" == name) | ||
172 | osGetAvatarList(); | ||
173 | else if ("osMakeNotecard" == name) // Out of order, so the others have something to read. | ||
174 | osMakeNotecard("OhSillyThreatCard", [""]); | ||
175 | else if ("osGetNotecard" == name) | ||
176 | osGetNotecard("OhSillyThreatCard"); | ||
177 | else if ("osGetInventoryDesc" == name) | ||
178 | osGetInventoryDesc("inventory"); | ||
179 | else if ("osGetNotecardLine" == name) | ||
180 | osGetNotecardLine("OhSillyThreatCard", 0); | ||
181 | else if ("osGetNumberOfNotecardLines" == name) | ||
182 | osGetNumberOfNotecardLines("OhSillyThreatCard"); | ||
183 | else if ("osGetRegionSize" == name) | ||
184 | osGetRegionSize(); | ||
185 | else if ("osGetRezzingObject" == name) | ||
186 | osGetRezzingObject(); | ||
187 | else if ("osIsNpc" == name) | ||
188 | osIsNpc(BogusKey); | ||
189 | else if ("osKey2Name" == name) | ||
190 | osKey2Name(BogusKey); | ||
191 | else if ("osMessageObject" == name) | ||
192 | osMessageObject(llGetKey(), "G'day."); | ||
193 | else if ("osNpcSit" == name) | ||
194 | osNpcSit(BogusKey, llGetKey(), 0); | ||
195 | else if ("osSetSpeed" == name) | ||
196 | osSetSpeed(BogusKey, 1.0); | ||
197 | else if ("osTeleportAgent" == name) | ||
198 | osTeleportAgent(BogusKey, ZERO_VECTOR, ZERO_VECTOR); | ||
199 | |||
200 | // If we got here, then the timer() handler didn't crash, which means the function it checked for | ||
201 | // was actually permitted. So we update the list to indicate that we can use that particular function. | ||
202 | // llOwnerSay("Working " + name + "()"); | ||
203 | if (-1 == llList2Integer(FunctionPermitted, WhichProbeFunction)) | ||
204 | FunctionPermitted = llListReplaceList(FunctionPermitted, [1], WhichProbeFunction, WhichProbeFunction); | ||
205 | } | ||
59 | } | 206 | } |
diff --git a/~1AOor2.setting.data.txt b/~1AOor2.setting.data.txt index 5a8c5c9..d2719a4 100644 --- a/~1AOor2.setting.data.txt +++ b/~1AOor2.setting.data.txt | |||
@@ -9,4 +9,20 @@ Y | |||
9 | 1AOor2.AO LOCK | 9 | 1AOor2.AO LOCK |
10 | Y | 10 | Y |
11 | 0 | 11 | 0 |
12 | 9 | ||
13 | 1AOor2.OSANIM | ||
14 | Y | ||
15 | 1 | ||
16 | 9 | ||
17 | 1AOor2.OSSPEED | ||
18 | Y | ||
19 | 1 | ||
20 | 9 | ||
21 | 1AOor2.OSSIT | ||
22 | Y | ||
23 | 1 | ||
24 | 9 | ||
25 | 1AOor2.SUPER | ||
26 | Y | ||
27 | 0 | ||
12 | 9 \ No newline at end of file | 28 | 9 \ No newline at end of file |
diff --git a/~1ring.command.data.txt b/~1ring.command.data.txt index e49bb85..de8edd7 100644 --- a/~1ring.command.data.txt +++ b/~1ring.command.data.txt | |||
@@ -111,4 +111,7 @@ w | |||
111 | 31 | 111 | 31 |
112 | 1ring.TESTS | 112 | 1ring.TESTS |
113 | 113 | ||
114 | 8 \ No newline at end of file | 114 | 8 |
115 | 1ring.OHSILLYPROBE | ||
116 | |||
117 | 31 \ No newline at end of file | ||