From 94281bcbeb261dd1cba07bb0f12c14a4c9a58e61 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:43:34 +0000 Subject: [PATCH 01/97] Update oc_rlvextension.lsl Fix for issue #703 --- src/collar/oc_rlvextension.lsl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 3f0593315..7c14b91d6 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -41,7 +41,7 @@ Medea Destiny - automatically for owners. - Added explanatory text to exceptions and force sit menus - Renamed Refuse TP to Force TP to reflect what the button actually does. - + Dec2021 - Fixed filtering of unsit - > sit unsit for chat command and remote (issue #703 ) */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -401,6 +401,7 @@ integer g_iLastSitAuth = 599; UserCommand(integer iNum, string sStr, key kID) { if (iNumCMD_EVERYONE) return; sStr=llToLower(sStr); + if(sStr=="unsit") sStr="sit unsit"; // if ((llSubStringIndex(sStr,"exceptions") && sStr != "menu "+g_sSubMenu1) || (llSubStringIndex(sStr,"exceptions") && sStr != "menu "+g_sSubMenu2)) return; if (sStr=="sit" || sStr == "menu "+llToLower(g_sSubMenu1)) MenuForceSit(kID, iNum); else if (sStr=="exceptions" || sStr == "menu "+llToLower(g_sSubMenu2)) MenuExceptions(kID,iNum); @@ -423,10 +424,6 @@ UserCommand(integer iNum, string sStr, key kID) { else { string sChangetype = llList2String(llParseString2List(sStr, [" "], []),0); string sChangekey = llList2String(llParseString2List(sStr, [" "], []),1); - if(sChangetype=="unsit") { - sChangetype="sit"; - sChangekey="unsit"; - } if (sChangetype == "sit") { if ((sChangekey == "[unsit]" || sChangekey == "unsit")) { if(iNum> g_iLastSitAuth ) { From 753459c97d4e4c3e0ad29578e4953c3832a9e06e Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sun, 12 Dec 2021 21:57:13 +0000 Subject: [PATCH 02/97] Create oc_wearerHUD Script for hud click access to wearer's own collar --- src/spares/oc_wearerHUD | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/spares/oc_wearerHUD diff --git a/src/spares/oc_wearerHUD b/src/spares/oc_wearerHUD new file mode 100644 index 000000000..e09d11134 --- /dev/null +++ b/src/spares/oc_wearerHUD @@ -0,0 +1,41 @@ +/* + +oc_wearerhud + +Copyright(c) Medea Destiny, Nirea Mercury et al. +Licensed under the GPLv2. See LICENSE for full details. + +This script can be dropped into an object worn as a HUD attachment and will trigger +the OpenCollar menu for the wearer's own collar, using the OpenCollar interface channel +menuto function. At some point we may expand interface channel functionality (or rather +revert the removal of this) and make this a more general purpose wearer hud. + + + Medea Destiny - + Dec 2020 - Created script + +*/ + +key g_kWearer; +integer g_iInterfaceChannel; + +default +{ + state_entry() + { + + } + attach(key kID) + { + if(kID) { + g_kWearer=llGetOwner(); + g_iInterfaceChannel=-llAbs((integer)("0x" + llGetSubString(g_kWearer,30,-1))); + } + } + + touch_start(integer total_number) + { + if(llDetectedKey(0)!=g_kWearer) return; + llRegionSayTo(g_kWearer,g_iInterfaceChannel,"menuto"+(string)g_kWearer); + } +} From 1ebc0caeb46576fa02633ff3325f09c778fa5b9b Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Fri, 31 Dec 2021 15:46:20 -0600 Subject: [PATCH 03/97] Addon Timeout Removal correction The messages regarding removal of Addons did not correctly report the removals, because the list delete would remove 1 too many elements from the list. --- src/collar/oc_addons.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_addons.lsl b/src/collar/oc_addons.lsl index 07675a1f0..1ea2c4991 100644 --- a/src/collar/oc_addons.lsl +++ b/src/collar/oc_addons.lsl @@ -287,7 +287,7 @@ state active } SayToAddonX((key)llList2String(g_lAddons,i), "dc", 0, "", llGetOwner()); llMessageLinked(LINK_SET, NOTIFY, "0Addon: "+llList2String(g_lAddons,i+1)+" has been removed because it has not been seen for 5 minutes or more.", g_kWearer); - g_lAddons = llDeleteSubList(g_lAddons, i, i+5); + g_lAddons = llDeleteSubList(g_lAddons, i, i+4); i=-5; // if we change the stride of the list this must be updated end=llGetListLength(g_lAddons); if(g_iVerbosityLevel>=4) From 3858ef2d88aeeb33e95db47d00f1986f0330f81a Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Tue, 1 Feb 2022 22:47:49 +0000 Subject: [PATCH 04/97] Update oc_rlvsuite.lsl --- src/collar/oc_rlvsuite.lsl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/collar/oc_rlvsuite.lsl b/src/collar/oc_rlvsuite.lsl index 8380e7b26..ad8e92460 100644 --- a/src/collar/oc_rlvsuite.lsl +++ b/src/collar/oc_rlvsuite.lsl @@ -33,7 +33,9 @@ medea (medea destiny) requirements of setting individual restrictions as short-term solution to issue #656. - Added Restore function to Customize menu to restore presets to defaults, per issue #663 - Rewritten dialog code to set individual restrictions, 'cos it was badly broken. Issue #664 - + Feb 2022 - Fix for #732: Empty g_lMacros list returned via LM_SETTING_RESPONSE parses as a list with a single + empty element, thus messing up the list stride. Not sure why we're keeping nulls here, but setting + to empty list if list length is too short works. @@ -766,7 +768,10 @@ state active g_iRestrictions1 = llList2Integer(lMasks, 0); g_iRestrictions2 = llList2Integer(lMasks, 1); } - } else if (llList2String(lParams, 0) == "rlvsuite_macros") g_lMacros = llParseStringKeepNulls(llList2String(lParams, 1), ["^"],[]); + } else if (llList2String(lParams, 0) == "rlvsuite_macros") { + g_lMacros = llParseStringKeepNulls(llList2String(lParams, 1), ["^"],[]); + if(llGetListLength(g_lMacros)<3) g_lMacros=[]; + } else if(llList2String(lParams,0) == "global_checkboxes") g_lCheckboxes = llCSV2List(llList2String(lParams,1)); } else if (iNum == CMD_SAFEWORD || iNum == RLV_CLEAR || iNum == RLV_OFF){ g_iRLV = FALSE; From 96deba8ab6528e8f75fc624ebb153643bcec71f7 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Tue, 1 Feb 2022 23:00:46 +0000 Subject: [PATCH 05/97] Update oc_rlvsuite.lsl --- src/collar/oc_rlvsuite.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_rlvsuite.lsl b/src/collar/oc_rlvsuite.lsl index ad8e92460..93a07dcde 100644 --- a/src/collar/oc_rlvsuite.lsl +++ b/src/collar/oc_rlvsuite.lsl @@ -35,7 +35,7 @@ medea (medea destiny) - Rewritten dialog code to set individual restrictions, 'cos it was badly broken. Issue #664 Feb 2022 - Fix for #732: Empty g_lMacros list returned via LM_SETTING_RESPONSE parses as a list with a single empty element, thus messing up the list stride. Not sure why we're keeping nulls here, but setting - to empty list if list length is too short works. + to empty list if list length is too short works. From 4f001dbac0ee6b1986254f2fbe28c71e63a0a772 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Thu, 17 Feb 2022 00:20:54 +0000 Subject: [PATCH 06/97] Update oc_rlvextension.lsl --- src/collar/oc_rlvextension.lsl | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 3f0593315..7c14b91d6 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -41,7 +41,7 @@ Medea Destiny - automatically for owners. - Added explanatory text to exceptions and force sit menus - Renamed Refuse TP to Force TP to reflect what the button actually does. - + Dec2021 - Fixed filtering of unsit - > sit unsit for chat command and remote (issue #703 ) */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -401,6 +401,7 @@ integer g_iLastSitAuth = 599; UserCommand(integer iNum, string sStr, key kID) { if (iNumCMD_EVERYONE) return; sStr=llToLower(sStr); + if(sStr=="unsit") sStr="sit unsit"; // if ((llSubStringIndex(sStr,"exceptions") && sStr != "menu "+g_sSubMenu1) || (llSubStringIndex(sStr,"exceptions") && sStr != "menu "+g_sSubMenu2)) return; if (sStr=="sit" || sStr == "menu "+llToLower(g_sSubMenu1)) MenuForceSit(kID, iNum); else if (sStr=="exceptions" || sStr == "menu "+llToLower(g_sSubMenu2)) MenuExceptions(kID,iNum); @@ -423,10 +424,6 @@ UserCommand(integer iNum, string sStr, key kID) { else { string sChangetype = llList2String(llParseString2List(sStr, [" "], []),0); string sChangekey = llList2String(llParseString2List(sStr, [" "], []),1); - if(sChangetype=="unsit") { - sChangetype="sit"; - sChangekey="unsit"; - } if (sChangetype == "sit") { if ((sChangekey == "[unsit]" || sChangekey == "unsit")) { if(iNum> g_iLastSitAuth ) { From a99003fdaa1f4d8f6913592b275b3f97c830ec09 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Thu, 17 Feb 2022 00:45:08 +0000 Subject: [PATCH 07/97] Update oc_rlvextension.lsl --- src/collar/oc_rlvextension.lsl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 7c14b91d6..39c8e2b6c 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -42,6 +42,7 @@ Medea Destiny - - Added explanatory text to exceptions and force sit menus - Renamed Refuse TP to Force TP to reflect what the button actually does. Dec2021 - Fixed filtering of unsit - > sit unsit for chat command and remote (issue #703 ) + - Fix to disengaging strict sit when disabled via menu when already sitting. */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -626,6 +627,7 @@ state active MenuForceSit(kAv,iAuth); } else{ g_iStrictSit=1-g_iStrictSit; + if(!g_iStrictSit) llMessageLinked(LINK_SET,RLV_CMD,"unsit=y","strictsit"); llMessageLinked(LINK_SET, LM_SETTING_SAVE, "rlvext_strict="+(string)g_iStrictSit, ""); MenuForceSit(kAv,iAuth); } From bee4d4b9fc21d689b0e5a59ac31b94e706385add Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Thu, 17 Feb 2022 01:06:25 +0000 Subject: [PATCH 08/97] Update oc_rlvextension.lsl --- src/collar/oc_rlvextension.lsl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 39c8e2b6c..033d54539 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -43,6 +43,9 @@ Medea Destiny - - Renamed Refuse TP to Force TP to reflect what the button actually does. Dec2021 - Fixed filtering of unsit - > sit unsit for chat command and remote (issue #703 ) - Fix to disengaging strict sit when disabled via menu when already sitting. + Feb2021 - SetAllExes triggered on RLV_REFRESH / RLV_ON was saving values, causing exception + settings to be restored to defaults if trigged before settings are received. + (fixes #740, #720, #719) */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -827,7 +830,7 @@ state active g_iRLV = FALSE; } else if (iNum == RLV_REFRESH || iNum == RLV_ON) { g_iRLV = TRUE; - SetAllExes(FALSE,EX_TYPE_OWNER|EX_TYPE_TRUSTED|EX_TYPE_CUSTOM,TRUE); + SetAllExes(FALSE,EX_TYPE_OWNER|EX_TYPE_TRUSTED|EX_TYPE_CUSTOM,FALSE); SetMuffle(g_bMuffle); llSleep(1); llMessageLinked(LINK_SET,LINK_CMD_RESTDATA,"MinCamDist="+(string)g_fMinCamDist,kID); From f49463486a3c929e21a16e1c0126f789b44b8d09 Mon Sep 17 00:00:00 2001 From: Pingout Duffield Date: Tue, 22 Feb 2022 16:54:52 -0500 Subject: [PATCH 09/97] Updated oc_cuff script Reference Issue #743 This fix allows RLV Restrictions to be placed on a per-pose basis, clearing each set of restrictions between one pose and the next, and also clearing restrictions on a *STOP* from the Addon Pose Menu --- src/cuffs/oc_cuff.lsl | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index 663b721f1..3cc9d36b1 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -8,8 +8,9 @@ Safra (Safra Nitely) * June 2021 - add priority for animations, fix visual lock/unlock Lilith (Lilith Xue) * August 2021 - Add ping for Lockmiester furniture compatibility +Ping (Pingout Duffield) + * February 2022 - Add code to allow RLV Restrictions to clear between poses et al. - Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar Visual locking system fix by Safra Nitely (based on togglelock by Aria) @@ -110,6 +111,7 @@ integer REPLY_POINT_KEY = -58933; integer CLEAR_ALL_CHAINS = -58934; integer STOP_CUFF_POSE = -58935; // <-- stops all active animations originating from this cuff integer DESUMMON_PARTICLES = -58936; // Message only includes the From point name +integer CLEAR_POSE_RESTRICTION = -58937; // Clear Restrictions between poses integer g_iFirstInit=TRUE; @@ -879,7 +881,8 @@ default Link("from_addon", STOP_CUFF_POSE, g_sCurrentPose, g_sPoseName); g_sCurrentPose="NONE"; Link("from_addon", LM_SETTING_DELETE, "occuffs_"+g_sPoseName+"pose",""); - Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + //Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + Link("from_addon", CLEAR_POSE_RESTRICTION, "", ""); iRespring=FALSE; Link("from_addon", TIMEOUT_REGISTER, "2", "respring_poses:"+(string)iAuth+":"+(string)kAv+":"+(string)iPage+":"+(string)llGetKey()); }else if(sMsg == "BACK"){ @@ -887,7 +890,9 @@ default Menu(kAv,iAuth); }else{ // activate pose - Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + // Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + // Clear previous RLV Restrictions if any + Link("from_addon", CLEAR_POSE_RESTRICTION, "", ""); g_sCurrentPose=sMsg; CMD_LEVEL=iAuth; Link("from_addon", LM_SETTING_SAVE, "occuffs_cmdlevel="+(string)iAuth,""); @@ -960,6 +965,14 @@ default ToggleLock(TRUE); } + } else if(iNum == CLEAR_POSE_RESTRICTION) + { + if(!g_iCuffLocked)llOwnerSay("@clear"); + else { + llOwnerSay("@clear"); + llSleep(0.5); + llOwnerSay("@detach=n"); + } } else if(iNum == STOP_CUFF_POSE && kID == g_sPoseName){ if(sStr!="NONE"){ llMessageLinked(LINK_SET, 505, sStr, ""); From efc788373db25aa7fb77bc3b36a835509a2f0005 Mon Sep 17 00:00:00 2001 From: StormedStormy <101068873+StormedStormy@users.noreply.github.com> Date: Mon, 7 Mar 2022 02:04:39 +0000 Subject: [PATCH 10/97] Change's to sounds for installer added an additional sound in the installer for per update to sound a lot better rather than a few beeps, but to also make the user aware of prompts. --- src/installer/oc_installer_sys.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/installer/oc_installer_sys.lsl b/src/installer/oc_installer_sys.lsl index 7a86d208b..4a272fd82 100644 --- a/src/installer/oc_installer_sys.lsl +++ b/src/installer/oc_installer_sys.lsl @@ -254,8 +254,8 @@ default { g_iDone = FALSE; //llSetTimerEvent(30.0); } - llPlaySound("d023339f-9a9d-75cf-4232-93957c6f620c",1.0); - if(sParam == "8.0")llWhisper(g_initChannel,"-.. ---|"+g_sBuildVersion); //tell collar we are here and to send the pin + llPlaySound("9fc93abc-98d0-9ed1-05eb-2d41bd5b7506",1.0); + if((integer)llGetSubString(sParam,0,0)>=8)llWhisper(g_initChannel,"-.. ---|"+g_sBuildVersion); //tell collar we are here and to send the pin else llWhisper(g_initChannel, "-.. ---|AppInstall"); // fix for the deprecated message in previous versions } else if (sCmd == "ready") { // person clicked "Yes I want to update" on the collar menu. From 09c42a6a4411d25f48e0180f0fcce80387ce45ac Mon Sep 17 00:00:00 2001 From: StormedStormy <101068873+StormedStormy@users.noreply.github.com> Date: Mon, 7 Mar 2022 02:17:57 +0000 Subject: [PATCH 11/97] Update oc_installer_sys.lsl --- src/installer/oc_installer_sys.lsl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/installer/oc_installer_sys.lsl b/src/installer/oc_installer_sys.lsl index 4a272fd82..f1beb35e5 100644 --- a/src/installer/oc_installer_sys.lsl +++ b/src/installer/oc_installer_sys.lsl @@ -13,6 +13,8 @@ // script right after handshaking, we're free to rewrite everything that comes // after the handshake. +// Stormed DarkShade - Mar 22 - Added voice prompting to the install process + // In addition to the handshake and shim installation, this script decides // which bundles should be installed into (or removed from) the collar. It // loops over each bundle in inventory, telling the BundleGiver script to From 4f8baf753eb6f74499635bc9a390fed47339641f Mon Sep 17 00:00:00 2001 From: StormedStormy <101068873+StormedStormy@users.noreply.github.com> Date: Thu, 17 Mar 2022 03:02:50 +0000 Subject: [PATCH 12/97] Changes to Help/About Added a reboot button so users can reboot there collars easier as some do not know about the prefix --- src/collar/oc_core.lsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index e5bdaa1d6..77d8cbef9 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -24,6 +24,8 @@ Medea (Medea Destiny) - Added confirmation messages when group or public access is toggled and fixed a typo - Efficiency pass, inlined majorminor(), docheckupdate() and docheckdevupdate(). Removed g_lTestReports, left over from alpha.a + + March 2022 - Stormed Darkshade (StormedStormy) Added a button for reboot to help/about menu. Licensed under the GPLv2. See LICENSE for full details. @@ -186,7 +188,7 @@ HelpMenu(key kID, integer iAuth){ llMessageLinked(LINK_SET, NOTIFY, sPrompt, kID); return; } - list lButtons = ["Update", "Support", "License"]; + list lButtons = ["Update", "Support", "License", "Reboot"]; Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Help"); } @@ -682,6 +684,8 @@ state active if(sMsg == UPMENU){ iRespring=FALSE; Menu(kAv,iAuth); + } else if(sMsg == "Reboot") + {llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); } else if(sMsg == "Support"){ From f0ec9b9c4110e35d383a244dbf141a5952ee0ba6 Mon Sep 17 00:00:00 2001 From: StormedStormy <101068873+StormedStormy@users.noreply.github.com> Date: Thu, 17 Mar 2022 04:47:10 +0000 Subject: [PATCH 13/97] Changed like of some code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit } else if(sMsg == "Reboot") Changed too… } else if(sMsg == "Reboot") { --- src/collar/oc_core.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index 77d8cbef9..9b51880f2 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -684,7 +684,7 @@ state active if(sMsg == UPMENU){ iRespring=FALSE; Menu(kAv,iAuth); - } else if(sMsg == "Reboot") + } else if(sMsg == "Reboot") { {llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); From 14d3ba3fed5a0281dc1edfab3f954581f5ceece2 Mon Sep 17 00:00:00 2001 From: StormedStormy <101068873+StormedStormy@users.noreply.github.com> Date: Sat, 19 Mar 2022 01:40:55 +0000 Subject: [PATCH 14/97] Removed error on line 688 there was a little error of an extra { at the beginning of the line that has now been removed --- src/collar/oc_core.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index 9b51880f2..8e2576da9 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -685,7 +685,7 @@ state active iRespring=FALSE; Menu(kAv,iAuth); } else if(sMsg == "Reboot") { - {llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); + llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); } else if(sMsg == "Support"){ From cc41819666c8053803c128d0dfe878ed6e1a310d Mon Sep 17 00:00:00 2001 From: K9K8E <102867563+K9K8E@users.noreply.github.com> Date: Mon, 4 Apr 2022 18:11:06 +0200 Subject: [PATCH 15/97] Update oc_anim.lsl Removed CONTROL_ML_LBUTTON to allow left clicking while in mouselook. --- src/collar/oc_anim.lsl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/collar/oc_anim.lsl b/src/collar/oc_anim.lsl index 419352d18..50d24cfcf 100644 --- a/src/collar/oc_anim.lsl +++ b/src/collar/oc_anim.lsl @@ -472,7 +472,6 @@ state active CONTROL_ROT_RIGHT | CONTROL_UP | CONTROL_DOWN | - CONTROL_ML_LBUTTON | 0x02 | 0x04, TRUE,TRUE); From fc0d9a54b4b9173792387ea4ad19efd19e1165ea Mon Sep 17 00:00:00 2001 From: Pingout Duffield Date: Tue, 12 Apr 2022 21:49:03 -0400 Subject: [PATCH 16/97] Update oc_cuff.lsl Remove commented code, fix style issue re: open curly braces should be on the end of the if... line --- src/cuffs/oc_cuff.lsl | 285 +++++++++++++----------------------------- 1 file changed, 89 insertions(+), 196 deletions(-) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index 663b721f1..2802519bc 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -8,8 +8,10 @@ Safra (Safra Nitely) * June 2021 - add priority for animations, fix visual lock/unlock Lilith (Lilith Xue) * August 2021 - Add ping for Lockmiester furniture compatibility +Ping (Pingout Duffield) + * February 2022 - Add code to allow RLV Restrictions to clear between poses + * April 2022 - Remove SyncLock, Clean Up Script Style et al. - Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar Visual locking system fix by Safra Nitely (based on togglelock by Aria) @@ -110,6 +112,7 @@ integer REPLY_POINT_KEY = -58933; integer CLEAR_ALL_CHAINS = -58934; integer STOP_CUFF_POSE = -58935; // <-- stops all active animations originating from this cuff integer DESUMMON_PARTICLES = -58936; // Message only includes the From point name +integer CLEAR_POSE_RESTRICTION = -58937; // Clear Restrictions between poses integer g_iFirstInit=TRUE; @@ -168,18 +171,11 @@ Menu(key kID, integer iAuth) { else sPrompt +="\nPoses not available while the Collar is hidden"; } - if(iAuth == CMD_OWNER) - { + if(iAuth == CMD_OWNER) { lButtons+=["ClearChains"]; } - if(!g_iSyncLock){ lButtons += [Checkbox(g_iCuffLocked, "Lock")]; - } - - lButtons += [Checkbox(g_iSyncLock, "SyncLock")]; - - //llSay(0, "opening menu"); @@ -211,18 +207,15 @@ Link(string packet, integer iNum, string sStr, key kID){ list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; if(!g_iHasPoses)packet_data += ["noMenu", 1]; - if (packet == "online" || packet == "update") // only add optin if packet type is online or update - { + if (packet == "online" || packet == "update") { // only add optin if packet type is online or update packet_data+= [ "optin", llDumpList2String(g_lOptedLM, "~") ]; } string pkt = llList2Json(JSON_OBJECT, packet_data); - if (g_kCollar != "" && g_kCollar != NULL_KEY) - { + if (g_kCollar != "" && g_kCollar != NULL_KEY) { llRegionSayTo(g_kCollar, API_CHANNEL, pkt); } - else - { + else { llRegionSay(API_CHANNEL, pkt); } } @@ -332,7 +325,6 @@ integer TIMEOUT_FIRED = 30499; integer g_iCuffLocked=FALSE; integer g_iLocked; -integer g_iSyncLock; string g_sCurrentPose="NONE"; PosesMenu (key kAv, integer iAuth, integer iPage) @@ -428,8 +420,7 @@ default llMessageLinked(LINK_SET,-1,"",""); if(llGetInventoryType("CuffConfig")==INVENTORY_NOTECARD) UpdateDSRequest(NULL, llGetNotecardLine("CuffConfig",0), "read_conf:0"); - else - { + else { llOwnerSay("ERROR: CuffConfig notecard is missing"); } } @@ -441,8 +432,7 @@ default } attach(key kID){ - if(kID != NULL_KEY) - { + if(kID != NULL_KEY) { // Process llResetScript(); } @@ -450,8 +440,7 @@ default link_message(integer iSend,integer iNum, string sMsg, key kID) { - if(iNum==2) - { + if(iNum==2) { UpdateDSRequest(NULL, llHTTPRequest("https://raw.githubusercontent.com/OpenCollarTeam/OpenCollar/master/web/cuffs.txt",[],""), "check_version"); if(g_iLMV2Listen !=-1)llListenRemove(g_iLMV2Listen); @@ -460,36 +449,31 @@ default if(g_iLGV2Listen !=-1)llListenRemove(g_iLGV2Listen); g_iLGV2Listen = llListen(-9119, "", "", ""); - } else if(iNum == 0){ + } else if(iNum == 0) { ClearAllParticles(); - } else if(iNum == 401){ + } else if(iNum == 401) { Desummon(llParseString2List(sMsg,["~"],[])); - } else if(iNum == 400) - { + } else if(iNum == 400) { list lTmp = llParseString2List(kID,["|"],[]); Summon(llParseString2List(sMsg, ["~"],[]), llList2String(lTmp,0), llList2String(lTmp,1)); - } else if(iNum == 10) - { + } else if(iNum == 10) { list lTmp = llParseString2List(kID, ["^"],[]); g_lPoses = llParseString2List(sMsg,["`"],[]); PosesMenu((key)llList2String(lTmp,0), (integer)llList2String(lTmp,1), 0); - } else if(iNum == 999) - { + } else if(iNum == 999) { Link(llJsonGetValue(sMsg, ["pkt"]), (integer)llJsonGetValue(sMsg, ["iNum"]), llJsonGetValue(sMsg, ["sMsg"]), (key)llJsonGetValue(sMsg,["kID"])); } } http_response(key kID, integer iStat, list lMeta, string sBody) { - if(HasDSRequest(kID)!=-1) - { + if(HasDSRequest(kID)!=-1) { string meta = GetDSMeta(kID); DeleteDSReq(kID); if(meta=="check_version"){ Compare(g_sVersion, sBody); - if(UPDATE_AVAILABLE) - { + if(UPDATE_AVAILABLE) { llOwnerSay("An update is available"); } else{ //llOwnerSay("I am up to date, there are no newer scripts"); @@ -515,13 +499,11 @@ default timer() { - if(llGetUnixTime()>=(g_iLMLastSent+30) && g_kCollar != NULL_KEY) - { + if(llGetUnixTime()>=(g_iLMLastSent+30) && g_kCollar != NULL_KEY) { g_iLMLastSent=llGetUnixTime(); Link("ping", 0, "", g_kCollar); } - if(llGetUnixTime()>(g_iLMLastRecv+(5*60)) && g_kCollar != NULL_KEY) - { + if(llGetUnixTime()>(g_iLMLastRecv+(5*60)) && g_kCollar != NULL_KEY) { llOwnerSay("Lost connection to collar - resetting"); llResetScript(); // This script is always-on. Reset and try again @@ -593,39 +575,30 @@ default listen(integer channel, string name, key id, string msg){ if(channel==API_CHANNEL){ string sPacketType = llJsonGetValue(msg, ["pkt_type"]); - if (sPacketType == "approved" && g_kCollar == NULL_KEY) - { - // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. + if (sPacketType == "approved" && g_kCollar == NULL_KEY) { + // This signal indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. g_kCollar = id; g_iLMLastRecv = llGetUnixTime(); // Initial message should also probably count as a pong for timing reasons Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); - } else if(sPacketType == "denied" && g_kCollar == NULL_KEY) - { + } else if(sPacketType == "denied" && g_kCollar == NULL_KEY) { //llSay(0, "Collar connection refused by collar. Please enable wearer-owned addons to use this device."); llSetTimerEvent(0); } - else if (sPacketType == "dc" && g_kCollar == id) - { + else if (sPacketType == "dc" && g_kCollar == id) { g_kCollar = NULL_KEY; llResetScript(); // This addon is designed to always be connected because it is a test } - else if (sPacketType == "pong" && g_kCollar == id) - { + else if (sPacketType == "pong" && g_kCollar == id) { g_iLMLastRecv = llGetUnixTime(); } - else if(sPacketType == "from_collar") - { + else if(sPacketType == "from_collar") { // process link message if in range of addon - if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0) - { + if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0) { integer iNum = (integer) llJsonGetValue(msg, ["iNum"]); string sStr = llJsonGetValue(msg, ["sMsg"]); key kID = (key) llJsonGetValue(msg, ["kID"]); - - if (iNum == LM_SETTING_RESPONSE) - { - + if (iNum == LM_SETTING_RESPONSE) { list lPar = llParseString2List(sStr, ["_","="], []); string sToken = llList2String(lPar, 0); string sVar = llList2String(lPar, 1); @@ -635,10 +608,8 @@ default //llSay(0, "SAVE "+sToken+"_"+sVar+"="+sVal); - if (sToken == "occuffs") - { - if (sVar == "cmdlevel") //set the level of the last user of the cuffs pose menu - { + if (sToken == "occuffs") { + if (sVar == "cmdlevel") { //set the level of the last user of the cuffs pose menu if ((integer)sVal == 500) CMD_LEVEL =500; //set menu access level to only owner if ((integer)sVal == 501) CMD_LEVEL =501; //set menu access level to owner or trusted if ((integer)sVal == 502) CMD_LEVEL =502; //set menu access level to group @@ -646,28 +617,20 @@ default if ((integer)sVal == 504) CMD_LEVEL =504; //set menu access level to public } - if (sVar == "synclock") - { - g_iSyncLock=(integer)sVal; - } - else if(sVar == "locked") - { + else if(sVar == "locked") { g_iCuffLocked=(integer)sVal; - if(!g_iSyncLock) //Changes by Safra to Display Visual Lock/Unlock + //Changes by Safra to Display Visual Lock/Unlock { - if(g_iCuffLocked) - { + if(g_iCuffLocked) { llOwnerSay("@detach=n"); ToggleLock(TRUE); } - else - { + else { llOwnerSay("@detach=y"); ToggleLock(FALSE); } } - } else if(sVar == g_sPoseName+"pose") - { + } else if(sVar == g_sPoseName+"pose") { // check pose map for this pose then perform start animation process g_sCurrentPose=sVal; if(!g_iHidden) @@ -677,19 +640,6 @@ default }else if(sToken == "global"){ if(sVar=="locked"){ g_iLocked=(integer)sVal; - if(g_iSyncLock){ - if(g_iLocked) - { - llOwnerSay("@detach=n"); - ToggleLock(TRUE); - } - else - { - llOwnerSay("@detach=y"); - ToggleLock(FALSE); - } - - } } else if(sVar=="checkboxes"){ g_lCheckboxes=llParseString2List(sVal,[","],[]); } else if(sVar == "hide"){ @@ -705,30 +655,17 @@ default g_iHidden=(integer)sVal; } - } else if(sToken == "anim") - { - if(sVar=="pose") - { + } else if(sToken == "anim") { + if(sVar=="pose") { g_sActivePose=sVal; if(!g_iHidden) llMessageLinked(LINK_SET, 300, sVal,""); } } - - if(sStr=="settings=sent"){ - if(g_iSyncLock){ - g_iCuffLocked=g_iLocked; - if(g_iLocked){ - llOwnerSay("@detach=n"); - ToggleLock(TRUE); - } - else { - ToggleLock(FALSE); - llOwnerSay("@detach=y"); - } - }else{ - if(g_iCuffLocked){ + if(sStr=="settings=sent") { + { + if(g_iCuffLocked) { ToggleLock(TRUE); llOwnerSay("@detach=n"); } @@ -746,8 +683,7 @@ default ToggleAlpha(FALSE); } } - }else if(iNum == LM_SETTING_DELETE) - { + }else if(iNum == LM_SETTING_DELETE) { list lPar = llParseString2List(sStr, ["_"], []); string sToken = llList2String(lPar, 0); @@ -756,39 +692,16 @@ default //llSay(0, "DELETE "+sToken+"_"+sVar); if(sToken == "global"){ - if(sVar == "locked"){ - if(g_iSyncLock) - { + if(sVar == "locked") { llOwnerSay("@detach=y"); ToggleLock(FALSE); - } - } - } else if(sToken == "occuffs") - { - if(sVar == "synclock") - { - g_iSyncLock=FALSE; - if(!g_iCuffLocked) - { - llOwnerSay("@detach=y"); - ToggleLock(FALSE); - } - } - else if(sVar == "locked") - { - g_iCuffLocked=FALSE; - if(!g_iSyncLock) - { - llOwnerSay("@detach=y"); - ToggleLock(FALSE); - }; - } else if(sVar==g_sPoseName+"pose"){ + } + } else if(sToken == "occuffs") { + if(sVar==g_sPoseName+"pose"){ g_sCurrentPose="NONE"; } - } else if(sToken == "anim") - { - if(sVar == "pose") - { + } else if(sToken == "anim") { + if(sVar == "pose") { if(g_sActivePose != ""){ if(!g_iHidden) llMessageLinked(LINK_SET,301, "", ""); @@ -797,18 +710,15 @@ default } } } - else if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) - { + else if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) { UserCommand(iNum, sStr, kID); } - else if (iNum == DIALOG_TIMEOUT) - { + else if (iNum == DIALOG_TIMEOUT) { integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex + 3); //remove stride from g_lMenuIDs } - else if (iNum == DIALOG_RESPONSE) - { + else if (iNum == DIALOG_RESPONSE) { integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); if (iMenuIndex != -1) { @@ -822,15 +732,12 @@ default integer iRespring=TRUE; - if (sMenu == "Menu~Main") - { - if (sMsg == UPMENU) - { + if (sMenu == "Menu~Main") { + if (sMsg == UPMENU) { iRespring=FALSE; Link("from_addon", iAuth, "menu Addons", kAv); } - else if (sMsg == "Pose") - { + else if (sMsg == "Pose") { iRespring=FALSE; llMessageLinked(LINK_SET,9, (string)kAv, (string)iAuth); // Retrieve the pose menu button names //PosesMenu(kAv,iAuth,0); @@ -846,13 +753,8 @@ default }else if(sMsg == "ClearChains"){ if(iAuth==CMD_OWNER) Link("from_addon", CLEAR_ALL_CHAINS, "", ""); - } else if(sMsg == Checkbox(g_iSyncLock, "SyncLock")){ - if(iAuth == CMD_OWNER){ - g_iSyncLock=1-g_iSyncLock; - // sync lock save - Link("from_addon", LM_SETTING_SAVE, "occuffs_synclock="+(string)g_iSyncLock, ""); - }else Link("from_addon", NOTIFY, "0%NOACCESS% to toggling lock sync!", kAv); - } else if(sMsg == Checkbox(g_iCuffLocked, "Lock")){ + } + else if(sMsg == Checkbox(g_iCuffLocked, "Lock")){ if(iAuth==CMD_OWNER){ g_iCuffLocked=1-g_iCuffLocked; // ToggleLock(); @@ -860,8 +762,7 @@ default }else Link("from_addon", NOTIFY, "0%NOACCESS% to toggling cuffs lock", kAv); } - else if (sMsg == "DISCONNECT") - { + else if (sMsg == "DISCONNECT") { Link("offline", 0, "", llGetOwnerKey(g_kCollar)); iRespring=FALSE; g_lMenuIDs = []; @@ -870,8 +771,7 @@ default if(iRespring)Menu(kAv,iAuth); - } else if(sMenu=="Cuffs~Poses") - { + } else if(sMenu=="Cuffs~Poses") { if(sMsg == "*STOP*"){ // send this command to all cuffs, this way we can ensure the animation fully stops, then clear all chains that were associated with this pose Link("from_addon", LM_SETTING_SAVE, "occuffs_cmdlevel="+"504",""); @@ -879,7 +779,8 @@ default Link("from_addon", STOP_CUFF_POSE, g_sCurrentPose, g_sPoseName); g_sCurrentPose="NONE"; Link("from_addon", LM_SETTING_DELETE, "occuffs_"+g_sPoseName+"pose",""); - Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + //Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + Link("from_addon", CLEAR_POSE_RESTRICTION, "", ""); iRespring=FALSE; Link("from_addon", TIMEOUT_REGISTER, "2", "respring_poses:"+(string)iAuth+":"+(string)kAv+":"+(string)iPage+":"+(string)llGetKey()); }else if(sMsg == "BACK"){ @@ -887,7 +788,9 @@ default Menu(kAv,iAuth); }else{ // activate pose - Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + // Link("from_addon", CLEAR_ALL_CHAINS, "", ""); + // Clear previous RLV Restrictions if any + Link("from_addon", CLEAR_POSE_RESTRICTION, "", ""); g_sCurrentPose=sMsg; CMD_LEVEL=iAuth; Link("from_addon", LM_SETTING_SAVE, "occuffs_cmdlevel="+(string)iAuth,""); @@ -899,14 +802,11 @@ default } } - } else if(iNum == QUERY_POINT_KEY) - { - if(llListFindList(g_lMyPoints, [sStr])!=-1) - { + } else if(iNum == QUERY_POINT_KEY) { + if(llListFindList(g_lMyPoints, [sStr])!=-1) { Link("from_addon", REPLY_POINT_KEY, kID, llList2String(g_lMyPoints, llListFindList(g_lMyPoints,[sStr])+2)); } - } else if(iNum == REPLY_POINT_KEY) - { + } else if(iNum == REPLY_POINT_KEY) { if(HasDSRequest((key)sStr)!=-1){ string meta = GetDSMeta((key)sStr); DeleteDSReq((key)sStr); @@ -916,11 +816,9 @@ default if(llStringLength(llList2String(lTmp,3))>0) llOwnerSay("@"+llList2String(lTmp,3)); } - } else if(iNum == SUMMON_PARTICLES) - { + } else if(iNum == SUMMON_PARTICLES) { list lTmp = llParseString2List(sStr, ["|"],[]); - if(llListFindList(g_lMyPoints, [llList2String(lTmp,0)])!=-1) - { + if(llListFindList(g_lMyPoints, [llList2String(lTmp,0)])!=-1) { key ident = llGenerateKey(); UpdateDSRequest(NULL, ident, llList2String(lTmp,0)+"|def|"+llList2String(lTmp,2)+"|"+llList2String(lTmp,3)); @@ -930,8 +828,7 @@ default } else if(iNum == TIMEOUT_FIRED){ //llSay(0, "timer fired: "+sStr); list lTmp = llParseString2List(sStr, [":"],[]); - if(llList2String(lTmp,0) == "cuff_link_expire") - { + if(llList2String(lTmp,0) == "cuff_link_expire") { key ident = (key)llList2String(lTmp,1); if(HasDSRequest(ident)!=-1){ DeleteDSReq(ident); @@ -949,8 +846,7 @@ default if(llGetKey() == (key)llList2String(lTmp,4)) PosesMenu((key)llList2String(lTmp,2), (integer)llList2String(lTmp,1), (integer)llList2String(lTmp,3)); } - } else if(iNum == CLEAR_ALL_CHAINS) - { + } else if(iNum == CLEAR_ALL_CHAINS) { ClearAllParticles(); if(!g_iCuffLocked)llOwnerSay("@clear"); else { @@ -960,12 +856,18 @@ default ToggleLock(TRUE); } + } else if(iNum == CLEAR_POSE_RESTRICTION) { + if(!g_iCuffLocked)llOwnerSay("@clear"); + else { + llOwnerSay("@clear"); + llSleep(0.5); + llOwnerSay("@detach=n"); + } } else if(iNum == STOP_CUFF_POSE && kID == g_sPoseName){ if(sStr!="NONE"){ llMessageLinked(LINK_SET, 505, sStr, ""); } - } else if(iNum == DESUMMON_PARTICLES) - { + } else if(iNum == DESUMMON_PARTICLES) { integer index = llListFindList(g_lMyPoints, [sStr]); if(index!=-1){ list opts = GetKey(sStr); @@ -974,32 +876,28 @@ default } } } - } else if(channel==-8888) - { + } else if(channel==-8888) { // LockMeister v2 key kLMKey = (key)llGetSubString(msg,0,35); list lLMCmd = llParseString2List(msg,["|"],[]); - if (kLMKey == llGetOwner()) - { - if (llGetListLength(lLMCmd) > 1) - { // A Lockmeister command + if (kLMKey == llGetOwner()) { + if (llGetListLength(lLMCmd) > 1) { + // A Lockmeister command string sLMCMD = llList2String(lLMCmd,2); string sLMPoint = llList2String(lLMCmd,3); - if (sLMCMD == "RequestPoint") - { + if (sLMCMD == "RequestPoint") { key kLink = NULL_KEY; list lKey = []; integer iMapIndex = llListFindList(g_lLMV2Map, [sLMPoint]); - if (iMapIndex > -1) - { + if (iMapIndex > -1) { lKey = GetKey(llList2String(g_lLMV2Map, iMapIndex + 1)); if (llList2Integer(lKey, 0) != LINK_ROOT) llRegionSayTo(id, -8888,(string)llGetOwner()+"|LMV2|ReplyPoint|"+sLMPoint+"|"+llList2String(lKey, 1)); } } } - else - { // A Lockmeister Ping + else { + // A Lockmeister Ping string sLMPoint = llGetSubString(msg,36,-1); if (llListFindList(g_lLMV2Map, [sLMPoint]) > -1) { @@ -1007,8 +905,7 @@ default } } } - } else if(channel == -9119) - { + } else if(channel == -9119) { //llSay(0, "Command on LockGuard Channel: "+msg); list lCmds = llParseString2List(msg, [" "],[]); integer ix=0; @@ -1025,8 +922,7 @@ default } integer index=llListFindList(g_lLGv2Map,[llList2String(lCmds,2)]); - if(index!=-1) - { + if(index!=-1) { // This is my remapping, grab point name, then lookup and immediately begin configuring the particle system sLinkTo = llList2String(g_lLGv2Map,index+1); ix--; // Stride of two, but the provided command uses only 1 command, the link name @@ -1038,7 +934,6 @@ default ix=2; while(ix!=end) { - if(llList2String(lCmds,ix) == "link"){ kTarget = (key)llList2String(lCmds,ix+1); ix++; @@ -1052,16 +947,14 @@ default kTexture=(key)llList2String(lCmds,ix+1); ix++; } - } else if(llList2String(lCmds,ix)=="life") - { + } else if(llList2String(lCmds,ix)=="life") { float val = (float)llList2String(lCmds,ix+1); if(val!=0) { fMaxAge=2+val; ix++; } - } else if (llList2String(lCmds, ix)=="ping") - { + } else if (llList2String(lCmds, ix)=="ping") { llRegionSayTo(id, -9119, "lockguard "+(string)llGetOwner()+" "+llList2String(lCmds, ix-1)+" okay"); } ix++; From 95f6072d324bbfe0099b2e2ca9b9c372b9af5b6b Mon Sep 17 00:00:00 2001 From: Pingout Duffield Date: Sun, 24 Apr 2022 18:11:59 -0400 Subject: [PATCH 17/97] Update oc_cuff.lsl Cleaned up for style and clarity per change request --- src/cuffs/oc_cuff.lsl | 65 +++++++++++++------------------------------ 1 file changed, 20 insertions(+), 45 deletions(-) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index a09d5d9b2..fbdec8f88 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -17,15 +17,13 @@ https://github.com/OpenCollarTeam/OpenCollar Visual locking system fix by Safra Nitely (based on togglelock by Aria) Cuff locking levels system fix by Safra Nitely (using OC standard levles of locking) */ -list StrideOfList(list src, integer stride, integer start, integer end) -{ +list StrideOfList(list src, integer stride, integer start, integer end) { list l = []; integer ll = llGetListLength(src); if(start < 0)start += ll; if(end < 0)end += ll; if(end < start) return llList2List(src, start, start); - while(start <= end) - { + while(start <= end) { l += llList2List(src, start, start); start += stride; } @@ -190,12 +188,10 @@ UserCommand(integer iNum, string sStr, key kID) { return; } - if (llToLower(sStr) == llToLower(g_sAddon) || llToLower(sStr) == "menu "+llToLower(g_sAddon)) - { + if (llToLower(sStr) == llToLower(g_sAddon) || llToLower(sStr) == "menu "+llToLower(g_sAddon)) { Menu(kID, iNum); } //else if (iNum!=CMD_OWNER && iNum!=CMD_TRUSTED && kID!=g_kWearer) RelayNotify(kID,"Access denied!",0); - else - { + else { //integer iWSuccess = 0; //string sChangetype = llList2String(llParseString2List(sStr, [" "], []),0); //string sChangevalue = llList2String(llParseString2List(sStr, [" "], []),1); @@ -299,8 +295,7 @@ PSYS_PART_TARGET_POS_MASK list g_lMyPoints = []; string g_sActivePose; -list GetKey(string LinkName) -{ +list GetKey(string LinkName) { integer i=0; integer end = llGetNumberOfPrims(); for(i=LINK_ROOT;i<=end;i++){ @@ -327,24 +322,20 @@ integer g_iCuffLocked=FALSE; integer g_iLocked; string g_sCurrentPose="NONE"; -PosesMenu (key kAv, integer iAuth, integer iPage) -{ - if (iAuth <= CMD_LEVEL) - { +PosesMenu (key kAv, integer iAuth, integer iPage) { + if (iAuth <= CMD_LEVEL) { string sPrompt = "\n[OpenCollar Cuffs]\n> Poses selection\n\n* Current Pose: "; sPrompt += g_sCurrentPose; list lButtons = g_lPoses; Dialog(kAv, sPrompt, lButtons, ["*STOP*", "BACK"], iPage, iAuth, "Cuffs~Poses"); } - else - { + else { string sPrompt = "\n[OpenCollar Cuffs]\n> Poses selection\n\n* Only your owner can access this menu! "; } } -Desummon(list lPoints) -{ +Desummon(list lPoints) { integer ix=0; integer end = llGetListLength(lPoints); for(ix=0;ix -1) - { + if (llListFindList(g_lLMV2Map, [sLMPoint]) > -1) { llRegionSayTo(id, -8888, (string)llGetOwner()+sLMPoint+" ok"); } } @@ -917,8 +895,7 @@ default key kTexture=""; float fMaxAge=0; if(llList2String(lCmds,0)=="lockguard"){ - if(llList2String(lCmds,1) != (string)llGetOwner()) - { + if(llList2String(lCmds,1) != (string)llGetOwner()) { return; // immediately cease processing } } @@ -934,8 +911,7 @@ default return; } ix=2; - while(ix!=end) - { + while(ix!=end) { if(llList2String(lCmds,ix) == "link"){ kTarget = (key)llList2String(lCmds,ix+1); ix++; @@ -951,8 +927,7 @@ default } } else if(llList2String(lCmds,ix)=="life") { float val = (float)llList2String(lCmds,ix+1); - if(val!=0) - { + if(val!=0) { fMaxAge=2+val; ix++; } From d6cb1a7ebe25b20ce14dd920e0104adb3d5f31d7 Mon Sep 17 00:00:00 2001 From: Pingout Duffield Date: Wed, 4 May 2022 23:51:04 -0400 Subject: [PATCH 18/97] Update oc_unwelder.lsl Ref Issue #776 --- src/spares/oc_unwelder.lsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index a74dd77a5..9fee93d64 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -131,7 +131,8 @@ default } }else { - llSay(0, "Unwelder now in use"); + // llSay(0, "Unwelder now in use"); + llSetText("In use by\n" + llKey2Name (llDetectedKey(0)), <1,0,0>,1); llSetText("In use..", <1,0,0>,1); g_iLMLastSent = llGetUnixTime(); g_kUser=llDetectedKey(0); From b5b52df7ebbc4e26d752e32c2814f2844686bea7 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Sat, 7 May 2022 17:18:22 +0000 Subject: [PATCH 19/97] fix Outfits/Core non RLVA Compatability fix the compatability of nonRLVA viewers without exposing the folder to normal usage. --- src/Apps/oc_outfits.lsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index b604706ce..1bc82b9a3 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -317,8 +317,8 @@ string GetOutfitSystem(integer iCorePath){ if(iCorePath)return ".outfits/.core"; else return ".outfits"; }else{ - if(iCorePath)return "outfits/core"; - else return "outfits"; + if(iCorePath)return "~outfits/~core"; + else return "~outfits"; } } @@ -327,8 +327,8 @@ string GetFolderName(integer iCore){ if(iCore)return ".core"; else return ".outfits"; }else{ - if(iCore)return "core"; - else return "outfits"; + if(iCore)return "~core"; + else return "~outfits"; } } From b77aa0a49cc02b37cf9e70eaaf66d37b15e55ca1 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Tue, 10 May 2022 21:35:01 -0600 Subject: [PATCH 20/97] Update oc_outfits.lsl llSubStringIndex(sMsg,"RLVa") == -1 is a good idea but it don't actually work well in the puppy talker system i made ~llSubStringIndx(sMsg, "RLVa") returns true and works well every time so i can confirm this change should work and could fix the swapping bug in issue #778, also we should be using @versionnew instead of @version that's only still allowed for code that didn't and won't be updated prior to the SL Rules change. --- src/Apps/oc_outfits.lsl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 1bc82b9a3..206725e4c 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -341,13 +341,13 @@ default state_entry(){ llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); llListen(999988, "", llGetOwner(), ""); - llOwnerSay("@version=999988"); + llOwnerSay("@versionnew=999988"); } listen(integer iChan, string sName, key kID, string sMsg) { - if(llSubStringIndex(sMsg, "RLVa")==-1){ - g_iRLVa=FALSE; - }else g_iRLVa=TRUE; + if(~llSubStringIndex(sMsg, "RLVa")){ + g_iRLVa=TRUE; + }else g_iRLVa=FALSE; } link_message(integer iSender, integer iNum, string sStr, key kID){ if(iNum == REBOOT){ From 1b42cf8e5d1d3982c63392d36cfadacbf006d265 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Fri, 13 May 2022 00:57:01 +0100 Subject: [PATCH 21/97] Update oc_folders.lsl Fix for issue #775 --- src/collar/oc_folders.lsl | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/collar/oc_folders.lsl b/src/collar/oc_folders.lsl index 489eb8cd3..4ac2472e3 100644 --- a/src/collar/oc_folders.lsl +++ b/src/collar/oc_folders.lsl @@ -1,20 +1,19 @@ /* This file is a part of OpenCollar. Copyright 2020 - : Contributors : - Aria (Tashia Redrose) * Aug 2020 - Rewrote oc_folders for 8.0 Alpha 5 - Medea (Medea Destiny) * June 2021 - *Fix issue #570, Allow hiding folders starting with ~ via HideTilde option, defaults to ON. *Fix issue #581, filtering input to UserCommand to only folder-auth check actual folder commands rather than folder-authing and processing EVERYTHING THE COLLAR DOES BY ANY USER + * May 2022 - *Fix issue #775, changed string handling to ensure command is not issued as part of search + term, added sanity checking for chat commands to ensure we don't try to search for nothing, + and no longer operate on empty search results. Issuer of chat command now stored as + g_kChatUser so they can be notified if findfolder fails. et al. - - Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar */ @@ -180,7 +179,7 @@ integer F_REMOVE = 1; integer F_RECURSIVE = 2; integer F_ADD = 4; integer F_WEAR = 8; - +key g_kChatUser; // user of a chat command, to notify if nothing found. UserCommand(integer iNum, string sStr, key kID) { @@ -201,9 +200,13 @@ UserCommand(integer iNum, string sStr, key kID) { string sChangetype = llGetSubString(sStr,0,0); if(llListFindList(["&","-","+"],[sChangetype])==-1) return; sChangetype = llGetSubString(sStr, 0, 1); - string sChangevalue = llStringTrim(llGetSubString(sStr, 2, -1), STRING_TRIM); + string sChangevalue = llStringTrim(llDeleteSubString(sStr, 0, 1), STRING_TRIM); //string sText; - + if(sChangevalue==""){ // don't search for empty strings. + llMessageLinked(LINK_SET, NOTIFY, "0You have to supply a string to search for to use add/remove/wear commands.", kID); + return; + } + g_kChatUser=kID; if(iNum == CMD_TRUSTED && !Bool((g_iAccessBitSet&1)))return R(); if(iNum == CMD_EVERYONE && !Bool((g_iAccessBitSet&2)))return R(); if(iNum == CMD_GROUP && !Bool((g_iAccessBitSet&4)))return R(); @@ -229,9 +232,13 @@ UserCommand(integer iNum, string sStr, key kID) { llOwnerSay("@findfolder:"+sChangevalue+"="+(string)g_iFindChn); return; } - sChangetype = llGetSubString(sStr,0,0); - sChangevalue = llStringTrim(llGetSubString(sStr, 1, -1), STRING_TRIM); + sChangetype = llGetSubString(sStr,0,0); + sChangevalue = llStringTrim(llDeleteSubString(sStr, 0, 0), STRING_TRIM); + if(sChangevalue==""){ // don't search for empty strings. + llMessageLinked(LINK_SET, NOTIFY, "0You have to supply a string to search for to use add/remove/wear commands.", kID); + return; + } if(sChangetype == "&"){ // add folder path //llOwnerSay("@attachover:"+sChangevalue+"=force"); @@ -348,12 +355,10 @@ state active listen(integer iChan, string sName, key kID, string sMsg){ if(iChan == g_iTmpLstnChn){ /* - 0 : No item is present in that folder 1 : Some items are present in that folder, but none of them is worn 2 : Some items are present in that folder, and some of them are worn 3 : Some items are present in that folder, and all of them are worn - */ list lFolders = llParseString2List(sMsg, [","],[]); @@ -392,7 +397,10 @@ state active Dialog(g_kMenuUser, sPrompt, lButtons, ["+ Add Items", "- Rem Items", setor((g_sPath == ""), UPMENU, "^ UP")]+lLockOption, 0, g_iMenuUser, "FolderBrowser~"); } else if(iChan == g_iFindChn) { - if(g_iCmdMode & F_RECURSIVE){ + if(llStringTrim(sMsg,STRING_TRIM)==""){ + llMessageLinked(LINK_SET, NOTIFY, "0Nothing matching that term was found in #RLV!", g_kChatUser); + return; // don't do anything if + } if(g_iCmdMode & F_RECURSIVE){ if(g_iCmdMode & F_ADD){ llOwnerSay("@attachallover:"+sMsg+"=force"); } else if(g_iCmdMode & F_WEAR){ From 46e7f65e3d59821ca55053b05ad4edce9c232e91 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 13 May 2022 01:18:28 +0000 Subject: [PATCH 22/97] Update oc_outfits.lsl makes the changes suggested by https://github.com/OpenCollarTeam/OpenCollar/pull/781#issuecomment-1125540441 and removes the separate version check --- src/Apps/oc_outfits.lsl | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 206725e4c..2476e3d0a 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -340,14 +340,6 @@ default } state_entry(){ llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); - llListen(999988, "", llGetOwner(), ""); - llOwnerSay("@versionnew=999988"); - } - listen(integer iChan, string sName, key kID, string sMsg) - { - if(~llSubStringIndex(sMsg, "RLVa")){ - g_iRLVa=TRUE; - }else g_iRLVa=FALSE; } link_message(integer iSender, integer iNum, string sStr, key kID){ if(iNum == REBOOT){ @@ -370,10 +362,16 @@ state active { if(llGetStartParameter()!=0)llResetScript(); g_kWearer = llGetOwner(); - llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global_locked",""); + //llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global_locked",""); + llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "ALL",""); } link_message(integer iSender,integer iNum,string sStr,key kID){ if(iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) UserCommand(iNum, sStr, kID); + else if(iNum == RLV_VERSION || iNum == RLVA_VERSION ){ + if(~llSubStringIndex(sStr, "RLVa")){ + g_iRLVa=TRUE; + }else g_iRLVa=FALSE; + } else if(iNum == MENUNAME_REQUEST && sStr == g_sParentMenu) llMessageLinked(iSender, MENUNAME_RESPONSE, g_sParentMenu+"|"+ g_sSubMenu,""); else if(iNum == -99999){ From b8ddb23654561cef638c266898f068a8820d33a9 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 13 May 2022 01:22:58 +0000 Subject: [PATCH 23/97] Update oc_outfits.lsl --- src/Apps/oc_outfits.lsl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 2476e3d0a..c8dc730d4 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -59,8 +59,13 @@ integer MENUNAME_RESPONSE = 3001; integer OUTFITS_ADD = -999901; integer OUTFITS_REM = -999902; -//integer RLV_CMD = 6000; -//integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. +integer RLV_CMD = 6000; +integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. +integer DO_RLV_REFRESH = 26001;//RLV plugins should reinstate their restrictions upon receiving this message. +integer RLV_CLEAR = 6002;//RLV plugins should clear their restriction lists upon receiving this message. +integer RLV_VERSION = 6003; //RLV Plugins can recieve the used RLV viewer version upon receiving this message.. +integer RLVA_VERSION = 6004; //RLV Plugins can recieve the used RLVa viewer version upon receiving this message.. +integer RLV_CMD_OVERRIDE=6010; //RLV Plugins can send one-shot (force) commands with a list of restrictions to temporarily lift if required to ensure that the one-shot commands can be executed //integer RLV_OFF = 6100; // send to inform plugins that RLV is disabled now, no message or key needed //integer RLV_ON = 6101; // send to inform plugins that RLV is enabled now, no message or key needed From 2f055c9991ca1d86bda1ca40567597e702a89209 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 17 May 2022 10:46:54 -0500 Subject: [PATCH 24/97] Create Cuff Themes oc_cuff_themes is an optional script which eavesdrops on collar addon messages watching for theme change requests. The normal oc_themes must also be in the collar. If a matching theme notecard is found in the cuff, it is applied. --- src/cuffs/oc_cuff_themes.lsl | 475 +++++++++++++++++++++++++++++++++++ 1 file changed, 475 insertions(+) create mode 100644 src/cuffs/oc_cuff_themes.lsl diff --git a/src/cuffs/oc_cuff_themes.lsl b/src/cuffs/oc_cuff_themes.lsl new file mode 100644 index 000000000..f43551416 --- /dev/null +++ b/src/cuffs/oc_cuff_themes.lsl @@ -0,0 +1,475 @@ +/* +This file is a part of OpenCollar. +Copyright ©2021 +: Contributors : +Aria (Tashia Redrose) + * Oct 2020 - Created oc_themes +Kristen Mynx + * May 2022 - Modify to oc_cuff_themes +et al. +Licensed under the GPLv2. See LICENSE for full details. +https://github.com/OpenCollarTeam/OpenCollar +*/ + +integer API_CHANNEL = 0x60b97b5e; +string g_sParentMenu = "Apps"; +string g_sSubMenu = "Themes"; + + +integer g_iHide; + +//MESSAGE MAP +//integer CMD_ZERO = 0; +integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +integer CMD_WEARER = 503; +//integer CMD_EVERYONE = 504; +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; + +integer NOTIFY = 1002; +integer REBOOT = -1000; + +integer LM_SETTING_SAVE = 2000;//scripts send messages on this channel to have settings saved +//str must be in form of "token=value" +//integer LM_SETTING_REQUEST = 2001;//when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002;//the settings script sends responses on this channel +integer LM_SETTING_DELETE = 2003;//delete token from settings +//integer LM_SETTING_EMPTY = 2004;//sent when a token has no value + +integer MENUNAME_REQUEST = 3000; +integer MENUNAME_RESPONSE = 3001; +//integer MENUNAME_REMOVE = 3003; + +//integer RLV_CMD = 6000; +//integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. + +//integer RLV_OFF = 6100; // send to inform plugins that RLV is disabled now, no message or key needed +//integer RLV_ON = 6101; // send to inform plugins that RLV is enabled now, no message or key needed + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; +string UPMENU = "BACK"; +//string ALL = "ALL"; + +// Obtained from somewhere on the SL Wiki. TODO: Add credits for the origin of this function's code. +string gp(integer perm) +{ + integer fullPerms = PERM_COPY | PERM_MODIFY | PERM_TRANSFER; + integer copyModPerms = PERM_COPY | PERM_MODIFY; + integer copyTransPerms = PERM_COPY | PERM_TRANSFER; + integer modTransPerms = PERM_MODIFY | PERM_TRANSFER; + + string output = ""; + + if ((perm & fullPerms) == fullPerms) + output += "full"; + else if ((perm & copyModPerms) == copyModPerms) + output += "copy & modify"; + else if ((perm & copyTransPerms) == copyTransPerms) + output += "copy & transfer"; + else if ((perm & modTransPerms) == modTransPerms) + output += "modify & transfer"; + else if ((perm & PERM_COPY) == PERM_COPY) + output += "copy"; + else if ((perm & PERM_TRANSFER) == PERM_TRANSFER) + output += "transfer"; + else + output += "none"; + + // Remember, items in Second Life must have either + // PERM_COPY or PERM_TRANSFER when "talking about" + // owner perms or perms for next owner. + + return output; +} + +integer g_iAllowHide = 1; +//integer g_iHidden; +ToggleCollarAlpha(integer iHide){ // iHide is inverted for the alpha masking. + integer i=0; + integer end = llGetNumberOfPrims(); + for(i=1;i<=end;i++){ + string desc = llList2String(llGetLinkPrimitiveParams(i, [PRIM_DESC]),0); + list lElements = llParseStringKeepNulls(desc,["~"],[]); + if(llListFindList(lElements,["nohide"])==-1){ + llSetLinkAlpha(i, iHide, ALL_SIDES); + } + if(iHide){ + if(llListFindList(lElements, ["OpenLock"])!=-1){ + //llSay(0, "open lock prim found. Setting alpha: "+(string)(!g_iLocked)); + if(g_iLocked) + llSetLinkAlpha(i, FALSE, ALL_SIDES); + else + llSetLinkAlpha(i, TRUE, ALL_SIDES); + } + if(llListFindList(lElements, ["ClosedLock"])!=-1 || llListFindList(lElements, ["Lock"]) != -1) + { + //llSay(0, "closed lock prim found. Setting alpha: "+(string)g_iLocked); + if(g_iLocked) + llSetLinkAlpha(i, TRUE, ALL_SIDES); + else + llSetLinkAlpha(i, FALSE, ALL_SIDES); + } + } + } +} + + +list g_lDSRequests; +key NULL=NULL_KEY; +UpdateDSRequest(key orig, key new, string meta){ + if(orig == NULL){ + g_lDSRequests += [new,meta]; + }else { + integer index = HasDSRequest(orig); + if(index==-1)return; + else{ + g_lDSRequests = llListReplaceList(g_lDSRequests, [new,meta], index,index+1); + } + } +} + +string GetDSMeta(key id){ + integer index=llListFindList(g_lDSRequests,[id]); + if(index==-1){ + return "N/A"; + }else{ + return llList2String(g_lDSRequests,index+1); + } +} + +integer HasDSRequest(key ID){ + return llListFindList(g_lDSRequests, [ID]); +} + +DeleteDSReq(key ID){ + if(HasDSRequest(ID)!=-1) + g_lDSRequests = llDeleteSubList(g_lDSRequests, HasDSRequest(ID), HasDSRequest(ID)+1); + else return; +} + +list g_lThemes; +ScanThemes(){ + g_lThemes = []; + + integer i=0; + integer end = llGetInventoryNumber(INVENTORY_NOTECARD); + for(i=0;i=700){ + llOwnerSay(sBuffer); + llSleep(0.05); + sBuffer = ""; + } +} +EFlush(key kID){ + llOwnerSay(sBuffer); + sBuffer=""; +} +PrintCurrentProperties(key kID){ + // Output the current properties using the theme notecard format + E(kID, "Simply paste the content to follow into a notecard with a name you want, for example: for a theme to be named Test, (ex. Test.theme)"); + integer i=LINK_ROOT; + integer end = llGetNumberOfPrims(); + + for(i=1;i<=end;i++){ + E(kID, "["+(string)i+"/"+(string)llGetLinkName(i)+"/0]"); + E(kID, "#If you set the 0 at the end of the brackets above to a 1, then it will require that the prim's number (beginning of line), and the prims name (middle part) match. Otherwise if this is a zero, as it is by default, then the prim will only go off the prim number."); + list lParams = llGetLinkPrimitiveParams(i, [PRIM_DESC, PRIM_POS_LOCAL, PRIM_ROT_LOCAL, PRIM_SIZE, PRIM_NAME]); + integer sides = llGetLinkNumberOfSides(i); + E(kID, "desc = "+llList2String(lParams,0)); + E(kID, "pos = "+llList2String(lParams,1)); + E(kID, "rot = "+llList2String(lParams,2)); + E(kID, "scale = "+llList2String(lParams,3)); + E(kID, "name = "+llList2String(lParams,4)); + integer ix=0; + for(ix=0;ix= CMD_OWNER && iCmd <= CMD_WEARER) // authorized + { + key kAv = llList2Key(lMenuParams,1); + string sMsg = llList2String(lMenuParams,1); + if(llGetInventoryType(sMsg+".theme")==INVENTORY_NOTECARD){ + E(kAv, "Applying Theme to cuff.."); + g_lDSRequests=[]; + UpdateDSRequest(NULL, llGetNotecardLine(sMsg+".theme",0), "read_theme:0:"+sMsg+":-1:0"); + } + } + } else if(iNum == LM_SETTING_RESPONSE){ + // Detect here the Settings + list lSettings = llParseString2List(sMsg, ["_","="],[]); + string sToken = llList2String(lSettings,0); + string sVar = llList2String(lSettings,1); + string sVal = llList2String(lSettings,2); + if(sToken=="global"){ + if(sVar=="allowhide"){ + g_iAllowHide=(integer)sVal; + } + } + } + } + } + } + dataserver(key kID, string sData){ + if(HasDSRequest(kID)!=-1){ + if(sData==EOF){ + //End of file + string meta = GetDSMeta(kID); + list lTmp = llParseString2List(meta,[":"],[]); + if((g_sTmp != "" && g_sTmp != "{}"))E(llGetOwner(), "The following was not used for the prim : "+llList2String(lTmp,3)+" : "+g_sTmp); + g_sTmp=""; // clear any remaining temporary memory + DeleteDSReq(kID); + llOwnerSay("Theme notecard read"); + if(llList2String(lTmp,4)!="0") + E(llGetOwner(), llList2String(lTmp,4)+" sections of this theme had errors."); + + } else { + string sMeta = GetDSMeta(kID); + list lTmp = llParseString2List(sMeta,[":"],[]); + if(llList2String(lTmp,0)=="read_theme"){ + integer iLine = (integer)llList2String(lTmp,1); + string noteLabel = llList2String(lTmp,2); + integer iPrim = (integer)llList2String(lTmp,3); + string sPrim; + integer iErrors = (integer)llList2String(lTmp,4); + iLine++; + + list lData = llParseString2List(sData, ["/"],["[","]"]); + if(llList2String(lData,0) == "[" && llList2String(lData,-1) == "]"){ + if(g_sTmp!="" && g_sTmp!="{}"){ + iErrors++; + E(llGetOwner(), "Data not used for prim ("+(string)iPrim+"): "+g_sTmp); + } + + g_sTmp=""; // Clear the temporary memory + iPrim = (integer)llList2String(lData,1); + sPrim = llList2String(lData,2); + if((llGetLinkName(iPrim)==sPrim && llList2String(lData,3)=="1") || llList2String(lData,3)=="0"){ + // do nothing here. Just read next line, the params have already been adjusted. + }else { + iErrors++; + iPrim=-1; // Prevent settings from being applied until we reach the next prim. + } + }else { + if(iPrim==-1)jump over; + // parameter line + list lParam = []; + if(llGetSubString(sData,0,0)=="#"){ + // comment line. Ignore it + }else { + list lProp = llParseStringKeepNulls(sData, [": ", " = "],["!"]); + if(llList2String(lProp,0)=="")lProp=llDeleteSubList(lProp,0,0); + + + if(llList2String(lProp,0)=="!"){ + // Face parameter line + integer iFace = (integer)llList2String(lProp,1); + + if(llList2String(lProp,2) == "color"){ + g_sTmp = llJsonSetValue(g_sTmp,["color"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "alpha"){ + g_sTmp = llJsonSetValue(g_sTmp, ["alpha"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "texture"){ + g_sTmp = llJsonSetValue(g_sTmp, ["texture"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "texture_repeat"){ + g_sTmp = llJsonSetValue(g_sTmp,["texture_repeat"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "texture_offset"){ + g_sTmp = llJsonSetValue(g_sTmp, ["texture_offset"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "texture_rot"){ + g_sTmp = llJsonSetValue(g_sTmp, ["texture_rot"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "glow"){ + lParam += [PRIM_GLOW, iFace, (float)llList2String(lProp,3)]; + } else if(llList2String(lProp,2) == "normal"){ + g_sTmp = llJsonSetValue(g_sTmp, ["normal"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "normal_repeat"){ + g_sTmp = llJsonSetValue(g_sTmp,["normal_repeat"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "normal_offset"){ + g_sTmp = llJsonSetValue(g_sTmp, ["normal_offset"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "normal_rot"){ + g_sTmp = llJsonSetValue(g_sTmp, ["normal_rot"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_repeat"){ + g_sTmp = llJsonSetValue(g_sTmp,["specular_repeat"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_offset"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular_offset"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_rot"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular_rot"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_color"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular_color"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_glossiness"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular_glossiness"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "specular_environment"){ + g_sTmp = llJsonSetValue(g_sTmp, ["specular_environment"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "fullbright"){ + lParam += [PRIM_FULLBRIGHT, iFace, (integer)llList2String(lProp,3)]; + } else if(llList2String(lProp,2) == "shiny"){ + g_sTmp = llJsonSetValue(g_sTmp, ["shiny"], llList2String(lProp,3)); + } else if(llList2String(lProp,2) == "bump"){ + g_sTmp = llJsonSetValue(g_sTmp, ["bump"], llList2String(lProp,3)); + } + //if(g_sTmp!="") + // llSay(0, "Applier Json: "+g_sTmp); + + + if(llJsonValueType(g_sTmp, ["color"])!= JSON_INVALID && llJsonValueType(g_sTmp,["alpha"])!=JSON_INVALID){ + lParam += [PRIM_COLOR, iFace, (vector)llJsonGetValue(g_sTmp, ["color"]), (float)llJsonGetValue(g_sTmp,["alpha"])]; + g_sTmp = llJsonSetValue(g_sTmp, ["color"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp,["alpha"], JSON_DELETE); + } + if(llJsonValueType(g_sTmp,["texture"]) != JSON_INVALID && llJsonValueType(g_sTmp, ["texture_repeat"])!=JSON_INVALID && llJsonValueType (g_sTmp, ["texture_offset"])!=JSON_INVALID && llJsonValueType(g_sTmp,["texture_rot"])!=JSON_INVALID){ + lParam += [PRIM_TEXTURE, iFace, (key)llJsonGetValue(g_sTmp, ["texture"]), (vector)llJsonGetValue(g_sTmp, ["texture_repeat"]), (vector)llJsonGetValue(g_sTmp, ["texture_offset"]), (float)llJsonGetValue(g_sTmp, ["texture_rot"])]; + g_sTmp = llJsonSetValue(g_sTmp, ["texture"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["texture_repeat"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["texture_offset"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["texture_rot"], JSON_DELETE); + + } + if(llJsonValueType(g_sTmp,["normal"]) != JSON_INVALID&& llJsonValueType(g_sTmp, ["normal_repeat"])!=JSON_INVALID && llJsonValueType (g_sTmp, ["normal_offset"])!=JSON_INVALID && llJsonValueType(g_sTmp,["normal_rot"])!=JSON_INVALID){ + lParam += [PRIM_NORMAL, iFace, (key)llJsonGetValue(g_sTmp, ["normal"]), (vector)llJsonGetValue(g_sTmp, ["normal_repeat"]), (vector)llJsonGetValue(g_sTmp, ["normal_offset"]), (float)llJsonGetValue(g_sTmp, ["normal_rot"])]; + g_sTmp = llJsonSetValue(g_sTmp, ["normal"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["normal_repeat"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["normal_offset"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["normal_rot"], JSON_DELETE); + + } + if(llJsonValueType(g_sTmp,["specular"]) != JSON_INVALID && llJsonValueType(g_sTmp, ["specular_repeat"])!=JSON_INVALID && llJsonValueType (g_sTmp, ["specular_offset"])!=JSON_INVALID && llJsonValueType(g_sTmp,["specular_rot"])!=JSON_INVALID && llJsonValueType(g_sTmp, ["specular_color"]) != JSON_INVALID && llJsonValueType(g_sTmp, ["specular_glossiness"]) != JSON_INVALID && llJsonValueType(g_sTmp,["specular_environment"])!=JSON_INVALID){ + lParam += [PRIM_SPECULAR, iFace, (key)llJsonGetValue(g_sTmp, ["specular"]), (vector)llJsonGetValue(g_sTmp, ["specular_repeat"]), (vector)llJsonGetValue(g_sTmp, ["specular_offset"]), (float)llJsonGetValue(g_sTmp, ["specular_rot"]), (vector)llJsonGetValue(g_sTmp, ["specular_color"]), (integer)llJsonGetValue(g_sTmp, ["specular_glossiness"]), (integer)llJsonGetValue(g_sTmp, ["specular_environment"])]; + g_sTmp = llJsonSetValue(g_sTmp, ["specular"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_repeat"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_offset"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_rot"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_color"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_glossiness"], JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp, ["specular_environment"], JSON_DELETE); + + } + + if(llJsonValueType(g_sTmp,["shiny"])!=JSON_INVALID && llJsonValueType(g_sTmp,["bump"])!=JSON_INVALID){ + lParam += [PRIM_BUMP_SHINY, iFace, (integer)llJsonGetValue(g_sTmp, ["shiny"]), (integer)llJsonGetValue(g_sTmp,["bump"])]; + g_sTmp = llJsonSetValue(g_sTmp,["shiny"],JSON_DELETE); + g_sTmp = llJsonSetValue(g_sTmp,["bump"],JSON_DELETE); + } + } else { + // Prim parameter + if(llList2String(lProp,0)=="desc"){ + lParam += [PRIM_DESC, llList2String(lProp,1)]; + } else if(llList2String(lProp,0) == "pos"){ + lParam += [PRIM_POS_LOCAL, (vector)llList2String(lProp,1)]; + } else if(llList2String(lProp,0) == "rot"){ + lParam += [PRIM_ROT_LOCAL, (rotation)llList2String(lProp, 1)]; + } else if(llList2String(lProp,0) == "scale"){ + lParam += [PRIM_SIZE, (vector)llList2String(lProp,1)]; + } else if(llList2String(lProp,0)=="name"){ + lParam += [PRIM_NAME, llList2String(lProp,1)]; + } + } + } + + if(llGetListLength(lParam)>0){ + //llSay(0, "Apply : "+llDumpList2String(lParam,"~")); + llSetLinkPrimitiveParams(iPrim, lParam); + lParam=[]; + } + } + @over; + UpdateDSRequest(kID, llGetNotecardLine(noteLabel+".theme", iLine), "read_theme:"+(string)iLine+":"+noteLabel+":"+(string)iPrim+":"+(string)iErrors); + } + } + } + } +} From 839a5d03e0db78586500e5cf28a7a40d80b96d29 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 17 May 2022 11:09:00 -0500 Subject: [PATCH 25/97] Create Cuff Resizer oc_cuff_resizer adds a resizing option to the cuffs. It is optional. It is derived from the collar oc_resizer. Minimal changes are required to support it in oc_cuff. If oc_cuff_resizer is missing, oc_cuff silently ignores it. --- src/cuffs/oc_cuff.lsl | 10 +- src/cuffs/oc_cuff_resizer.lsl | 398 ++++++++++++++++++++++++++++++++++ 2 files changed, 407 insertions(+), 1 deletion(-) create mode 100644 src/cuffs/oc_cuff_resizer.lsl diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index fbdec8f88..24446caf3 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -11,6 +11,8 @@ Lilith (Lilith Xue) Ping (Pingout Duffield) * February 2022 - Add code to allow RLV Restrictions to clear between poses * April 2022 - Remove SyncLock, Clean Up Script Style +Kristen Mynx + * May 2022 - Added resizer support et al. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -168,7 +170,10 @@ Menu(key kID, integer iAuth) { lButtons+=["Pose"]; else sPrompt +="\nPoses not available while the Collar is hidden"; } - + if(llGetInventoryType("oc_cuff_resizer")==INVENTORY_SCRIPT){ + if(!g_iHidden) + lButtons+=["Cuff Resize"]; + } if(iAuth == CMD_OWNER) { lButtons+=["ClearChains"]; } @@ -721,6 +726,9 @@ default llMessageLinked(LINK_SET,9, (string)kAv, (string)iAuth); // Retrieve the pose menu button names //PosesMenu(kAv,iAuth,0); //llSay(0, "This is an example addon."); + } else if(sMsg == "Cuff Resize"){ + iRespring=FALSE; + llMessageLinked(LINK_SET,31, (string)kAv, (string)iAuth); } else if(sMsg == "TEST CHAINS"){ //llSay(0, "Chain Test Program"); //llSay(0, "Chaining frlac > fllac | bllac > brlac"); diff --git a/src/cuffs/oc_cuff_resizer.lsl b/src/cuffs/oc_cuff_resizer.lsl new file mode 100644 index 000000000..4a4f195d9 --- /dev/null +++ b/src/cuffs/oc_cuff_resizer.lsl @@ -0,0 +1,398 @@ +// This file is part of OpenCollar. +// Copyright (c) 2008 - 2021 Nandana Singh, Lulu Pink, Garvin Twine, +// Cleo Collins, Master Starship, Joy Stipe, Wendy Starfall, littlemousy, +// Romka Swallowtail et al. +// Licensed under the GPLv2. See LICENSE for full details. + +// Kristen Mynx May 2022 +// oc_cuff_resizer derived from oc_resizer (from collar) + +// Based on a split of OpenCollar - appearance by Romka Swallowtail +// Virtual Disgrace - Resizer is derivative of OpenCollar - adjustment + +string g_sScriptVersion = "8.1"; +string g_sAddon = "OpenCollar Cuffs"; + +integer LINK_CMD_DEBUG=1999; +string g_sSubMenu = "Cuff Resize"; +string g_sParentMenu = "Cuff Resize"; + +integer API_CHANNEL = 0x60b97b5e; + +list g_lMenuIDs;//3-strided list of avkey, dialogid, menuname +integer g_iMenuStride = 3; + +string POSMENU = "Position"; +string ROTMENU = "Rotation"; +string SIZEMENU = "Size"; + +float g_fSmallNudge=0.0005; +float g_fMediumNudge=0.005; +float g_fLargeNudge=0.05; +float g_fNudge=0.005; // g_fMediumNudge; +float g_fRotNudge; + +// SizeScale + +list SIZEMENU_BUTTONS = [ "-1%", "-2%", "-5%", "-10%", "+1%", "+2%", "+5%", "+10%", "100%" ]; // buttons for menu +list g_lSizeFactors = [-1, -2, -5, -10, 1, 2, 5, 10, -1000]; // actual size factors +vector g_vStartScale; +integer g_iScaleFactor = 100; // the size on rez is always regarded as 100% to preven problem when scaling an item +10% and than - 10 %, which would actuall lead to 99% of the original size +integer g_iSizedByScript = FALSE; // prevent reseting of the script when the item has been chnged by the script + +//MESSAGE MAP +//integer CMD_ZERO = 0; +integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +//integer CMD_WEARER = 503; +integer CMD_EVERYONE = 504; +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; +//integer CMD_BLOCKED = 520; + +integer NOTIFY = 1002; +//integer SAY = 1004; +//integer LM_SETTING_SAVE = 2000; +//integer LM_SETTING_REQUEST = 2001; +//integer LM_SETTING_RESPONSE = 2002; +//integer LM_SETTING_DELETE = 2003; +//integer LM_SETTING_EMPTY = 2004; +integer REBOOT = -1000; +integer MENUNAME_REQUEST = 3000; +integer MENUNAME_RESPONSE = 3001; +integer MENUNAME_REMOVE = 3003; + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; + +string UPMENU = "BACK"; +key g_kCollar; +key g_kWearer; + +//string g_sSettingToken = "resizer_"; +//string g_sGlobalToken = "global_"; + +/* +integer g_iProfiled=1; +Debug(string sStr) { + //if you delete the first /g_sDeviceType/ from the preceeding and following lines, + // profiling is off, debug is off, and the compiler will remind you to + // remove the debug calls from the code, we're back to production mode + if (!g_iProfiled){ + g_iProfiled=1; + llScriptProfiler(1); + } + llOwnerSay(llGetScriptName() + "(min free:"+(string)(llGetMemoryLimit()-llGetSPMaxMemory())+")["+(string)llGetFreeMemory()+"] :\n" + sStr); +} +*/ + +/* +Dialog(key kRCPT, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sMenuType) { + key kMenuID = llGenerateKey(); + llMessageLinked(LINK_SET, DIALOG, (string)kRCPT + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); + //Debug("Made menu."); + integer iIndex = llListFindList(g_lMenuIDs, [kRCPT]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kRCPT, kMenuID, sMenuType], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kRCPT, kMenuID, sMenuType]; +} +*/ +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { + key kMenuID = llGenerateKey(); + + llRegionSayTo(g_kCollar,API_CHANNEL, llList2Json(JSON_OBJECT, [ "pkt_type", "from_addon", "addon_name", g_sAddon, "iNum", DIALOG, "sMsg", (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, "kID", kMenuID ])); + + integer iIndex = llListFindList(g_lMenuIDs, [kID]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [ kID, kMenuID, sName ], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kID, kMenuID, sName]; +} + +Link(string packet, integer iNum, string sStr, key kID){ + list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; + + string pkt = llList2Json(JSON_OBJECT, packet_data); + if (g_kCollar != "" && g_kCollar != NULL_KEY) + { + llRegionSayTo(g_kCollar, API_CHANNEL, pkt); + } + else + { + llRegionSay(API_CHANNEL, pkt); + } +} + +Store_StartScale() { + g_vStartScale = llGetScale(); + g_iScaleFactor = 100; +} + +Scale(integer iScale, integer iRezSize, key kAV) { + vector vSize = llGetScale(); + vector vDestSize = g_vStartScale * (iScale*0.01); + if (iRezSize) vDestSize = g_vStartScale; + float fScale = vDestSize.x / vSize.x ; + g_iSizedByScript = TRUE; + // use new scale function integer llScaleByFactor( float scaling_factor ); + // http://wiki.secondlife.com/wiki/LlScaleByFactor + if (llScaleByFactor(fScale)==TRUE) { + g_iScaleFactor = iScale; + Link("from_addon",NOTIFY,"1"+"Scaling finished, the %DEVICETYPE% is now on "+ (string)g_iScaleFactor +"% of the rez size.",kAV); + } else Link("from_addon",NOTIFY,"1"+ "The object cannot be scaled as you requested; prims would surpass minimum or maximum size.",kAV); +} + +ForceUpdate() { + //workaround for https://jira.secondlife.com/browse/VWR-1168 + llSetText(".", <1,1,1>, 1.0); + llSetText("", <1,1,1>, 1.0); +} + +vector ConvertPos(vector pos) { + integer ATTACH = llGetAttached(); + vector out ; + if (ATTACH == 1) { out.x = -pos.y; out.y = pos.z; out.z = pos.x; } + else if (ATTACH == 9) { out.x = -pos.y; out.y = -pos.z; out.z = -pos.x; } + else if (ATTACH == 39) { out.x = pos.x; out.y = -pos.y; out.z = pos.z; } + else if (ATTACH == 5 || ATTACH == 20 || ATTACH == 21 ) { out.x = pos.x; out.y = -pos.z; out.z = pos.y ; } + else if (ATTACH == 6 || ATTACH == 18 || ATTACH == 19 ) { out.x = pos.x; out.y = pos.z; out.z = -pos.y; } + else out = pos ; + return out ; +} + +AdjustPos(vector vDelta) { + if (llGetAttached()) llSetPos(llGetLocalPos() + ConvertPos(vDelta)); + ForceUpdate(); +} + +vector ConvertRot(vector rot) { + integer ATTACH = llGetAttached(); + vector out ; + if (ATTACH == 1) { out.x = -rot.y; out.y = -rot.z; out.z = -rot.x; } + else if (ATTACH == 9) { out.x = -rot.y; out.y = rot.z; out.z = rot.x; } + else if (ATTACH == 39) { out.x = -rot.x; out.y = -rot.y; out.z = -rot.z; } + else if (ATTACH == 5 || ATTACH == 20 || ATTACH == 21) { out.x = rot.x; out.y = -rot.z; out.z = rot.y; } + else if (ATTACH == 6 || ATTACH == 18 || ATTACH == 19) { out.x = rot.x; out.y = rot.z; out.z = -rot.y; } + else out = rot ; + return out ; +} + +AdjustRot(vector vDelta) { + if (llGetAttached()) llSetLocalRot(llGetLocalRot() * llEuler2Rot(ConvertRot(vDelta))); + ForceUpdate(); +} + +RotMenu(key kAv, integer iAuth) { + string sPrompt = "\nHere you can tilt and rotate the Cuff."; + list lMyButtons = ["tilt up ↻", "left ↶", "tilt left ↙", "tilt down ↺", "right ↷", "tilt right ↘"];// ria change + Dialog(kAv, sPrompt, lMyButtons, [UPMENU], 0, iAuth,ROTMENU); +} + +PosMenu(key kAv, integer iAuth) { + string sPrompt = "\nHere you can nudge the Cuff in place.\n\nCurrent nudge strength is: "; + list lMyButtons = ["left ←", "up ↑", "forward ↳", "right →", "down ↓", "backward ↲"];// ria iChange + if (g_fNudge!=g_fSmallNudge) lMyButtons+=["▁"]; + else sPrompt += "▁"; + if (g_fNudge!=g_fMediumNudge) lMyButtons+=["▁ ▂"]; + else sPrompt += "▁ ▂"; + if (g_fNudge!=g_fLargeNudge) lMyButtons+=["▁ ▂ ▃"]; + else sPrompt += "▁ ▂ ▃"; + Dialog(kAv, sPrompt, lMyButtons, [UPMENU], 0, iAuth,POSMENU); +} + +SizeMenu(key kAv, integer iAuth) { + string sPrompt = "\nNumbers are based on the original size of the Cuff.\n\nCurrent size: " + (string)g_iScaleFactor + "%"; + Dialog(kAv, sPrompt, SIZEMENU_BUTTONS, [UPMENU], 0, iAuth,SIZEMENU); +} + +DoMenu(key kAv, integer iAuth) { + list lMyButtons ; + string sPrompt; + sPrompt = "\nChange the position, rotation and size of your Cuff."; + lMyButtons = [POSMENU, ROTMENU, SIZEMENU]; + Dialog(kAv, sPrompt, lMyButtons, [UPMENU], 0, iAuth,g_sSubMenu); +} + +UserCommand(integer iNum, string sStr, key kID) { + list lParams = llParseString2List(sStr, [" "], []); + string sCommand = llToLower(llList2String(lParams, 0)); + // string sValue = llToLower(llList2String(lParams, 1)); + if (sCommand == "menu" && llGetSubString(sStr, 5, -1) == g_sSubMenu) { + if (kID!=g_kWearer && iNum!=CMD_OWNER) { + Link("from_addon",NOTIFY,"0"+"%NOACCESS% to resizer",kID); + llMessageLinked(LINK_SET, 33, (string)kID, (key)((string)iNum)); + } else DoMenu(kID, iNum); + } else if (sStr == "appearance") { + if (kID!=g_kWearer && iNum!=CMD_OWNER) Link("from_addon",NOTIFY,"0"+"%NOACCESS% to appearance",kID); + else DoMenu(kID, iNum); + } else if (sStr == "rotation") { + if (kID!=g_kWearer && iNum!=CMD_OWNER) Link("from_addon",NOTIFY,"0"+"%NOACCESS% to rotation",kID); + else RotMenu(kID, iNum); + } else if (sStr == "position") { + if (kID!=g_kWearer && iNum!=CMD_OWNER) Link("from_addon",NOTIFY,"0"+"%NOACCESS% to position",kID); + else PosMenu(kID, iNum); + } else if (sStr == "size") { + if (kID!=g_kWearer && iNum!=CMD_OWNER) Link("from_addon",NOTIFY,"0"+"%NOACCESS% to size",kID); + else SizeMenu(kID, iNum); + } else if (sStr == "rm resizer") { + if (kID!=g_kWearer && iNum!=CMD_OWNER) Link("from_addon",NOTIFY,"0"+"%NOACCESS% to uninstall resizer",kID); + else Dialog(kID, "\nDo you really want to remove the Resizer?", ["Yes","No","Cancel"], [], 0, iNum,"rmresizer"); + } +} + +integer ALIVE = -55; +integer READY = -56; +integer STARTUP = -57; +default +{ + + state_entry() { + //llSetMemoryLimit(40960); //2015-05-16 (5612 bytes free) + g_kWearer = llGetOwner(); + g_fRotNudge = PI / 32.0;//have to do this here since we can't divide in a global var declaration + Store_StartScale(); + API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; + llListen(API_CHANNEL, "", "", ""); //Debug("Starting"); + } + + listen(integer channel, string name, key id, string msg){ + if(channel==API_CHANNEL){ + string sPacketType = llJsonGetValue(msg, ["pkt_type"]); + if(sPacketType == "from_collar"){ + // process link message if in range of addon + if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0) + { + if (g_kCollar == "" || g_kCollar == NULL_KEY) g_kCollar = id; + integer iNum = (integer) llJsonGetValue(msg, ["iNum"]); + string sStr = llJsonGetValue(msg, ["sMsg"]); + key kID = (key) llJsonGetValue(msg, ["kID"]); + + +//------------ + + if (iNum == MENUNAME_REQUEST && sStr == g_sParentMenu) + Link("from_addon", MENUNAME_RESPONSE, g_sParentMenu + "|" + g_sSubMenu, ""); + else if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) + UserCommand( iNum, sStr, kID); + else if (iNum == DIALOG_RESPONSE) { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if (iMenuIndex != -1) { + list lMenuParams = llParseString2List(sStr, ["|"], []); + key kAv = (key)llList2String(lMenuParams, 0); + string sMessage = llList2String(lMenuParams, 1); + // integer iPage = (integer)llList2String(lMenuParams, 2); + integer iAuth = (integer)llList2String(lMenuParams, 3); + string sMenuType = llList2String(g_lMenuIDs, iMenuIndex + 1); + //remove stride from g_lMenuIDs + //we have to subtract from the index because the dialog id comes in the middle of the stride + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); + if (sMenuType == g_sSubMenu) { + if (sMessage == UPMENU) llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + else if (sMessage == POSMENU) PosMenu(kAv, iAuth); + else if (sMessage == ROTMENU) RotMenu(kAv, iAuth); + else if (sMessage == SIZEMENU) SizeMenu(kAv, iAuth); + } else if (sMenuType == POSMENU) { + if (sMessage == UPMENU) { + llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + return; + } else if (llGetAttached()) { + if (sMessage == "forward ↳") AdjustPos(); + else if (sMessage == "left ←") AdjustPos(<0, g_fNudge, 0>); + else if (sMessage == "up ↑") AdjustPos(<0, 0, g_fNudge>); + else if (sMessage == "backward ↲") AdjustPos(<-g_fNudge, 0, 0>); + else if (sMessage == "right →") AdjustPos(<0, -g_fNudge, 0>); + else if (sMessage == "down ↓") AdjustPos(<0, 0, -g_fNudge>); + else if (sMessage == "▁") g_fNudge=g_fSmallNudge; + else if (sMessage == "▁ ▂") g_fNudge=g_fMediumNudge; + else if (sMessage == "▁ ▂ ▃") g_fNudge=g_fLargeNudge; + } else Link("from_addon",NOTIFY,"0"+"Sorry, position can only be adjusted while worn",kID); + PosMenu(kAv, iAuth); + } else if (sMenuType == ROTMENU) { + if (sMessage == UPMENU) { + llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + return; + } else if (llGetAttached()) { + if (sMessage == "tilt right ↘") AdjustRot(); + else if (sMessage == "tilt up ↻") AdjustRot(<0, g_fRotNudge, 0>); + else if (sMessage == "left ↶") AdjustRot(<0, 0, g_fRotNudge>); + else if (sMessage == "right ↷") AdjustRot(<0, 0, -g_fRotNudge>); + else if (sMessage == "tilt left ↙") AdjustRot(<-g_fRotNudge, 0, 0>); + else if (sMessage == "tilt down ↺") AdjustRot(<0, -g_fRotNudge, 0>); + } else Link("from_addon",NOTIFY,"0"+"Sorry, position can only be adjusted while worn",kID); + RotMenu(kAv, iAuth); + } else if (sMenuType == SIZEMENU) { + if (sMessage == UPMENU) { + llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + return; + } else { + integer iMenuCommand = llListFindList(SIZEMENU_BUTTONS, [sMessage]); + if (iMenuCommand != -1) { + integer iSizeFactor = llList2Integer(g_lSizeFactors, iMenuCommand); + if (iSizeFactor == -1000) { + if (g_iScaleFactor == 100) + Link("from_addon",NOTIFY,"0"+"Resizing canceled; the Cuff is already at original size.",kID); + else Scale(100, TRUE, kAv); + } + else Scale(g_iScaleFactor + iSizeFactor, FALSE, kAv); + } + SizeMenu(kAv, iAuth); + } + } else if (sMenuType == "rmresizer") { + if (sMessage == "Yes") { + Link("from_addon",MENUNAME_REMOVE , g_sParentMenu + "|" + g_sSubMenu, ""); + Link("from_addon",NOTIFY, "1"+"Resizer has been removed.", kAv); + if (llGetInventoryType(llGetScriptName()) == INVENTORY_SCRIPT) llRemoveInventory(llGetScriptName()); + } else Link("from_addon",NOTIFY, "0"+"Resizer remains installed.", kAv); + } + } + } + else if (iNum == DIALOG_TIMEOUT) { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if (iMenuIndex != -1) { + //remove stride from g_lMenuIDs + //we have to subtract from the index because the dialog id comes in the middle of the stride + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); + } + } + else if (iNum == REBOOT && sStr == "reboot") llResetScript(); + else if(iNum == LINK_CMD_DEBUG){ + integer onlyver=0; + if(sStr == "ver")onlyver=1; + llInstantMessage(kID, llGetScriptName() +" SCRIPT VERSION: "+g_sScriptVersion); + if(onlyver)return; // basically this command was: versions + // The rest of this command can be access by debug + llInstantMessage(kID, llGetScriptName()+" SIZED BY SCRIPT: "+(string)g_iSizedByScript); + llInstantMessage(kID, llGetScriptName()+" SIZE FACTOR: "+(string)g_iScaleFactor); + } + + +//------------ + + } + } + } + } + link_message(integer iSender, integer iNum, string sStr, key kID) { + if(iNum == -1){ // oc_cuff sends this when it starts (which is also on_rez) + llResetScript(); + } else if (iNum == 31){ + DoMenu((key)sStr, (integer)((string)kID)); + } else if (iNum == 32){ + g_sAddon = sStr; + } + } + + timer() { + // the timer is needed as the changed_size even is triggered twice + llSetTimerEvent(0); + if (g_iSizedByScript) g_iSizedByScript = FALSE; + } + + changed(integer iChange) { + if (iChange & (CHANGED_SCALE)) { + if (g_iSizedByScript) llSetTimerEvent(0.5); + else Store_StartScale(); + } + if (iChange & (CHANGED_SHAPE | CHANGED_LINK)) Store_StartScale(); + } +} \ No newline at end of file From e0c4b91c2ad382bfe5bb0bc138a47b0df1ded54c Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 17 May 2022 12:47:35 -0500 Subject: [PATCH 26/97] Resize messages now say 'cuff' instead of 'collar' --- src/cuffs/oc_cuff_resizer.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuffs/oc_cuff_resizer.lsl b/src/cuffs/oc_cuff_resizer.lsl index 4a4f195d9..2779e62c4 100644 --- a/src/cuffs/oc_cuff_resizer.lsl +++ b/src/cuffs/oc_cuff_resizer.lsl @@ -138,7 +138,7 @@ Scale(integer iScale, integer iRezSize, key kAV) { // http://wiki.secondlife.com/wiki/LlScaleByFactor if (llScaleByFactor(fScale)==TRUE) { g_iScaleFactor = iScale; - Link("from_addon",NOTIFY,"1"+"Scaling finished, the %DEVICETYPE% is now on "+ (string)g_iScaleFactor +"% of the rez size.",kAV); + Link("from_addon",NOTIFY,"1"+"Scaling finished, the cuff is now on "+ (string)g_iScaleFactor +"% of the rez size.",kAV); } else Link("from_addon",NOTIFY,"1"+ "The object cannot be scaled as you requested; prims would surpass minimum or maximum size.",kAV); } From 2c6d1d2b621b3d6d23feb526d8075b78f511dc5b Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Thu, 19 May 2022 07:54:47 -0500 Subject: [PATCH 27/97] "offline" commands for addons corrupt addon list The section of code which removes an addon from the addon list (g_lAddons) when and 'offline' chat message is received removes one too many list elements, thereby corrupting the list. The stride is 5, but 6 elements (ipos, ipos+5 = 6) are removed. --- src/collar/oc_addons.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_addons.lsl b/src/collar/oc_addons.lsl index 1ea2c4991..7ca584bf2 100644 --- a/src/collar/oc_addons.lsl +++ b/src/collar/oc_addons.lsl @@ -369,7 +369,7 @@ state active { llOwnerSay("Pre-Addon Deletion List: "+llDumpList2String(g_lAddons,"~")); } - g_lAddons = llDeleteSubList(g_lAddons, iPos, iPos+5); + g_lAddons = llDeleteSubList(g_lAddons, iPos, iPos+4); if(g_iVerbosityLevel>=4) { llOwnerSay("Post-Addon Deletion List: "+llDumpList2String(g_lAddons,"~")); From 1fc34fe69663f05371e9cd6959789772c2c9d5d6 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 21 May 2022 14:26:03 -0500 Subject: [PATCH 28/97] Add New Theme menu item To dump a .theme notecard from the cuff --- src/cuffs/oc_cuff_themes.lsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cuffs/oc_cuff_themes.lsl b/src/cuffs/oc_cuff_themes.lsl index f43551416..7718a7cc1 100644 --- a/src/cuffs/oc_cuff_themes.lsl +++ b/src/cuffs/oc_cuff_themes.lsl @@ -269,6 +269,10 @@ default if(iNum == -1){ // oc_cuff sends this when it starts (which is also on_rez) llResetScript(); } + if (iNum == 32) // [New Theme] from oc_cuff script + { + PrintCurrentProperties(kID); + } } listen(integer channel, string name, key id, string msg){ if(channel==API_CHANNEL && llGetOwner() == llGetOwnerKey(id)){ // also be sure its a message from my collar From 325f6f899bc647e0bb13e381b05330c2a0522240 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 21 May 2022 14:29:26 -0500 Subject: [PATCH 29/97] Add New Theme support --- src/cuffs/oc_cuff.lsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index fbdec8f88..7af9ec695 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -167,6 +167,10 @@ Menu(key kID, integer iAuth) { if(!g_iHidden) lButtons+=["Pose"]; else sPrompt +="\nPoses not available while the Collar is hidden"; + if(llGetInventoryType("oc_cuff_themes")==INVENTORY_SCRIPT){ + if(!g_iHidden) + lButtons+=["New Theme"]; + } } if(iAuth == CMD_OWNER) { From 15a6a216b2e7e0f89aebacba44ddc02302f6fa1f Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 21 May 2022 15:10:50 -0500 Subject: [PATCH 30/97] Added Permisions check to Theme menu item --- src/cuffs/oc_cuff.lsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index 7af9ec695..e706f9f80 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -167,7 +167,8 @@ Menu(key kID, integer iAuth) { if(!g_iHidden) lButtons+=["Pose"]; else sPrompt +="\nPoses not available while the Collar is hidden"; - if(llGetInventoryType("oc_cuff_themes")==INVENTORY_SCRIPT){ + if(llGetInventoryType("oc_cuff_themes")==INVENTORY_SCRIPT + && (llGetObjectPermMask(MASK_OWNER) & (PERM_COPY | PERM_MODIFY | PERM_TRANSFER)) == (PERM_COPY | PERM_MODIFY | PERM_TRANSFER)){ if(!g_iHidden) lButtons+=["New Theme"]; } From afb80c4c276b3a0dcda4fcbfd944bc1ae8ef7bbb Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 24 May 2022 12:01:00 -0500 Subject: [PATCH 31/97] Remove message Addon: ..... removed because it has not been seen for 5 minutes --- src/collar/oc_addons.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_addons.lsl b/src/collar/oc_addons.lsl index 1ea2c4991..ee933e601 100644 --- a/src/collar/oc_addons.lsl +++ b/src/collar/oc_addons.lsl @@ -286,7 +286,7 @@ state active llOwnerSay("Pre-Addon Deletion List: "+llDumpList2String(g_lAddons,"~")); } SayToAddonX((key)llList2String(g_lAddons,i), "dc", 0, "", llGetOwner()); - llMessageLinked(LINK_SET, NOTIFY, "0Addon: "+llList2String(g_lAddons,i+1)+" has been removed because it has not been seen for 5 minutes or more.", g_kWearer); + //llMessageLinked(LINK_SET, NOTIFY, "0Addon: "+llList2String(g_lAddons,i+1)+" has been removed because it has not been seen for 5 minutes or more.", g_kWearer); g_lAddons = llDeleteSubList(g_lAddons, i, i+4); i=-5; // if we change the stride of the list this must be updated end=llGetListLength(g_lAddons); From 455a6c419052512c50f8c1189bbae3f2e2ed5aa9 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 24 May 2022 12:08:50 -0500 Subject: [PATCH 32/97] Remove ready message in oc_cuff_pose --- src/cuffs/oc_cuff_pose.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuffs/oc_cuff_pose.lsl b/src/cuffs/oc_cuff_pose.lsl index 77e2bf219..962432efd 100644 --- a/src/cuffs/oc_cuff_pose.lsl +++ b/src/cuffs/oc_cuff_pose.lsl @@ -141,7 +141,7 @@ string g_sCurrentPose = "NONE"; default { state_entry(){ - llOwnerSay(llGetScriptName()+" ready ("+(string)llGetFreeMemory()+"b)"); + //llOwnerSay(llGetScriptName()+" ready ("+(string)llGetFreeMemory()+"b)"); llRequestPermissions(llGetOwner(), PERMISSION_TRIGGER_ANIMATION); } From 99c7d8a6ca935da645b9136a5b8234abe91f501c Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Tue, 24 May 2022 12:10:59 -0500 Subject: [PATCH 33/97] Remove ready message from oc_cuff --- src/cuffs/oc_cuff.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index fbdec8f88..fd27ad9ce 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -477,7 +477,7 @@ default llSetTimerEvent(60); ToggleAlpha(FALSE); - llOwnerSay(g_sAddon+" ready ("+(string)llGetFreeMemory()+"b)"); + //llOwnerSay(g_sAddon+" ready ("+(string)llGetFreeMemory()+"b)"); } } } From 1057f6ca6d2fc2170b6d3616ea9b83ee456d44ee Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Wed, 25 May 2022 14:01:50 -0500 Subject: [PATCH 34/97] Remove DO_RLV_REFRESH and recheck_lock Both of these were used by the relay which is also being changed. DO_RLV_REFRESH caused clearing of all restrictions and exceptions. recheck_lock appeared to be an attempt to set detach=n again because of the DO_RLV_REFRESH. --- src/collar/oc_rlvsys.lsl | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index 2299a7b29..c953b8beb 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -11,6 +11,9 @@ Medea Destiny - not be restricted by wearer restictions. They can unset restrictions manually, perform the function, and then reset the restriction, but that's a lot of hassle. This performs the function automatically. Operator and wearer are notified of restrictions that have been temporarily restricted to avoid being misled that a restriciton is not present. +Kristen Mynx - + May 2022 - Removed DO_RLV_REFRESH and recheck_lock timer. Both of these were only used by + the relay, which is being changed at the same time. Check the comments in oc_relay. */ string g_sScriptVersion = "8.1"; @@ -65,7 +68,6 @@ integer MENUNAME_REMOVE = 3003; integer RLV_CMD = 6000; integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. -integer DO_RLV_REFRESH = 26001;//RLV plugins should reinstate their restrictions upon receiving this message. integer RLV_CLEAR = 6002;//RLV plugins should clear their restriction lists upon receiving this message. integer RLV_VERSION = 6003; //RLV Plugins can recieve the used RLV viewer version upon receiving this message.. integer RLVA_VERSION = 6004; //RLV Plugins can recieve the used RLVa viewer version upon receiving this message.. @@ -485,16 +487,7 @@ state active llMessageLinked(LINK_SET, RLV_ON, "", NULL_KEY); if (g_iRlvaVersion) llMessageLinked(LINK_SET, RLVA_VERSION, (string) g_iRlvaVersion, NULL_KEY); } - } else if(iNum == TIMEOUT_FIRED) - { - - if(sStr == "recheck_lock"){ - if(!g_iCollarLocked){ - llOwnerSay("@detach=y"); - } - } - - }else if(iNum == LM_SETTING_EMPTY){ + } else if(iNum == LM_SETTING_EMPTY){ //integer ind = llListFindList(g_lSettingsReqs, [sStr]); //if(ind!=-1)g_lSettingsReqs = llDeleteSubList(g_lSettingsReqs, ind,ind); @@ -624,12 +617,6 @@ state active if (kID==g_kSitter) llOwnerSay("@"+"sit:"+(string)g_kSitTarget+"=force"); //if we stored a sitter, sit on it rebakeSourceRestrictions(kID); } - } else if(iNum == DO_RLV_REFRESH){ - llOwnerSay("@clear"); - llOwnerSay("@detach=n"); - llMessageLinked(LINK_SET, TIMEOUT_REGISTER, "30", "recheck_lock"); - llMessageLinked(LINK_SET, RLV_REFRESH, "",""); - llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "ALL",""); } else if(iNum == RLV_CMD_OVERRIDE){ //New feature! RLV_CMD_OVERRIDE is designed to allow one-shot (force) commands to override current restrictions. This is done by sending the behavior(s) to send as a comma separated list, followed by a ~ and then the restrictions to temporarily lift as another comma separate list as as sMsg. EXAMPLE: llMessageLinked(LINK_THIS,RLV_CMD_OVERRIDE,"unsit~unsit","") will lift the current unsit restriction if present, issue an @unsit=force, then restore the unsit restriction if it was previously present. These commands should ONLY be sent if the issuer has OWNER auth. list lCommands=llParseString2List(llList2String(llParseString2List(sStr,["~"],[]),0),[","],[]); From 320f467d9b49273bffeaf6f55d2beebff6ee9294 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Wed, 25 May 2022 14:08:44 -0500 Subject: [PATCH 35/97] Fixed: all restrictions and exceptions cleared by the relay when !release or @clear was sent to the relay. --- src/collar/oc_relay.lsl | 81 +++++++++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index ab9f89d6c..40e0095c2 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -11,6 +11,13 @@ Aria (Tashia Redrose) Felkami (Caraway Ohmai) *Dec 2020 - Fixed #461, Modified runaway language to not assume relay on at runaway + + *May 2020 - Fixed bug: !release or @clear sent to the relay would clear all + restrictions and exceptions from the collar. Changed the relay to send all RLV + commands through RLV_CMD link messages instead of directly to the viewer. oc_rlvsys + will process them, and arbitrate between collar and relay restrictions and exceptions. + Also removed DO_RLV_REFRESH which cleared all restrictions and exceptions. + et al. Licensed under the GPLv2. See LICENSE for full details. @@ -30,26 +37,6 @@ list Restrictions; integer g_iResit_status; -Release(){ - - llRegionSayTo(Source, RLV_RELAY_CHANNEL, "release,"+(string)Source+",!release,ok"); - - integer i=0; - integer end=llGetListLength(Restrictions); - for(i=0;i Date: Thu, 26 May 2022 13:20:56 -0500 Subject: [PATCH 36/97] Verify Custom Exception UUID is a proper UUID Does not check if the UUID is a valid Avatar nor a valid Group. --- src/collar/oc_rlvextension.lsl | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 7c14b91d6..6ada78389 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -583,12 +583,19 @@ state active g_sTmpExceptionName=sMsg; MenuAddCustomExceptionID(kAv,iAuth); } else if(sMenu == "Exceptions~AddCustomID"){ - g_kTmpExceptionID = (key)sMsg; - llMessageLinked(LINK_SET,NOTIFY,"0Adding exception..", kAv); - g_lCustomExceptions += [g_sTmpExceptionName,g_kTmpExceptionID,0]; + if ((key)sMsg) // true if valid UUID, false if not + { + g_kTmpExceptionID = (key)sMsg; + llMessageLinked(LINK_SET,NOTIFY,"0Adding exception..", kAv); + g_lCustomExceptions += [g_sTmpExceptionName,g_kTmpExceptionID,0]; - Save(SAVE_CUSTOM); - MenuSetExceptions(kAv, iAuth, "Custom"); + Save(SAVE_CUSTOM); + MenuSetExceptions(kAv, iAuth, "Custom"); + } + else + { + llMessageLinked(LINK_SET,NOTIFY,"0Invalid UUID "+sMsg, kAv); + } } else if (sMenu == "Exceptions~Set") { if (sMsg == UPMENU) MenuExceptions(kAv,iAuth); else { From 16ed9f851129fab220ad5776dfc7581877be6847 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 26 May 2022 19:28:38 +0000 Subject: [PATCH 37/97] RLVA_VERSION sends number not rlv string RLVA_VERSION sends TRUE(1) or FALSE(0) so need to check for that instead of RLVa string since its not sending the rlv string we also need to assume RLVa FALSE in the case it does not send a number to auto set outfits to RLV standard. --- src/Apps/oc_outfits.lsl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index c8dc730d4..0dedf1294 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -313,7 +313,7 @@ integer ALIVE = -55; integer READY = -56; integer STARTUP = -57; -integer g_iRLVa = 0; +integer g_iRLVa = FALSE; string RLVA_APPEND="."; @@ -367,13 +367,12 @@ state active { if(llGetStartParameter()!=0)llResetScript(); g_kWearer = llGetOwner(); - //llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global_locked",""); - llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "ALL",""); + llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global_locked",""); } link_message(integer iSender,integer iNum,string sStr,key kID){ if(iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) UserCommand(iNum, sStr, kID); - else if(iNum == RLV_VERSION || iNum == RLVA_VERSION ){ - if(~llSubStringIndex(sStr, "RLVa")){ + else if(iNum == RLVA_VERSION ){ + if(sStr == "1"){ g_iRLVa=TRUE; }else g_iRLVa=FALSE; } From ff5ec728af632774405136760f3ef8e9dc46e331 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 26 May 2022 20:41:53 +0000 Subject: [PATCH 38/97] RLVa sends version number not TRUE if it exists fixing to check if not FALSE the only time we get a predictable pattern is if its false. --- src/Apps/oc_outfits.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 0dedf1294..e445e2530 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -372,7 +372,7 @@ state active link_message(integer iSender,integer iNum,string sStr,key kID){ if(iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) UserCommand(iNum, sStr, kID); else if(iNum == RLVA_VERSION ){ - if(sStr == "1"){ + if(sStr != "0"){ g_iRLVa=TRUE; }else g_iRLVa=FALSE; } From f3a93684c9242f9d10ead9113c2a1a31da7b8c61 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 26 May 2022 21:11:09 +0000 Subject: [PATCH 39/97] adding a way to call for rlv version without ALL this is not a critical update but may be use full in some projects and cut down on chatter spam by not requiring the all in the event you want to reconfirm rlv. and also puts RLV_VERSION to work to confirm legacy rlv if RLVA_VERSION is false. --- src/collar/oc_rlvsys.lsl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index 2299a7b29..c8adb532e 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -69,6 +69,7 @@ integer DO_RLV_REFRESH = 26001;//RLV plugins should reinstate their restrictions integer RLV_CLEAR = 6002;//RLV plugins should clear their restriction lists upon receiving this message. integer RLV_VERSION = 6003; //RLV Plugins can recieve the used RLV viewer version upon receiving this message.. integer RLVA_VERSION = 6004; //RLV Plugins can recieve the used RLVa viewer version upon receiving this message.. +integer RLV_VERSION_REQUEST = 6005; //RLV Plugins and addons can exclusivly request which version was detected. integer RLV_CMD_OVERRIDE=6010; //RLV Plugins can send one-shot (force) commands with a list of restrictions to temporarily lift if required to ensure that the one-shot commands can be executed integer RLV_OFF = 6100; @@ -483,8 +484,20 @@ state active if (g_iRlvActive == TRUE) { llSleep(2); llMessageLinked(LINK_SET, RLV_ON, "", NULL_KEY); - if (g_iRlvaVersion) llMessageLinked(LINK_SET, RLVA_VERSION, (string) g_iRlvaVersion, NULL_KEY); - } + if (g_iRlvaVersion) { + llMessageLinked(LINK_SET, RLVA_VERSION, (string) g_iRlvaVersion, NULL_KEY); + } + else { + llMessageLinked(LINK_SET,RLV_VERSION, (string) g_iRlvVersion,NULL_KEY); + } + } + } else if(iNum == RLV_VERSION_REQUEST ){ + if (g_iRlvaVersion) { + llMessageLinked(LINK_SET, RLVA_VERSION, (string) g_iRlvaVersion, NULL_KEY); + } + else { + llMessageLinked(LINK_SET,RLV_VERSION, (string) g_iRlvVersion,NULL_KEY); + } } else if(iNum == TIMEOUT_FIRED) { From fc8e4f7ba210efa7fef18a1af9d826d5b86c59e6 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Tue, 14 Jun 2022 02:09:42 +0000 Subject: [PATCH 40/97] make welder more stable when connecting to collars this change is based from conversation in open collar R&D about welder not staying connected or randomly dropping out, this fix should hopefully help keep connection, it works for my add-ons and the AO changes i have been working on and i have seen much less chatter about add-ons not being seen. --- src/spares/oc_unwelder.lsl | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index 9fee93d64..20aa06469 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -116,11 +116,28 @@ integer g_iLMLastSent; key g_kUser = NULL_KEY; integer g_iWelded=FALSE; integer g_iAddonLimitation = TRUE; +integer softCounter = 0; + +softreset(){ + if(softCounter < 3){ + softcounter ++; + // assume unintentional disconnect and try to salvage. + g_kCollar = NULL_KEY; + API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kUser, 0, 8))) + 0xf6eb - 0xd2; + Link("online", 0, "", g_kUser); + } + else { + // if we have tried enough times do a hard reset because the item may no longer be present! + llResetScript(); + } +} + default { state_entry(){ llSetText("",ZERO_VECTOR,0); llSay(0, "Unwelder is now ready"); + llSetTimerEvent(10); } touch_start(integer t){ if(g_kUser != NULL_KEY){ @@ -140,7 +157,6 @@ default llListen(API_CHANNEL, "", "", ""); Link("online", 0, "", g_kUser); // This is the signal to initiate communication between the addon and the collar llResetTime(); - llSetTimerEvent(60); } } @@ -149,7 +165,8 @@ default { if(llGetTime() >= 30.0 && g_kCollar==NULL_KEY && g_kUser!=NULL_KEY){ llSay(0, "Connection timed out to collar."); - llResetScript(); + softreset(); + //llResetScript(); } if (llGetUnixTime() >= (g_iLMLastSent + 30) && g_kCollar != NULL_KEY) { @@ -160,7 +177,8 @@ default if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY) { g_kCollar = NULL_KEY; - llResetScript(); // perform our action on disconnect + softreset(); + //llResetScript(); // perform our action on disconnect } if (g_kCollar == NULL_KEY) Link("online", 0, "", g_kUser); @@ -173,6 +191,7 @@ default // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. g_kCollar = id; Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); + g_iLMLastRecv = llGetUnixTime(); // use this call as the first pong rather than packet pong llSay(0, "Unwelder has connected"); llSay(0, "Downloading active settings"); } else if(sPacketType == "denied" && g_kCollar==id){ @@ -183,7 +202,8 @@ default else if (sPacketType == "dc" && g_kCollar == id) { g_kCollar = NULL_KEY; - llResetScript(); // This addon is designed to always be connected because it is a test + softreset(); + //llResetScript(); // This addon is designed to always be connected because it is a test } else if (sPacketType == "pong" && g_kCollar == id) { @@ -284,6 +304,7 @@ default Link("offline", 0, "", llGetOwnerKey(g_kCollar)); g_lMenuIDs = []; g_kCollar = NULL_KEY; + llResetScript(); // this was intentional end disconnect. } } } From ab1a49dbb5f77081b6ca94470ffae017ef78ceab Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Tue, 14 Jun 2022 02:12:27 +0000 Subject: [PATCH 41/97] Update oc_unwelder.lsl --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index 20aa06469..e09fc7906 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -120,7 +120,7 @@ integer softCounter = 0; softreset(){ if(softCounter < 3){ - softcounter ++; + softCounter ++; // assume unintentional disconnect and try to salvage. g_kCollar = NULL_KEY; API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kUser, 0, 8))) + 0xf6eb - 0xd2; From 472cdb9954a075b0ae57a652e5503c20dacb18db Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Tue, 14 Jun 2022 02:20:08 +0000 Subject: [PATCH 42/97] Same as the other undwelder script! this change is roughly the exact same as the other script. --- src/spares/oc_unwelder_hud.lsl | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/spares/oc_unwelder_hud.lsl b/src/spares/oc_unwelder_hud.lsl index 35738fa46..57e0c0810 100644 --- a/src/spares/oc_unwelder_hud.lsl +++ b/src/spares/oc_unwelder_hud.lsl @@ -116,11 +116,27 @@ integer g_iLMLastSent; key g_kUser = NULL_KEY; integer g_iWelded=FALSE; integer g_iAddonLimitation = TRUE; +integer softCounter = 0; + +softreset(){ + if(softCounter < 3){ + softCounter ++; + // assume unintentional disconnect and try to salvage. + g_kCollar = NULL_KEY; + API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kUser, 0, 8))) + 0xf6eb - 0xd2; + Link("online", 0, "", g_kUser); + } + else { + // if we have tried enough times do a hard reset because the item may no longer be present! + llResetScript(); + } +} default { state_entry(){ llOwnerSay("Click me to unweld"); + llSetTimerEvent(10); } touch_start(integer t){ g_iLMLastSent = llGetUnixTime(); @@ -128,7 +144,6 @@ default API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kUser, 0, 8))) + 0xf6eb - 0xd2; llListen(API_CHANNEL, "", "", ""); Link("online", 0, "", g_kUser); // This is the signal to initiate communication between the addon and the collar - llSetTimerEvent(60); } attach(key kID){ @@ -151,7 +166,8 @@ default if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY) { g_kCollar = NULL_KEY; - llResetScript(); // perform our action on disconnect + softreset(); + //llResetScript(); // perform our action on disconnect } if (g_kCollar == NULL_KEY) Link("online", 0, "", g_kUser); @@ -163,6 +179,7 @@ default { // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. g_kCollar = id; + g_iLMLastRecv = llGetUnixTime(); Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); llOwnerSay("Unwelder has connected"); llOwnerSay("Downloading active settings"); @@ -174,7 +191,8 @@ default else if (sPacketType == "dc" && g_kCollar == id) { g_kCollar = NULL_KEY; - llResetScript(); // This addon is designed to always be connected because it is a test + softreset(); + //llResetScript(); // This addon is designed to always be connected because it is a test } else if (sPacketType == "pong" && g_kCollar == id) { @@ -276,6 +294,7 @@ default Link("offline", 0, "", llGetOwnerKey(g_kCollar)); g_lMenuIDs = []; g_kCollar = NULL_KEY; + llResetScript(); } } } From e95e42be0576ac9f9618b0143bf33aaa8be6658b Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 15 Jun 2022 20:31:11 +0000 Subject: [PATCH 43/97] a better merger of addon and ao i have done some extensive work merging the add-on code with the ao and reducing the chance of a stack heap collision as well as speeding up menus, 1) i have split the original script into two the menu system and the animator 2) i have merged the addon code replacing the old code that as intended for connection. 3) i have made it possible for some of the commands to be called from comandline /1prefixAO command 3.A) commands are as follows lock,unlock,load,on,off and menu though the last one is not needed. --- src/ao/oc_ao.lsl | 707 ++++++++++++++++++++++++----------------------- 1 file changed, 356 insertions(+), 351 deletions(-) diff --git a/src/ao/oc_ao.lsl b/src/ao/oc_ao.lsl index eca58fc2a..63b67543d 100644 --- a/src/ao/oc_ao.lsl +++ b/src/ao/oc_ao.lsl @@ -6,11 +6,15 @@ Taya Maruti - (May 2021) */ +integer API_CHANNEL = 0x60b97b5e; + +//list g_lCollars; +string g_sAddon = "AO"; //integer CMD_ZERO = 0; integer CMD_OWNER = 500; -//integer CMD_TRUSTED = 501; -//integer CMD_GROUP = 502; +integer CMD_TRUSTED = 501; +integer CMD_GROUP = 502; integer CMD_WEARER = 503; integer CMD_EVERYONE = 504; //integer CMD_BLOCKED = 598; // <--- Used in auth_request, will not return on a CMD_ZERO @@ -18,18 +22,39 @@ integer CMD_EVERYONE = 504; //integer CMD_SAFEWORD = 510; //integer CMD_RELAY_SAFEWORD = 511; //integer CMD_NOACCESS = 599; -integer CMD_USER; + +//integer LM_SETTING_SAVE = 2000; //scripts send messages on this channel to have settings saved, must be in form of "token=value" +integer LM_SETTING_REQUEST = 2001; //when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002; //the settings script sends responses on this channel +//integer LM_SETTING_DELETE = 2003; //delete token from settings +//integer LM_SETTING_EMPTY = 2004; //sent when a token has no value + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; + +//------------------------------------// +integer AO_SETTINGS=40500; +integer AO_SETOVERRIDE=40501; +integer AO_GETOVERRIDE=40502; +integer AO_GIVEOVERRIDE=40503; +integer AO_NOTECARD = 40504; +integer AO_STATUS = 40505; +integer AO_ANTISLIDE=40506; +//------------------------------------// +list g_lOptedLM = []; +integer g_iMenuStride; + +string UPMENU = "BACK"; +integer g_iLockAuth=504; string g_sDevStage = ""; -string g_sVersion = "2.1"; +string g_sVersion = "2.2"; integer g_iUpdateAvailable; key g_kWebLookup; -integer g_iInterfaceChannel = -12587429; -integer g_iHUDChannel = -1812221819; - key g_kWearer; -string g_sCard = "Girl"; +string g_sCard = "default"; integer g_iCardLine; key g_kCard; integer g_iReady; @@ -58,6 +83,9 @@ list g_lAnims2Choose; list g_lCustomCards; integer g_iPage; integer g_iNumberOfPages; +key g_kCollar=NULL_KEY; +integer g_iLMLastRecv; +integer g_iLMLastSent; /* Debug(string sStr) { llScriptProfiler(1); @@ -221,70 +249,18 @@ ShowStatus() { llSetLinkColor(llListFindList(g_lButtons,["SitAny"]), vColor, ALL_SIDES); } -//ao functions - -SetAnimOverride() { - if (llGetPermissions() & PERMISSION_OVERRIDE_ANIMATIONS) { - llResetAnimationOverride("ALL"); - integer i = 22; //llGetListLength(g_lAnimStates); - string sAnim; - string sAnimState; - do { - sAnimState = llList2String(g_lAnimStates,i); - if (~llSubStringIndex(g_sJson_Anims,sAnimState)) { - sAnim = llJsonGetValue(g_sJson_Anims,[sAnimState]); - if (JsonValid(sAnim)) { - if (sAnimState == "Walking" && g_sWalkAnim != "") - sAnim = g_sWalkAnim; - else if (sAnimState == "Sitting" && !g_iSitAnimOn) jump next; - else if (sAnimState == "Sitting" && g_sSitAnim != "" && g_iSitAnimOn) - sAnim = g_sSitAnim; - else if (sAnimState == "Sitting on Ground" && g_sSitAnywhereAnim != "") - sAnim = g_sSitAnywhereAnim; - else if (sAnimState == "Standing") - sAnim = llList2String(llParseString2List(sAnim, ["|"],[]),0); - if (llGetInventoryType(sAnim) == INVENTORY_ANIMATION) - llSetAnimationOverride(sAnimState, sAnim); - else llOwnerSay(sAnim+" could not be found."); - @next; - } - } - } while (i--); - llSetTimerEvent(g_iChangeInterval); - if (!g_iStandPause) llRegionSayTo(g_kWearer,g_iHUDChannel,(string)g_kWearer+":antislide off ao"); - //llOwnerSay("AO ready ("+(string)llGetFreeMemory()+" bytes free memory)"); - } -} - -SwitchStand() { - if (g_iStandPause) return; - if (llGetPermissions() & PERMISSION_OVERRIDE_ANIMATIONS) { - string sCurAnim = llGetAnimationOverride("Standing"); - list lAnims = llParseString2List(llJsonGetValue(g_sJson_Anims,["Standing"]),["|"],[]); - integer index; - if (g_iShuffle) index = (integer)llFrand(llGetListLength(lAnims)); - else { - index = llListFindList(lAnims,[sCurAnim]); - if (index == llGetListLength(lAnims)-1) index = 0; - else index += 1; - } - if (g_iReady) llSetAnimationOverride("Standing",llList2String(lAnims,index)); - } -} - ToggleSitAnywhere() { if (!g_iAO_ON) llOwnerSay("SitAnywhere is not possible while the AO is turned off."); else if (g_iStandPause) llOwnerSay("SitAnywhere is not possible while you are in a collar pose."); else { if (g_iSitAnywhereOn) { - llSetTimerEvent(g_iChangeInterval); - SwitchStand(); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"switchstand",llGetOwner()); } else { - llSetTimerEvent(0.0); - llSetAnimationOverride("Standing",g_sSitAnywhereAnim); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_Standing="+g_sSitAnywhereAnim,llGetOwner()); } g_iSitAnywhereOn = !g_iSitAnywhereOn; + llMessageLinked(LINK_THIS,AO_SETTINGS,"iSitAnywhereOn="+(string)g_iSitAnywhereOn,llGetOwner()); ShowStatus(); } } @@ -296,19 +272,18 @@ Notify(key kID, string sStr, integer iAlsoNotifyWearer) { if (iAlsoNotifyWearer) llOwnerSay(sStr); } } - -//menus - -Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, string sName) { + +//menus integer iPage, +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iAuth, string sName) { integer iChannel = llRound(llFrand(10000000)) + 100000; while (~llListFindList(g_lMenuIDs, [iChannel])) iChannel = llRound(llFrand(10000000)) + 100000; integer iListener = llListen(iChannel, "",kID, ""); integer iTime = llGetUnixTime() + 180; integer iIndex = llListFindList(g_lMenuIDs, [kID]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs,[kID, iChannel, iListener, iTime, sName],iIndex,iIndex+4); - else g_lMenuIDs += [kID, iChannel, iListener, iTime, sName]; - if (!g_iAO_ON || !g_iChangeInterval) llSetTimerEvent(20); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs,[kID, iChannel, iListener, iTime, sName, iAuth],iIndex,iIndex+4); + else g_lMenuIDs += [kID, iChannel, iListener, iTime, sName,iAuth]; + // if (!g_iAO_ON || !g_iChangeInterval) llSetTimerEvent(20); llDialog(kID,sPrompt,SortButtons(lChoices,lUtilityButtons),iChannel); } @@ -334,24 +309,29 @@ list SortButtons(list lButtons, list lStaticButtons) { return lOut; } -MenuAO(key kID) { +MenuAO(key kID,integer iAuth) { string sPrompt = "\n[OpenCollar AO]\t"+g_sVersion+g_sDevStage; if (g_iUpdateAvailable) sPrompt+= "\n\nUPDATE AVAILABLE: A new patch has been released.\nPlease install at your earliest convenience. Thanks!"; - list lButtons = ["LOCK"]; - if (g_iLocked) lButtons = ["UNLOCK"]; - if (kID == g_kWearer) lButtons += "Collar Menu"; - else lButtons += "-"; - lButtons += ["Load","Sits","Ground Sits","Walks"]; + list lButtons = ["Load","Sits","Ground Sits","Walks"]; if (g_iSitAnimOn) lButtons += ["Sits ☑"]; else lButtons += ["Sits ☐"]; if (g_iShuffle) lButtons += "Shuffle ☑"; else lButtons += "Shuffle ☐"; - lButtons += ["Stand Time","Next Stand"]; + lButtons += ["Stand Time","Next Stand","Admin Menu"]; if (kID == g_kWearer) lButtons += "HUD Style"; - Dialog(kID, sPrompt, lButtons, ["Cancel"], "AO"); + Dialog(kID, sPrompt, lButtons, ["Cancel"], iAuth, "AO"); } -MenuLoad(key kID, integer iPage) { +MenuAdmin(key kID,integer iAuth) { + string sPrompt = "\n[OpenCollar AO]\t"+g_sVersion+g_sDevStage; + list lButtons = ["LOCK"]; + if (g_iLocked) lButtons = ["UNLOCK"]; + else lButtons += "-"; + if (g_kCollar != NULL_KEY) lButtons += ["Collar Menu","DISCONNECT"]; + Dialog(kID, sPrompt, lButtons, ["Cancel","BACK"], iAuth, "Admin"); +} + +MenuLoad(key kID, integer iPage,integer iAuth) { if (!iPage) g_iPage = 0; string sPrompt = "\nLoad an animation set!"; list lButtons; @@ -381,16 +361,16 @@ MenuLoad(key kID, integer iPage) { lButtons = llList2List(lButtons,iPage*9,iPage*9+8); } if (!llGetListLength(lButtons)) llOwnerSay("There aren't any animation sets installed!"); - Dialog(kID, sPrompt, lButtons, lStaticButtons,"Load"); + Dialog(kID, sPrompt, lButtons, lStaticButtons,iAuth,"Load"); } -MenuInterval(key kID) { +MenuInterval(key kID,integer iAuth) { string sInterval = "won't change automatically."; if (g_iChangeInterval) sInterval = "change every "+(string)g_iChangeInterval+" seconds."; - Dialog(kID, "\nStands " +sInterval, ["Never","20","30","45","60","90","120","180"], ["BACK"],"Interval"); + Dialog(kID, "\nStands " +sInterval, ["Never","20","30","45","60","90","120","180"], ["BACK"],iAuth,"Interval"); } -MenuChooseAnim(key kID, string sAnimState) { +MenuChooseAnim(key kID, string sAnimState, integer iAuth) { string sAnim = g_sSitAnywhereAnim; if (sAnimState == "Walking") sAnim = g_sWalkAnim; else if (sAnimState == "Sitting") sAnim = g_sSitAnim; @@ -403,14 +383,14 @@ MenuChooseAnim(key kID, string sAnimState) { lButtons += (string)i; sPrompt += "\n"+(string)i+": "+llList2String(g_lAnims2Choose,i-1); } - Dialog(kID, sPrompt, lButtons, ["BACK"],sAnimState); + Dialog(kID, sPrompt, lButtons, ["BACK"],iAuth,sAnimState); } -MenuOptions(key kID) { - Dialog(kID,"\nCustomize your AO!",["Horizontal","Vertical","Order"],["BACK"], "options"); +MenuOptions(key kID,integer iAuth) { + Dialog(kID,"\nCustomize your AO!",["Horizontal","Vertical","Order"],["BACK"],iAuth, "options"); } -OrderMenu(key kID) { +OrderMenu(key kID,integer iAuth) { string sPrompt = "\nWhich button do you want to re-order?"; integer i; list lButtons; @@ -419,86 +399,79 @@ OrderMenu(key kID) { iPos = llList2Integer(g_lPrimOrder,i); lButtons += llList2List(g_lButtons,iPos,iPos); } - Dialog(kID, sPrompt, lButtons, ["Reset","BACK"], "ordermenu"); + Dialog(kID, sPrompt, lButtons, ["Reset","BACK"],iAuth, "ordermenu"); } //command handling -TranslateCollarCMD(string sCommand, key kID){ - if (!llSubStringIndex(sCommand,"ZHAO_")) { - sCommand = llGetSubString(sCommand,5,-1); - if (!~llSubStringIndex(sCommand,"load")) - sCommand = llToLower(sCommand); - } else return; - if (!llSubStringIndex(sCommand,"stand")) { - if (~llSubStringIndex(sCommand,"off")) { - g_iStandPause = TRUE; - if (llGetAnimationOverride("Standing") != "") - llResetAnimationOverride("Standing"); - llResetAnimationOverride("Turning Left"); - llResetAnimationOverride("Turning Right"); - if (g_iSitAnywhereOn) { - g_iSitAnywhereOn = FALSE; - ShowStatus(); - } - } else if (~llSubStringIndex(sCommand,"on")) { - SetAnimOverride(); - g_iStandPause = FALSE; - } - } else if (~llSubStringIndex(sCommand,"menu")) { - if (g_iReady) MenuAO(kID); - else { - Notify(kID,"Please load an animation set first.",TRUE); - MenuLoad(kID,0); - } - } else if (!llSubStringIndex(sCommand,"ao")) - Command(kID,llGetSubString(sCommand,2,-1)); -} - -Command(key kID, string sCommand) { - list lParams = llParseString2List(sCommand,[" "],[]); - sCommand = llList2String(lParams,0); - string sValue = llList2String(lParams,1); - if (!g_iReady) { - Notify(kID,"Please load an animation set first.",TRUE); - MenuLoad(kID,0); +Command(key kID, string sCommand,integer iNum) { + //llOwnerSay("first check:"+sCommand+"from:"+(string)iNum); + if (iNumCMD_WEARER) { + llOwnerSay("not authorized"); + return; + } + if (llSubStringIndex(llToLower(sCommand), llToLower(g_sAddon)) && llToLower(sCommand) != "menu " + llToLower(g_sAddon)) return; + if (iNum == CMD_OWNER && llToLower(sCommand) == "runaway") { + llOwnerSay("run away!"); + Command(kID,g_sAddon+"unlock",iNum); return; - } else if (sCommand == "on") { - SetAnimOverride(); - g_iAO_ON = TRUE; - llSetTimerEvent(g_iChangeInterval); - ShowStatus(); - } else if (sCommand == "off") { - llResetAnimationOverride("ALL"); - g_iAO_ON = FALSE; - llSetTimerEvent(0.0); - ShowStatus(); - } else if (sCommand == "unlock") { - g_iLocked = FALSE; - llOwnerSay("@detach=y"); - llPlaySound("82fa6d06-b494-f97c-2908-84009380c8d1", 1.0); - Notify(kID,"The AO has been unlocked.",TRUE); - } else if (sCommand == "lock") { - g_iLocked = TRUE; - llOwnerSay("@detach=n"); - llPlaySound("dec9fb53-0fef-29ae-a21d-b3047525d312", 1.0); - Notify(kID,"The AO has been locked.",TRUE); - } else if (sCommand == "menu") MenuAO(kID); - else if (sCommand == "load") { - if (llGetInventoryType(sValue) == INVENTORY_NOTECARD) { - g_sCard = sValue; - g_iCardLine = 0; - g_sJson_Anims = "{}"; - Notify(kID,"Loading animation set \""+g_sCard+"\".",TRUE); - g_kCard = llGetNotecardLine(g_sCard, g_iCardLine); - } else MenuLoad(kID,0); } -} -StartUpdate(key kID) { - integer iPin = (integer)llFrand(99999998.0) + 1; - llSetRemoteScriptAccessPin(iPin); - llRegionSayTo(kID, -7483220, "ready|" + (string)iPin ); + if (llToLower(sCommand) == llToLower(g_sAddon) || llToLower(sCommand) == "menu "+llToLower(g_sAddon)) + { + llOwnerSay("spawn Menu!"); + MenuAO(kID, iNum); + }// else if (iNum!=CMD_OWNER && iNum!=CMD_TRUSTED && kID!=g_kWearer) Notify(kID,"Access denied!",TRUE); + else + { + //integer iWSuccess = 0; + //string sChangetype = llList2String(llParseString2List(sCommand, [" "], []),0); + //string sChangevalue = llList2String(llParseString2List(sCommand, [" "], []),1); + //string sText; + list lParams = llParseString2List(sCommand,[" "],[g_sAddon]); + sCommand = llList2String(lParams,1); + string sValue = llList2String(lParams,2); + if (!g_iReady) { + Notify(kID,"Please load an animation set first.",TRUE); + MenuLoad(kID,0,iNum); + return; + } else if (sCommand == "on") { + g_iAO_ON = TRUE; + llMessageLinked(LINK_THIS,AO_SETTINGS,"iAO_ON="+(string)g_iAO_ON,kID); + llMessageLinked(LINK_THIS,AO_SETTINGS,"start",kID); + ShowStatus(); + } else if (sCommand == "off") { + g_iAO_ON = FALSE; + llMessageLinked(LINK_THIS,AO_SETTINGS,"iAO_ON="+(string)g_iAO_ON,kID); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET_ALL",kID); + //llResetAnimationOverride("ALL"); + ShowStatus(); + } else if (sCommand == "unlock"){ + if( iNum <= g_iLockAuth){ + g_iLocked = FALSE; + llOwnerSay("@detach=y"); + llPlaySound("82fa6d06-b494-f97c-2908-84009380c8d1", 1.0); + Notify(kID,"The AO has been unlocked.",TRUE); + } else Notify(kID,"Sorry Authorization denied!",TRUE); + } else if (sCommand == "lock" ){ + if( iNum <= g_iLockAuth) { + g_iLockAuth = iNum; + g_iLocked = TRUE; + llOwnerSay("@detach=n"); + llPlaySound("dec9fb53-0fef-29ae-a21d-b3047525d312", 1.0); + Notify(kID,"The AO has been locked.",TRUE); + }else Notify(kID,"Sorry Authorization denied!",TRUE); + } else if (sCommand == "menu") MenuAO(kID,iNum); + else if (sCommand == "load") { + if (llGetInventoryType(sValue) == INVENTORY_NOTECARD) { + g_sCard = sValue; + g_iCardLine = 0; + g_sJson_Anims = "{}"; + Notify(kID,"Loading animation set \""+g_sCard+"\".",TRUE); + llMessageLinked(LINK_THIS,AO_NOTECARD,g_sCard+"|"+(string)g_iCardLine,kID); + } else MenuLoad(kID,0,iNum); + } + } } PermsCheck() { @@ -521,133 +494,223 @@ PermsCheck() { } } -integer API_CHANNEL; + +Link(string packet, integer iNum, string sStr, key kID){ + list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; + + if (packet == "online" || packet == "update") // only add optin if packet type is online or update + { + llListInsertList(packet_data, [ "optin", llDumpList2String(g_lOptedLM, "~") ], -1); + } + + string pkt = llList2Json(JSON_OBJECT, packet_data); + if (g_kCollar != "" && g_kCollar != NULL_KEY) + { + llRegionSayTo(g_kCollar, API_CHANNEL, pkt); + } + else + { + llRegionSay(API_CHANNEL, pkt); + } +} + +initialize(){ + if (llGetInventoryType("oc_installer_sys")==INVENTORY_SCRIPT) return; + g_kWearer = llGetOwner(); + PermsCheck(); + API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; + llListen(API_CHANNEL, "", "", ""); + FindButtons(); + PositionButtons(); + TextureButtons(); + DetermineColors(); + //g_kCard = llGetNotecardLine(g_sCard, g_iCardLine); + llMessageLinked(LINK_THIS,AO_NOTECARD,g_sCard+"|"+(string)g_iCardLine,g_kWearer); + Link("online", 0, "", llGetOwner()); // This is the signal to initiate communication between the addon and the collar + llSetTimerEvent(5); + g_iLMLastRecv = llGetUnixTime(); +} + +softreset(){ + g_kCollar = NULL_KEY; + API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; + llListen(API_CHANNEL, "", "", ""); + Link("online", 0, "", llGetOwner()); // This is the signal to initiate communication between the addon and the collar + g_iLMLastRecv = llGetUnixTime(); + FindButtons(); + PositionButtons(); + TextureButtons(); + DetermineColors(); +} + +shutdown(){ + Link("offline", 0, "", llGetOwnerKey(g_kCollar)); + g_lMenuIDs = []; + g_kCollar = NULL_KEY; +} + default { state_entry() { - if (llGetInventoryType("oc_installer_sys")==INVENTORY_SCRIPT) return; - g_kWearer = llGetOwner(); - PermsCheck(); - API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; - g_iInterfaceChannel = -llAbs((integer)("0x" + llGetSubString(g_kWearer,30,-1))); - llListen(g_iInterfaceChannel, "", "", ""); - g_iHUDChannel = -llAbs((integer)("0x"+llGetSubString((string)llGetOwner(),-7,-1))); - FindButtons(); - PositionButtons(); - TextureButtons(); - DetermineColors(); - MenuLoad(g_kWearer,0); + initialize(); + //MenuLoad(g_kWearer,0,CMD_WEARER); } on_rez(integer iStart) { if (g_kWearer != llGetOwner()) llResetScript(); if (g_iLocked) llOwnerSay("@detach=n"); g_iReady = FALSE; + llMessageLinked(LINK_THIS,AO_SETTINGS,"UPDATE",g_kWearer); + llMessageLinked(LINK_THIS,AO_GETOVERRIDE,"all",g_kWearer); g_kWebLookup = llHTTPRequest("https://raw.githubusercontent.com/OpenCollarTeam/OpenCollar/master/web/ao.txt", [HTTP_METHOD, "GET"],""); - llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); + //llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); } attach(key kID) { - if (kID == NULL_KEY) llResetAnimationOverride("ALL"); + if (kID == NULL_KEY) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET_ALL",kID);//llResetAnimationOverride("ALL"); else if (llGetAttached() <= 30) { llOwnerSay("Sorry, this device can only be attached to the HUD."); llRequestPermissions(kID, PERMISSION_ATTACH); llDetachFromAvatar(); - } else PositionButtons(); + } else { + PositionButtons(); + llMessageLinked(LINK_THIS,AO_GETOVERRIDE,"all",g_kWearer); + llMessageLinked(LINK_THIS,AO_SETTINGS,"UPDATE",g_kWearer); + } } touch_start(integer total_number) { - CMD_USER=CMD_WEARER; // create an authroized user call incase the one touching the script tries to access the collar. if(llGetAttached()) { if (!g_iReady) { - MenuLoad(g_kWearer,0); - llOwnerSay("Please load an animation set first."); + //MenuLoad(g_kWearer,0,CMD_WEARER); + //llOwnerSay("Please load an animation set first."); + llOwnerSay("system not loaded yet!"); return; } string sButton = (string)llGetObjectDetails(llGetLinkKey(llDetectedLinkNumber(0)),[OBJECT_DESC]); if (sButton == "Menu") - MenuAO(g_kWearer); + MenuAO(g_kWearer,CMD_WEARER); else if (sButton == "SitAny") { ToggleSitAnywhere(); } else if (llSubStringIndex(llToLower(sButton),"ao")>=0) { g_iHidden = !g_iHidden; PositionButtons(); } else if (sButton == "Power") { - if (g_iAO_ON) Command(g_kWearer,"off"); - else if (g_iReady) Command(g_kWearer,"on"); + if (g_iAO_ON) Command(g_kWearer,g_sAddon+"off",CMD_WEARER); + else if (g_iReady) Command(g_kWearer,g_sAddon+"on",CMD_WEARER); } - } else if (llDetectedKey(0) == g_kWearer) MenuAO(g_kWearer); + } else if (llDetectedKey(0) == g_kWearer) MenuAO(g_kWearer,CMD_WEARER); + } + + link_message(integer iSender, integer iNum, string sStr, key kID){ + if( iNum == AO_STATUS ){ + //llOwnerSay(sStr); + list lPar = llParseString2List(sStr, ["_","="], []); + string sToken = llList2String(lPar, 0); + string sVar = llList2String(lPar, 1); + string sVal = llList2String(lPar, 2); + if(sToken == "UPDATE"){ + if( sVar == "iSitAnimOn"){ + g_iSitAnimOn = (integer)sVal; + } + else if( sVar == "sWalkAnim"){ + g_sWalkAnim = sVal; + } + else if( sVar == "sSitAnim"){ + g_sSitAnim = sVal; + } + else if( sVar == "iSitAnywhereOn"){ + g_iSitAnywhereOn = (integer)sVal; + } + else if( sVar == "sSitAnywhereAnim"){ + g_sSitAnywhereAnim = sVal; + } + else if(sVar == "iAOOn"){ + g_iAO_ON = (integer)sVal; + } + ShowStatus(); + } + } + if( iNum == AO_GIVEOVERRIDE){ + if(JsonValid(sStr)){ + g_iReady = TRUE; + g_sJson_Anims=sStr; + } + else { + g_iReady = FALSE; + llOwnerSay("Json not valid!"); + } + ShowStatus(); + } } listen(integer iChannel, string sName, key kID, string sMessage) { - if (iChannel == g_iInterfaceChannel) { - if (llGetOwnerKey(kID) != g_kWearer) return; - if (sMessage == "-.. --- / .- ---") { - StartUpdate(kID); - return; - } else if (!llGetAttached() && sMessage == "AO set installation") { - sMessage = ""; - integer i = llGetInventoryNumber(INVENTORY_ANIMATION); - while(i) { - sMessage += llGetInventoryName(INVENTORY_ANIMATION,--i); - if (llStringLength(sMessage) > 960) { - llRegionSayTo(kID,iChannel,sMessage); - sMessage = ""; + if(JsonValid(sMessage)){ + string sPacketType = llJsonGetValue(sMessage, ["pkt_type"]); + if (sPacketType == "approved" && g_kCollar == NULL_KEY) + { + // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. + g_kCollar = kID; + g_iLMLastRecv = llGetUnixTime(); + Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); + } + else if (sPacketType == "dc" && g_kCollar == kID) + { + softreset(); + } + else if (sPacketType == "pong" && g_kCollar == kID) + { + g_iLMLastRecv = llGetUnixTime(); + } + else if(sPacketType == "from_collar") + { + // process link message if in range of addon + if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(kID, [OBJECT_POS]), 0)) <= 10.0) + { + integer iNum = (integer) llJsonGetValue(sMessage, ["iNum"]); + string sStr = llJsonGetValue(sMessage, ["sMsg"]); + key kID = (key) llJsonGetValue(sMessage, ["kID"]); + if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) + { + Command(kID, sStr, iNum); } } - llRegionSayTo(kID,iChannel,sMessage); - llRegionSayTo(kID,iChannel,"@END"); - return; - } //"CollarCommmand|499|ZHAO_STANDON" or "CollarCommmand|iAuth|ZHAO_MENU|commanderID" - list lParams = llParseString2List(sMessage,["|"],[]); - if (llList2String(lParams,0) == "CollarCommand") { - if (llList2Integer(lParams,1) == 502) - Notify(llList2Key(lParams,3),"Access denied!",FALSE); - else - TranslateCollarCMD(llList2String(lParams,2),llList2Key(lParams,3)); } - } else if (~llListFindList(g_lMenuIDs,[kID, iChannel])) { + } + if (~llListFindList(g_lMenuIDs,[kID, iChannel])) { integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + integer iAuth = llList2Integer(g_lMenuIDs,iMenuIndex+5); string sMenuType = llList2String(g_lMenuIDs, iMenuIndex+4); llListenRemove(llList2Integer(g_lMenuIDs,iMenuIndex+2)); g_lMenuIDs = llDeleteSubList(g_lMenuIDs,iMenuIndex, iMenuIndex+4); - if (llGetListLength(g_lMenuIDs) == 0 && (!g_iAO_ON || !g_iChangeInterval)) llSetTimerEvent(0.0); + //if (llGetListLength(g_lMenuIDs) == 0 && (!g_iAO_ON || !g_iChangeInterval)) llSetTimerEvent(0.0); if (sMenuType == "AO") { if (sMessage == "Cancel") return; - else if (sMessage == "-") MenuAO(kID); - else if (sMessage == "Collar Menu"){ - // use the authorized user to return to the collar menu, using the addon script to prevent breaking it. - llMessageLinked(LINK_THIS,CMD_USER,"CollarMenu",kID); - //llRegionSayTo(g_kWearer, API_CHANNEL, llList2Json(JSON_OBJECT, ["pkt_type", "online", "kID", g_kWearer, "addon_name", "OC_Sub_AO", "optin", ""])); - //llSleep(2); - //llRegionSayTo(g_kWearer, API_CHANNEL, llList2Json(JSON_OBJECT, ["pkt_type", "from_addon", "kID", g_kWearer, "iNum", 0, "sMsg", "menu", "addon_name", "OC_Sub_AO"])); - //llSleep(0.5); - //llRegionSayTo(g_kWearer, API_CHANNEL, llList2Json(JSON_OBJECT, ["pkt_type", "offline", "addon_name", "OC_Sub_AO", "kID", g_kWearer])); - } - else if (~llSubStringIndex(sMessage,"LOCK")) { - Command(kID,llToLower(sMessage)); - MenuAO(kID); - } else if (sMessage == "HUD Style") MenuOptions(kID); - else if (sMessage == "Load") MenuLoad(kID,0); - else if (sMessage == "Sits") MenuChooseAnim(kID,"Sitting"); - else if (sMessage == "Walks") MenuChooseAnim(kID,"Walking"); - else if (sMessage == "Ground Sits") MenuChooseAnim(kID,"Sitting on Ground"); + else if (sMessage == "-") MenuAO(kID,iAuth); + else if (sMessage == "Admin Menu") MenuAdmin(kID,iAuth); + else if (sMessage == "HUD Style") MenuOptions(kID,iAuth); + else if (sMessage == "Load") MenuLoad(kID,0,iAuth); + else if (sMessage == "Sits") MenuChooseAnim(kID,"Sitting",iAuth); + else if (sMessage == "Walks") MenuChooseAnim(kID,"Walking",iAuth); + else if (sMessage == "Ground Sits") MenuChooseAnim(kID,"Sitting on Ground",iAuth); else if (!llSubStringIndex(sMessage,"Sits")) { if (~llSubStringIndex(sMessage,"☑")) { g_iSitAnimOn = FALSE; - llResetAnimationOverride("Sitting"); + llMessageLinked(LINK_THIS,AO_SETTINGS,"iSitAnimOn="+(string)g_iSitAnimOn,kID); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"reset_Sitting",kID); } else if (g_sSitAnim != "") { g_iSitAnimOn = TRUE; - if (g_iAO_ON) llSetAnimationOverride("Sitting",g_sSitAnim); + if (g_iAO_ON) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_Sitting="+g_sSitAnim,kID); } else Notify(kID,"Sorry, the currently loaded animation set doesn't have any sits.",TRUE); - MenuAO(kID); - } else if (sMessage == "Stand Time") MenuInterval(kID); + MenuAO(kID,iAuth); + } else if (sMessage == "Stand Time") MenuInterval(kID,iAuth); else if (sMessage == "Next Stand") { - if (g_iAO_ON) SwitchStand(); - MenuAO(kID); + if (g_iAO_ON) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"switchstand",llGetOwner()); + MenuAO(kID,iAuth); } else if (!llSubStringIndex(sMessage,"Shuffle")) { if (~llSubStringIndex(sMessage,"☑")) g_iShuffle = FALSE; else g_iShuffle = TRUE; - MenuAO(kID); + llMessageLinked(LINK_THIS,AO_SETTINGS,"iShuffle="+(string)g_iShuffle,kID); + MenuAO(kID,iAuth); } } else if (sMenuType == "Load") { integer index = llListFindList(g_lCustomCards,[sMessage]); @@ -656,10 +719,10 @@ default { g_sCard = sMessage; g_iCardLine = 0; g_sJson_Anims = "{}"; - g_kCard = llGetNotecardLine(g_sCard, g_iCardLine); + llMessageLinked(LINK_THIS,AO_NOTECARD,g_sCard+"|"+(string)g_iCardLine,kID); return; } else if (g_iReady && sMessage == "BACK") { - MenuAO(kID); + MenuAO(kID,iAuth); return; } else if (sMessage == "►") { if (++g_iPage > g_iNumberOfPages) g_iPage = 0; @@ -667,37 +730,46 @@ default { if (--g_iPage < 0) g_iPage = g_iNumberOfPages; } else if (!g_iReady) llOwnerSay("Please load an animation set first."); else llOwnerSay("Could not find animation set: "+sMessage); - MenuLoad(kID,g_iPage); + MenuLoad(kID,g_iPage,iAuth); } else if (sMenuType == "Interval") { if (sMessage == "BACK") { - MenuAO(kID); + MenuAO(kID,iAuth); return; } else if (sMessage == "Never") { g_iChangeInterval = FALSE; - llSetTimerEvent(g_iChangeInterval); + llMessageLinked(LINK_THIS,AO_SETTINGS,"iChangeInterval="+(string)g_iChangeInterval,kID); } else if ((integer)sMessage >= 20) { g_iChangeInterval = (integer)sMessage; - if (g_iAO_ON && !g_iSitAnywhereOn) llSetTimerEvent(g_iChangeInterval); + if (g_iAO_ON && !g_iSitAnywhereOn) llMessageLinked(LINK_THIS,AO_SETTINGS,"iChangeInterval="+(string)g_iChangeInterval,kID); } - MenuInterval(kID); + MenuInterval(kID,iAuth); } else if (~llListFindList(["Walking","Sitting on Ground","Sitting"],[sMenuType])) { - if (sMessage == "BACK") MenuAO(kID); - else if (sMessage == "-") MenuChooseAnim(kID,sMenuType); + if (sMessage == "BACK") MenuAO(kID,iAuth); + else if (sMessage == "-") MenuChooseAnim(kID,sMenuType,iAuth); else { sMessage = llList2String(g_lAnims2Choose,((integer)sMessage)-1); g_lAnims2Choose = []; if (llGetInventoryType(sMessage) == INVENTORY_ANIMATION) { - if (sMenuType == "Sitting") g_sSitAnim = sMessage; - else if (sMenuType == "Sitting on Ground") g_sSitAnywhereAnim = sMessage; - else if (sMenuType == "Walking") g_sWalkAnim = sMessage; - if (g_iAO_ON && (sMenuType != "Sitting" || g_iSitAnimOn)) - llSetAnimationOverride(sMenuType,sMessage); + if (sMenuType == "Sitting") { + g_sSitAnim = sMessage; + llMessageLinked(LINK_THIS,AO_SETTINGS,"sSitAnim="+g_sSitAnim,kID); + } + else if (sMenuType == "Sitting on Ground") { + g_sSitAnywhereAnim = sMessage; + llMessageLinked(LINK_THIS,AO_SETTINGS,"sSitAnywhereAnim="+g_sSitAnywhereAnim,kID); + } + else if (sMenuType == "Walking"){ + g_sWalkAnim = sMessage; + llMessageLinked(LINK_THIS,AO_SETTINGS,"sWalkAnim="+g_sWalkAnim,kID); + + } + if (g_iAO_ON && (sMenuType != "Sitting" || g_iSitAnimOn)) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_"+sMenuType+"="+sMessage,kID); } else llOwnerSay("No "+sMenuType+" animation set."); - MenuChooseAnim(kID,sMenuType); + MenuChooseAnim(kID,sMenuType,iAuth); } } else if (sMenuType == "options") { if (sMessage == "BACK") { - MenuAO(kID); + MenuAO(kID,iAuth); return; } else if (sMessage == "Horizontal") { g_iLayout = 0; @@ -706,21 +778,21 @@ default { g_iLayout = 1; PositionButtons(); } else if (sMessage == "Order") { - OrderMenu(kID); + OrderMenu(kID,iAuth); return; } - MenuOptions(kID); + MenuOptions(kID,iAuth); } else if (sMenuType == "ordermenu") { - if (sMessage == "BACK") MenuOptions(kID); - else if (sMessage == "-") OrderMenu(kID); + if (sMessage == "BACK") MenuOptions(kID,iAuth); + else if (sMessage == "-") OrderMenu(kID,iAuth); else if (sMessage == "Reset") { FindButtons(); llOwnerSay("Order position reset to default."); PositionButtons(); - OrderMenu(kID); + OrderMenu(kID,iAuth); } else if (llSubStringIndex(sMessage,":") >= 0) { DoButtonOrder(llList2Integer(llParseString2List(sMessage,[":"],[]),1)); - OrderMenu(kID); + OrderMenu(kID,iAuth); } else { list lButtons; string sPrompt; @@ -733,113 +805,42 @@ default { lButtons +=[llList2String(g_lButtons,llList2Integer(g_lPrimOrder,i))+":"+(string)i]; } } - Dialog(kID, sPrompt, lButtons, ["BACK"],"ordermenu"); + Dialog(kID, sPrompt, lButtons, ["BACK"],iAuth,"ordermenu"); } - } + } else if (sMenuType == "Admin") { + if (sMessage == "Cancel") return; + else if (sMessage == "Collar Menu") Link("from_addon",iAuth,"menu ",kID); + else if (~llSubStringIndex(sMessage,"LOCK")) { + Command(kID,g_sAddon+llToLower(sMessage),iAuth); + MenuAdmin(kID,iAuth); + } else if( sMessage == "DISCONNECT" ) shutdown(); + else if (sMessage == "BACK") MenuAO(kID,iAuth); + } } } - link_message(integer sNum, integer iAuth, string sStr, key kID) - { - if( sStr == "MenuAO" ) - { - // create an authroized user and open the ao menu for that user. - CMD_USER=iAuth; - MenuAO(kID); + timer() { + if (llGetUnixTime() >= (g_iLMLastSent + 30)) + { + g_iLMLastSent = llGetUnixTime(); + Link("ping", 0, "", g_kCollar); } - } - timer() { - if (g_iAO_ON && g_iChangeInterval) SwitchStand(); - integer n = llGetListLength(g_lMenuIDs) - 5; + if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY) + { + softreset(); + } + + if (g_kCollar == NULL_KEY) Link("online", 0, "", llGetOwner()); + integer n = llGetListLength(g_lMenuIDs)-6; integer iNow = llGetUnixTime(); - for (n; n>=0; n=n-5) { + for (n; n>=0; n=n-6) { integer iDieTime = llList2Integer(g_lMenuIDs,n+3); if (iNow > iDieTime) { llListenRemove(llList2Integer(g_lMenuIDs,n+2)); g_lMenuIDs = llDeleteSubList(g_lMenuIDs,n,n+4); } } - if (!llGetListLength(g_lMenuIDs) && (!g_iAO_ON || !g_iChangeInterval)) llSetTimerEvent(0.0); - } - - dataserver(key kRequest, string sData) { - if (kRequest == g_kCard) { - if (sData != EOF) { - if (llGetSubString(sData,0,0) != "[") jump next; - string sAnimationState = llStringTrim(llGetSubString(sData,1,llSubStringIndex(sData,"]")-1),STRING_TRIM); - // Translate common ZHAOII, Oracul and AX anim state values - if (sAnimationState == "Stand.1" || sAnimationState == "Stand.2" || sAnimationState == "Stand.3") sAnimationState = "Standing"; - else if (sAnimationState == "Walk.N") sAnimationState = "Walking"; - //else if (sAnimationState == "") sAnimationState = "Running"; - else if (sAnimationState == "Turn.L") sAnimationState = "Turning Left"; - else if (sAnimationState == "Turn.R") sAnimationState = "Turning Right"; - else if (sAnimationState == "Sit.N") sAnimationState = "Sitting"; - else if (sAnimationState == "Sit.G" || sAnimationState == "Sitting On Ground") sAnimationState = "Sitting on Ground"; - else if (sAnimationState == "Crouch") sAnimationState = "Crouching"; - else if (sAnimationState == "Walk.C" || sAnimationState == "Crouch Walking") sAnimationState = "CrouchWalking"; - else if (sAnimationState == "Jump.P" || sAnimationState == "Pre Jumping") sAnimationState = "PreJumping"; - else if (sAnimationState == "Jump.N") sAnimationState = "Jumping"; - //else if (sAnimationState == "") sAnimationState = "Soft Landing"; - //else if (sAnimationState == "") sAnimationState = "Taking Off"; - else if (sAnimationState == "Hover.N") sAnimationState = "Hovering"; - else if (sAnimationState == "Hover.U" || sAnimationState == "Flying Up") sAnimationState = "Hovering Up"; - else if (sAnimationState == "Hover.D" || sAnimationState == "Flying Down") sAnimationState = "Hovering Down"; - else if (sAnimationState == "Fly.N") sAnimationState = "Flying"; - else if (sAnimationState == "Flying Slow") sAnimationState = "FlyingSlow"; - else if (sAnimationState == "Land.N") sAnimationState = "Landing"; - else if (sAnimationState == "Falling") sAnimationState = "Falling Down"; - else if (sAnimationState == "Stand.U") sAnimationState = "Standing Up"; - //else if (sAnimationState == "") sAnimationState = "Striding"; - if (!~llListFindList(g_lAnimStates,[sAnimationState])) jump next; - if (llStringLength(sData)-1 > llSubStringIndex(sData,"]")) { - sData = llGetSubString(sData,llSubStringIndex(sData,"]")+1,-1); - list lTemp = llParseString2List(sData, ["|",","],[]); - integer i = llGetListLength(lTemp); - while(i--) { - if (llGetInventoryType(llList2String(lTemp,i)) != INVENTORY_ANIMATION) - lTemp = llDeleteSubList(lTemp,i,i); - } - if (sAnimationState == "Sitting on Ground") - g_sSitAnywhereAnim = llList2String(lTemp,0); - else if (sAnimationState == "Sitting") { - g_sSitAnim = llList2String(lTemp,0); - if (g_sSitAnim != "") g_iSitAnimOn = TRUE; - else g_iSitAnimOn = FALSE; - } else if (sAnimationState == "Walking") - g_sWalkAnim = llList2String(lTemp,0); - else if (sAnimationState != "Standing") lTemp = llList2List(lTemp,0,0); - if (lTemp) g_sJson_Anims = llJsonSetValue(g_sJson_Anims, [sAnimationState],llDumpList2String(lTemp,"|")); - } - @next; - g_kCard = llGetNotecardLine(g_sCard,++g_iCardLine); - } else { - g_iCardLine = 0; - g_kCard = ""; - g_iSitAnywhereOn = FALSE; - integer index = llListFindList(g_lCustomCards,[g_sCard]); - if (~index) g_sCard = llList2String(g_lCustomCards,index+1)+" ("+g_sCard+")"; - g_lCustomCards = []; - if (g_sJson_Anims == "{}") { - llOwnerSay("\""+g_sCard+"\" is an invalid animation set and can't play."); - g_iAO_ON = FALSE; - } else { - llOwnerSay("The \""+g_sCard+"\" animation set was loaded successfully."); - g_iAO_ON = TRUE; - } - ShowStatus(); - llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); - } - } - } - - run_time_permissions(integer iFlag) { - if (iFlag & PERMISSION_OVERRIDE_ANIMATIONS) { - if (g_sJson_Anims != "{}") g_iReady = TRUE; - else g_iReady = FALSE; - if (g_iAO_ON) SetAnimOverride(); - else llResetAnimationOverride("ALL"); - } } http_response(key kRequestID, integer iStatus, list lMeta, string sBody) { @@ -852,7 +853,11 @@ default { changed(integer iChange) { if (iChange & CHANGED_COLOR) { if (llGetColor(0) != g_vAOoncolor) DetermineColors(); - } else if (iChange & CHANGED_LINK) llResetScript(); - if (iChange & CHANGED_INVENTORY) PermsCheck(); + } else if (iChange & CHANGED_LINK) initialize(); + if (iChange & CHANGED_INVENTORY) { + llMessageLinked(LINK_THIS,AO_NOTECARD,g_sCard+"|"+(string)g_iCardLine,g_kWearer); + softreset(); + PermsCheck(); + } } } From 75accced0db345c7159780d08bee542fd667db5d Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 15 Jun 2022 20:34:15 +0000 Subject: [PATCH 44/97] this is the second half of the ao update this is the split and clean up the the actual ao portion of the code --- src/ao/oc_ao_animator | 330 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 src/ao/oc_ao_animator diff --git a/src/ao/oc_ao_animator b/src/ao/oc_ao_animator new file mode 100644 index 000000000..24b9ab9b3 --- /dev/null +++ b/src/ao/oc_ao_animator @@ -0,0 +1,330 @@ +// This file is part of OpenCollar. +// Copyright (c) 2008 - 2017 Nandana Singh, Jessenia Mocha, Alexei Maven. Wendy Starfall, +// littlemousy, Romka Swallowtail, Garvin Twine et al. +// Licensed under the GPLv2. See LICENSE for full details. +/*-Authors Attribution- +Taya Maruti - (May 2021) +*/ + + +//integer CMD_ZERO = 0; +//integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +//integer CMD_WEARER = 503; +//integer CMD_EVERYONE = 504; +//integer CMD_BLOCKED = 598; // <--- Used in auth_request, will not return on a CMD_ZERO +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; +//integer CMD_NOACCESS = 599; +integer AO_SETTINGS=40500; +integer AO_SETOVERRIDE=40501; +integer AO_GETOVERRIDE=40502; +integer AO_GIVEOVERRIDE=40503; +integer AO_NOTECARD = 40504; +integer AO_STATUS = 40505; +integer AO_ANTISLIDE=40506; + +integer CMD_USER; +key g_kWearer; + +list g_lAnimStates = [ //http://wiki.secondlife.com/wiki/LlSetAnimationOverride + "Crouching","CrouchWalking","Falling Down","Flying","FlyingSlow", + "Hovering","Hovering Down","Hovering Up","Jumping","Landing", + "PreJumping","Running","Standing","Sitting","Sitting on Ground","Standing Up", + "Striding","Soft Landing","Taking Off","Turning Left","Turning Right","Walking" + ]; + +string g_sJson_Anims = "{}"; +string g_sWalkAnim; +integer g_iSitAnimOn; +string g_sSitAnim; +integer g_iSitAnywhereOn; +string g_sSitAnywhereAnim; +integer g_iShuffle; +integer g_iStandPause; +integer g_iChangeInterval = 45; +integer g_iReady; +integer g_iAO_ON; +integer g_iCardLine; +key g_kCard; +string g_sCard = "Default"; +list g_lCustomCards; + +//ao functions + +integer JsonValid(string sTest) { + if (~llSubStringIndex(JSON_FALSE+JSON_INVALID+JSON_NULL,sTest)) + return FALSE; + return TRUE; +} + +SetAnimOverride() { + if (llGetPermissions() & PERMISSION_OVERRIDE_ANIMATIONS) { + llResetAnimationOverride("ALL"); + integer i = 22; //llGetListLength(g_lAnimStates); + string sAnim; + string sAnimState; + do { + sAnimState = llList2String(g_lAnimStates,i); + if (~llSubStringIndex(g_sJson_Anims,sAnimState)) { + sAnim = llJsonGetValue(g_sJson_Anims,[sAnimState]); + if (JsonValid(sAnim)) { + if (sAnimState == "Walking" && g_sWalkAnim != "") + sAnim = g_sWalkAnim; + else if (sAnimState == "Sitting" && !g_iSitAnimOn) jump next; + else if (sAnimState == "Sitting" && g_sSitAnim != "" && g_iSitAnimOn) + sAnim = g_sSitAnim; + else if (sAnimState == "Sitting on Ground" && g_sSitAnywhereAnim != "") + sAnim = g_sSitAnywhereAnim; + else if (sAnimState == "Standing") + sAnim = llList2String(llParseString2List(sAnim, ["|"],[]),0); + if (llGetInventoryType(sAnim) == INVENTORY_ANIMATION) + llSetAnimationOverride(sAnimState, sAnim); + else llOwnerSay(sAnim+" could not be found."); + @next; + } + } + } while (i--); + llSetTimerEvent(g_iChangeInterval); + if (!g_iStandPause) llMessageLinked(LINK_THIS,AO_ANTISLIDE,(string)g_kWearer+":antislide off ao",llGetOwner()); + //llOwnerSay("AO ready ("+(string)llGetFreeMemory()+" bytes free memory)"); + } +} + +SwitchStand() { + if (g_iStandPause) return; + if (llGetPermissions() & PERMISSION_OVERRIDE_ANIMATIONS) { + string sCurAnim = llGetAnimationOverride("Standing"); + list lAnims = llParseString2List(llJsonGetValue(g_sJson_Anims,["Standing"]),["|"],[]); + integer index; + if (g_iShuffle) index = (integer)llFrand(llGetListLength(lAnims)); + else { + index = llListFindList(lAnims,[sCurAnim]); + if (index == llGetListLength(lAnims)-1) index = 0; + else index += 1; + } + if (g_iReady) llSetAnimationOverride("Standing",llList2String(lAnims,index)); + } +} + +PermsCheck() { + string sName = llGetScriptName(); + if (!(llGetObjectPermMask(MASK_OWNER) & PERM_MODIFY)) { + llOwnerSay("You have been given a no-modify OpenCollar object. This could break future updates. Please ask the provider to make the object modifiable."); + } + + if (!(llGetObjectPermMask(MASK_NEXT) & PERM_MODIFY)) { + llOwnerSay("You have put an OpenCollar script into an object that the next user cannot modify. This could break future updates. Please leave your OpenCollar objects modifiable."); + } + + integer FULL_PERMS = PERM_COPY | PERM_MODIFY | PERM_TRANSFER; + if (!((llGetInventoryPermMask(sName,MASK_OWNER) & FULL_PERMS) == FULL_PERMS)) { + llOwnerSay("The " + sName + " script is not mod/copy/trans. This is a violation of the OpenCollar license. Please ask the person who gave you this script for a full-perms replacement."); + } + + if (!((llGetInventoryPermMask(sName,MASK_NEXT) & FULL_PERMS) == FULL_PERMS)) { + llOwnerSay("You have removed mod/copy/trans permissions for the next owner of the " + sName + " script. This is a violation of the OpenCollar license. Please make the script full perms again."); + } +} + +default { + state_entry() { + g_kWearer = llGetOwner(); + PermsCheck(); + } + + link_message(integer iSender, integer iNum, string sStr, key kID) { + if( iNum == AO_SETTINGS){ + list lPar = llParseString2List(sStr, ["=","|"], []); + string sVar = llList2String(lPar, 0); + string sVal = llList2String(lPar, 1); + string sVal2 = llList2String(lPar, 2); + if( sVar == "UPDATE"){ + SetAnimOverride(); + } + else if( sVar == "iSitAnimOn"){ + g_iSitAnimOn = (integer)sVal; + } + else if( sVar == "sWalkAnim"){ + g_sWalkAnim = sVal; + } + else if( sVar == "iSitAnywhereOn"){ + g_iSitAnywhereOn = (integer)sVal; + } + else if( sVar == "sString_Anim"){ + g_sSitAnim = sVal; + } + else if( sVar == "sSitAnywhereAnim"){ + g_sSitAnywhereAnim = sVal; + } + else if( sVar == "iShuffle"){ + g_iShuffle = (integer)sVal; + } + else if( sVar == "iStandPause"){ + g_iStandPause = (integer)sVal; + } + else if( sVar == "iChangeInterval"){ + g_iChangeInterval = (integer)sVal; + llSetTimerEvent(g_iChangeInterval); + } + else if(sVar == "iAO_ON"){ + g_iAO_ON = (integer)sVal; + if(g_iAO_ON){ + llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); + SetAnimOverride(); + } + else { + llSetTimerEvent(0); + //llResetAnimationOverride("ALL"); + } + } + } + else if( iNum == AO_SETOVERRIDE){ + list lPar = llParseString2List(sStr, ["_","="], []); + string sToken = llList2String(lPar, 0); + string sVar = llList2String(lPar, 1); + string sVal = llList2String(lPar, 2); + if(sToken == "switchstand"){ + SwitchStand(); + } + else if(sToken == "set"){ + llSetAnimationOverride(sVar,sVal); + } + else if(sToken == "RESET"){ + llResetAnimationOverride(llToUpper(sVar)); + } + } + else if( iNum == AO_GETOVERRIDE){ + if( sStr == "" | sStr == "all"){ + llMessageLinked(LINK_THIS,AO_GIVEOVERRIDE,g_sJson_Anims,kID); + } + else if(~llSubStringIndex(g_sJson_Anims,sStr)){ + list lAnims = llParseString2List(llJsonGetValue(g_sJson_Anims,[sStr]),["|"],[]); + llMessageLinked(LINK_THIS,AO_GIVEOVERRIDE,"{"+sStr+llDumpList2String(lAnims,"|")+"}",kID); + } + else { + llMessageLinked(LINK_THIS,AO_GIVEOVERRIDE,"404",kID); + } + } + else if( iNum == AO_NOTECARD){ + list lPar = llParseString2List(sStr, ["|"], []); + string sVal = llList2String(lPar, 0); + integer iVal = llList2Integer(lPar, 1); + if(llGetInventoryType(sVal) == INVENTORY_NOTECARD){ + if(iVal == 0){ + g_sJson_Anims = "{}"; + } + g_sCard = sVal; + g_iCardLine = iVal; + g_kCard = llGetNotecardLine(g_sCard, g_iCardLine); + } + } + } + + timer() { + if (g_iAO_ON && g_iChangeInterval) SwitchStand(); + } + + run_time_permissions(integer iFlag) { + if (iFlag & PERMISSION_OVERRIDE_ANIMATIONS) { + if (g_sJson_Anims != "{}") g_iReady = TRUE; + else g_iReady = FALSE; + if (g_iAO_ON) SetAnimOverride(); + else llResetAnimationOverride("ALL"); + } + } + + changed(integer iChange) { + if (iChange & CHANGED_LINK) { + if(g_iReady){ + SetAnimOverride(); + SwitchStand(); + } + } + if (iChange & CHANGED_INVENTORY) PermsCheck(); + } + + dataserver(key kRequest, string sData) { + if (kRequest == g_kCard) { + if (sData != EOF) { + if (llGetSubString(sData,0,0) != "[") jump next; + string sAnimationState = llStringTrim(llGetSubString(sData,1,llSubStringIndex(sData,"]")-1),STRING_TRIM); + // Translate common ZHAOII, Oracul and AX anim state values + if (sAnimationState == "Stand.1" || sAnimationState == "Stand.2" || sAnimationState == "Stand.3") sAnimationState = "Standing"; + else if (sAnimationState == "Walk.N") sAnimationState = "Walking"; + else if (sAnimationState == "Running") sAnimationState = "Running"; + else if (sAnimationState == "Turn.L") sAnimationState = "Turning Left"; + else if (sAnimationState == "Turn.R") sAnimationState = "Turning Right"; + else if (sAnimationState == "Sit.N") sAnimationState = "Sitting"; + else if (sAnimationState == "Sit.G" || sAnimationState == "Sitting On Ground") sAnimationState = "Sitting on Ground"; + else if (sAnimationState == "Crouch") sAnimationState = "Crouching"; + else if (sAnimationState == "Walk.C" || sAnimationState == "Crouch Walking") sAnimationState = "CrouchWalking"; + else if (sAnimationState == "Jump.N" || sAnimationState == "Jumping") sAnimationState = "Jumping"; + //else if (sAnimationState == "Takeoff") sAnimationState = "Taking Off"; + else if (sAnimationState == "Hover.N") sAnimationState = "Hovering"; + else if (sAnimationState == "Hover.U" || sAnimationState == "Flying Up") sAnimationState = "Hovering Up"; + else if (sAnimationState == "Hover.D" || sAnimationState == "Flying Down") sAnimationState = "Hovering Down"; + else if (sAnimationState == "Fly.N") sAnimationState = "Flying"; + else if (sAnimationState == "Flying Slow") sAnimationState = "FlyingSlow"; + else if (sAnimationState == "Land.N") sAnimationState = "Landing"; + else if (sAnimationState == "Falling") sAnimationState = "Falling Down"; + /* ----------------------------------------------------------------------- */ + // Meeded for competition events like those held in pony play + else if (sAnimationState == "Striding") sAnimationState = "Striding"; + else if (sAnimationState == "Soft Landing") sAnimationState = "Soft Landing"; + else if (sAnimationState == "Jump.P" || sAnimationState == "Pre Jumping") sAnimationState = "PreJumping"; + else if (sAnimationState == "Stand.U") sAnimationState = "Standing Up"; + /* ----------------------------------------------------------------------- */ + if (!~llListFindList(g_lAnimStates,[sAnimationState])) jump next; + if (llStringLength(sData)-1 > llSubStringIndex(sData,"]")) { + sData = llGetSubString(sData,llSubStringIndex(sData,"]")+1,-1); + list lTemp = llParseString2List(sData, ["|",","],[]); + integer i = llGetListLength(lTemp); + while(i--) { + if (llGetInventoryType(llList2String(lTemp,i)) != INVENTORY_ANIMATION) + lTemp = llDeleteSubList(lTemp,i,i); + } + if (sAnimationState == "Sitting on Ground"){ + g_sSitAnywhereAnim = llList2String(lTemp,0); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sSitAnywhereAnim="+g_sSitAnywhereAnim,llGetOwner()); + } + else if (sAnimationState == "Sitting") { + g_sSitAnim = llList2String(lTemp,0); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sSitAnim="+g_sSitAnim,llGetOwner()); + if (g_sSitAnim != "") g_iSitAnimOn = TRUE; + else g_iSitAnimOn = FALSE; + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iSitAnimOn="+(string)g_iSitAnimOn,llGetOwner()); + } else if (sAnimationState == "Walking"){ + g_sWalkAnim = llList2String(lTemp,0); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sWaLkAnim="+g_sWalkAnim,llGetOwner()); + } + else if (sAnimationState != "Standing") lTemp = llList2List(lTemp,0,0); + if (lTemp) g_sJson_Anims = llJsonSetValue(g_sJson_Anims, [sAnimationState],llDumpList2String(lTemp,"|")); + } + @next; + g_kCard = llGetNotecardLine(g_sCard,++g_iCardLine); + } else { + g_iCardLine = 0; + g_kCard = ""; + g_iSitAnywhereOn = FALSE; + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iSitAnywhereOn="+(string)g_iSitAnywhereOn,llGetOwner()); + integer index = llListFindList(g_lCustomCards,[g_sCard]); + if (~index) g_sCard = llList2String(g_lCustomCards,index+1)+" ("+g_sCard+")"; + g_lCustomCards = []; + if (g_sJson_Anims == "{}") { + llOwnerSay("\""+g_sCard+"\" is an invalid animation set and can't play."); + g_iAO_ON = FALSE; + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iAO_ON="+(string)g_iAO_ON,llGetOwner()); + } else { + llOwnerSay("The \""+g_sCard+"\" animation set was loaded successfully."); + g_iAO_ON = TRUE; + llMessageLinked(LINK_THIS,AO_GIVEOVERRIDE,g_sJson_Anims,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iAOOn="+(string)g_iAO_ON,llGetOwner()); + } + llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); + } + } + } +} From 9a5739bd5e77090014ff2b9c31b853673e939e9b Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 15 Jun 2022 20:41:00 +0000 Subject: [PATCH 45/97] delete the addon bridge as its no longer needed https://github.com/OpenCollarTeam/OpenCollar/pull/807 replaces this script. --- src/ao/oc_ao_addon.lsl | 255 ----------------------------------------- 1 file changed, 255 deletions(-) delete mode 100644 src/ao/oc_ao_addon.lsl diff --git a/src/ao/oc_ao_addon.lsl b/src/ao/oc_ao_addon.lsl deleted file mode 100644 index 3ad416c3f..000000000 --- a/src/ao/oc_ao_addon.lsl +++ /dev/null @@ -1,255 +0,0 @@ -/* -THIS FILE IS HEREBY RELEASED UNDER THE Public Domain -This script is released public domain, unlike other OC scripts for a specific and limited reason, because we want to encourage third party plugin creators to create for OpenCollar and use whatever permissions on their own work they see fit. No portion of OpenCollar derived code may be used excepting this script, without the accompanying GPLv2 license. --Authors Attribution- -Aria (tiff589) - (August 2020) -Lysea - (December 2020) -Taya Maruti - (May 2021) -*/ - -integer API_CHANNEL = 0x60b97b5e; - -//list g_lCollars; -string g_sAddon = "AO"; - -//integer CMD_ZERO = 0; -integer CMD_OWNER = 500; -//integer CMD_TRUSTED = 501; -//integer CMD_GROUP = 502; -integer CMD_WEARER = 503; -integer CMD_EVERYONE = 504; -//integer CMD_BLOCKED = 598; // <--- Used in auth_request, will not return on a CMD_ZERO -//integer CMD_RLV_RELAY = 507; -//integer CMD_SAFEWORD = 510; -//integer CMD_RELAY_SAFEWORD = 511; -//integer CMD_NOACCESS = 599; - -//integer LM_SETTING_SAVE = 2000; //scripts send messages on this channel to have settings saved, must be in form of "token=value" -integer LM_SETTING_REQUEST = 2001; //when startup, scripts send requests for settings on this channel -integer LM_SETTING_RESPONSE = 2002; //the settings script sends responses on this channel -//integer LM_SETTING_DELETE = 2003; //delete token from settings -//integer LM_SETTING_EMPTY = 2004; //sent when a token has no value - -integer DIALOG = -9000; -integer DIALOG_RESPONSE = -9001; -integer DIALOG_TIMEOUT = -9002; - -/* - * Since Release Candidate 1, Addons will not receive all link messages without prior opt-in. - * To opt in, add the needed link messages to g_lOptedLM = [], they'll be transmitted on - * the initial registration and can be updated at any time by sending a packet of type `update` - * Following LMs require opt-in: - * [ALIVE, READY, STARTUP, CMD_ZERO, MENUNAME_REQUEST, MENUNAME_RESPONSE, MENUNAME_REMOVE, SAY, NOTIFY, DIALOG, SENSORDIALOG] - */ -list g_lOptedLM = []; - -list g_lMenuIDs; -integer g_iMenuStride; - -string UPMENU = "BACK"; - -Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { - key kMenuID = llGenerateKey(); - - llRegionSayTo(g_kCollar, API_CHANNEL, llList2Json(JSON_OBJECT, [ "pkt_type", "from_addon", "addon_name", g_sAddon, "iNum", DIALOG, "sMsg", (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, "kID", kMenuID ])); - - integer iIndex = llListFindList(g_lMenuIDs, [kID]); - if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [ kID, kMenuID, sName ], iIndex, iIndex + g_iMenuStride - 1); - else g_lMenuIDs += [kID, kMenuID, sName]; -} - -Menu(key kID, integer iAuth) { - string sPrompt = "\n[Menu App]"; - list lButtons = ["Menu"]; - - //llSay(0, "opening menu"); - Dialog(kID, sPrompt, lButtons, ["DISCONNECT", UPMENU], 0, iAuth, "Menu~Main"); -} - -UserCommand(integer iNum, string sStr, key kID) { - if (iNumCMD_WEARER) return; - if (llSubStringIndex(llToLower(sStr), llToLower(g_sAddon)) && llToLower(sStr) != "menu " + llToLower(g_sAddon)) return; - if (iNum == CMD_OWNER && llToLower(sStr) == "runaway") { - return; - } - - if (llToLower(sStr) == llToLower(g_sAddon) || llToLower(sStr) == "menu "+llToLower(g_sAddon)) - { - Menu(kID, iNum); - } //else if (iNum!=CMD_OWNER && iNum!=CMD_TRUSTED && kID!=g_kWearer) RelayNotify(kID,"Access denied!",0); - else - { - //integer iWSuccess = 0; - //string sChangetype = llList2String(llParseString2List(sStr, [" "], []),0); - //string sChangevalue = llList2String(llParseString2List(sStr, [" "], []),1); - //string sText; - } -} - -Link(string packet, integer iNum, string sStr, key kID){ - list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; - - if (packet == "online" || packet == "update") // only add optin if packet type is online or update - { - llListInsertList(packet_data, [ "optin", llDumpList2String(g_lOptedLM, "~") ], -1); - } - - string pkt = llList2Json(JSON_OBJECT, packet_data); - if (g_kCollar != "" && g_kCollar != NULL_KEY) - { - llRegionSayTo(g_kCollar, API_CHANNEL, pkt); - } - else - { - llRegionSay(API_CHANNEL, pkt); - } -} - -key g_kCollar=NULL_KEY; -integer g_iLMLastRecv; -integer g_iLMLastSent; -key g_kWearer; -default -{ - state_entry() - { - g_kWearer = llGetOwner(); - API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; - llListen(API_CHANNEL, "", "", ""); - Link("online", 0, "", llGetOwner()); // This is the signal to initiate communication between the addon and the collar - llSetTimerEvent(60); - g_iLMLastRecv = llGetUnixTime(); - } - on_rez(integer start_param) - { - if (g_kWearer != llGetOwner()) llResetScript(); - } - attach(key id) - { - // update the collar on attach and detach. - if(id) - { - Link("online", 0, "", llGetOwner()); - } - else - { - - Link("offline", 0, "", llGetOwnerKey(g_kCollar)); - } - } - - timer() - { - if (llGetUnixTime() >= (g_iLMLastSent + 30)) - { - g_iLMLastSent = llGetUnixTime(); - Link("ping", 0, "", g_kCollar); - } - - if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY) - { - g_kCollar = NULL_KEY; - //Link("online", 0, "", llGetOwner()); // stay connected by refreshing the connection without this the addon disapears from the menu and resetting script all the time can break things. - llResetScript(); // perform our action on disconnect - } - - if (g_kCollar == NULL_KEY) Link("online", 0, "", llGetOwner()); - } - - listen(integer channel, string name, key id, string msg){ - string sPacketType = llJsonGetValue(msg, ["pkt_type"]); - if (sPacketType == "approved" && g_kCollar == NULL_KEY) - { - // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. - g_kCollar = id; - g_iLMLastRecv = llGetUnixTime(); - Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); - } - else if (sPacketType == "dc" && g_kCollar == id) - { - g_kCollar = NULL_KEY; - //Link("online", 0, "", llGetOwner()); // stay connected by refreshing the connection without this the addon disapears from the menu and resetting script all the time can break things. - llResetScript(); // This addon is designed to always be connected because it is a test - } - else if (sPacketType == "pong" && g_kCollar == id) - { - g_iLMLastRecv = llGetUnixTime(); - } - else if(sPacketType == "from_collar") - { - // process link message if in range of addon - if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0) - { - integer iNum = (integer) llJsonGetValue(msg, ["iNum"]); - string sStr = llJsonGetValue(msg, ["sMsg"]); - key kID = (key) llJsonGetValue(msg, ["kID"]); - - if (iNum == LM_SETTING_RESPONSE) - { - list lPar = llParseString2List(sStr, ["_","="], []); - string sToken = llList2String(lPar, 0); - string sVar = llList2String(lPar, 1); - string sVal = llList2String(lPar, 2); - - /*if (sToken == "auth") - { - if (sVar == "owner") - { - llSay(0, "owner values is: " + sVal); - } - }*/ - } - else if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) - { - UserCommand(iNum, sStr, kID); - - } - else if (iNum == DIALOG_TIMEOUT) - { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex + 3); //remove stride from g_lMenuIDs - } - else if (iNum == DIALOG_RESPONSE) - { - integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); - if (iMenuIndex != -1) - { - string sMenu = llList2String(g_lMenuIDs, iMenuIndex + 1); - g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); - list lMenuParams = llParseString2List(sStr, ["|"], []); - key kAv = llList2Key(lMenuParams, 0); - string sMsg = llList2String(lMenuParams, 1); - integer iAuth = llList2Integer(lMenuParams, 3); - - if (sMenu == "Menu~Main") - { - if (sMsg == UPMENU) - { - Link("from_addon", iAuth, "menu Addons", kAv); - } - else if (sMsg == "Menu") - { - // interface with the ao to allow owners and others to access it from the collar menu. - llMessageLinked(LINK_THIS, iAuth, "MenuAO", kAv); - } - else if (sMsg == "DISCONNECT") - { - Link("offline", 0, "", llGetOwnerKey(g_kCollar)); - g_lMenuIDs = []; - g_kCollar = NULL_KEY; - } - } - } - } - } - } - } - link_message(integer sNum, integer iNum, string sStr, key kID) - { - //return to collars menu when the ao requests it going through this script keeps the addon alive. - if( sStr == "CollarMenu") - { - Link("from_addon", iNum, "menu", kID); - } - } -} From b0fbfef5aadc928585a9b887b70e1edbbb389337 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 16 Jun 2022 06:18:14 +0000 Subject: [PATCH 46/97] changes should fix the animation issue animations do some times have _ but less often : so this change should fix ping's animation's issue. --- src/ao/oc_ao.lsl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ao/oc_ao.lsl b/src/ao/oc_ao.lsl index 63b67543d..5927931e4 100644 --- a/src/ao/oc_ao.lsl +++ b/src/ao/oc_ao.lsl @@ -257,7 +257,7 @@ ToggleSitAnywhere() { if (g_iSitAnywhereOn) { llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"switchstand",llGetOwner()); } else { - llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_Standing="+g_sSitAnywhereAnim,llGetOwner()); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set:Standing="+g_sSitAnywhereAnim,llGetOwner()); } g_iSitAnywhereOn = !g_iSitAnywhereOn; llMessageLinked(LINK_THIS,AO_SETTINGS,"iSitAnywhereOn="+(string)g_iSitAnywhereOn,llGetOwner()); @@ -443,7 +443,7 @@ Command(key kID, string sCommand,integer iNum) { } else if (sCommand == "off") { g_iAO_ON = FALSE; llMessageLinked(LINK_THIS,AO_SETTINGS,"iAO_ON="+(string)g_iAO_ON,kID); - llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET_ALL",kID); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET:ALL",kID); //llResetAnimationOverride("ALL"); ShowStatus(); } else if (sCommand == "unlock"){ @@ -696,10 +696,10 @@ default { if (~llSubStringIndex(sMessage,"☑")) { g_iSitAnimOn = FALSE; llMessageLinked(LINK_THIS,AO_SETTINGS,"iSitAnimOn="+(string)g_iSitAnimOn,kID); - llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"reset_Sitting",kID); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET:Sitting",kID); } else if (g_sSitAnim != "") { g_iSitAnimOn = TRUE; - if (g_iAO_ON) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_Sitting="+g_sSitAnim,kID); + if (g_iAO_ON) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set:Sitting="+g_sSitAnim,kID); } else Notify(kID,"Sorry, the currently loaded animation set doesn't have any sits.",TRUE); MenuAO(kID,iAuth); } else if (sMessage == "Stand Time") MenuInterval(kID,iAuth); @@ -763,7 +763,7 @@ default { llMessageLinked(LINK_THIS,AO_SETTINGS,"sWalkAnim="+g_sWalkAnim,kID); } - if (g_iAO_ON && (sMenuType != "Sitting" || g_iSitAnimOn)) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set_"+sMenuType+"="+sMessage,kID); + if (g_iAO_ON && (sMenuType != "Sitting" || g_iSitAnimOn)) llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"set:"+sMenuType+"="+sMessage,kID); } else llOwnerSay("No "+sMenuType+" animation set."); MenuChooseAnim(kID,sMenuType,iAuth); } From 9ba28cdcfa8bac3f6866031c9ba46613667f917b Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 16 Jun 2022 06:18:34 +0000 Subject: [PATCH 47/97] update in concert with main script. fixing _ to : --- src/ao/oc_ao_animator | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ao/oc_ao_animator b/src/ao/oc_ao_animator index 24b9ab9b3..c0f862e5d 100644 --- a/src/ao/oc_ao_animator +++ b/src/ao/oc_ao_animator @@ -149,6 +149,7 @@ default { } else if( sVar == "sWalkAnim"){ g_sWalkAnim = sVal; + SetAnimOverride(); } else if( sVar == "iSitAnywhereOn"){ g_iSitAnywhereOn = (integer)sVal; @@ -182,7 +183,7 @@ default { } } else if( iNum == AO_SETOVERRIDE){ - list lPar = llParseString2List(sStr, ["_","="], []); + list lPar = llParseString2List(sStr, [":","="], []); string sToken = llList2String(lPar, 0); string sVar = llList2String(lPar, 1); string sVal = llList2String(lPar, 2); From 608816e14056257c0b7cd9b770820a28d0b6ad23 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Thu, 16 Jun 2022 21:54:28 +0000 Subject: [PATCH 48/97] fix ao not having permissions after login fixing ao not recognizing permissions on login or other situations that would change it. --- src/ao/oc_ao_animator | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/ao/oc_ao_animator b/src/ao/oc_ao_animator index c0f862e5d..d0006740c 100644 --- a/src/ao/oc_ao_animator +++ b/src/ao/oc_ao_animator @@ -236,17 +236,27 @@ default { else llResetAnimationOverride("ALL"); } } + + on_rez(integer start_pram){ + if(g_iAO_ON){ + llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); + SwitchStand(); + } + } changed(integer iChange) { if (iChange & CHANGED_LINK) { if(g_iReady){ - SetAnimOverride(); - SwitchStand(); + if(g_iAO_ON){ + llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); + SwitchStand(); + } } } if (iChange & CHANGED_INVENTORY) PermsCheck(); } + dataserver(key kRequest, string sData) { if (kRequest == g_kCard) { if (sData != EOF) { From 33220643977f49e9c3f7e3c77879562079ec8aa1 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 17 Jun 2022 03:59:58 +0000 Subject: [PATCH 49/97] Update oc_ao.lsl --- src/ao/oc_ao.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ao/oc_ao.lsl b/src/ao/oc_ao.lsl index 5927931e4..a1e3db340 100644 --- a/src/ao/oc_ao.lsl +++ b/src/ao/oc_ao.lsl @@ -604,7 +604,7 @@ default { link_message(integer iSender, integer iNum, string sStr, key kID){ if( iNum == AO_STATUS ){ //llOwnerSay(sStr); - list lPar = llParseString2List(sStr, ["_","="], []); + list lPar = llParseString2List(sStr, [":","="], []); string sToken = llList2String(lPar, 0); string sVar = llList2String(lPar, 1); string sVal = llList2String(lPar, 2); From 20052f94c3fd63736f4872b4a44ccc8a5d9bcb45 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 17 Jun 2022 04:05:19 +0000 Subject: [PATCH 50/97] Update oc_ao_animator --- src/ao/oc_ao_animator | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ao/oc_ao_animator b/src/ao/oc_ao_animator index d0006740c..b5a7af8f2 100644 --- a/src/ao/oc_ao_animator +++ b/src/ao/oc_ao_animator @@ -299,17 +299,17 @@ default { } if (sAnimationState == "Sitting on Ground"){ g_sSitAnywhereAnim = llList2String(lTemp,0); - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sSitAnywhereAnim="+g_sSitAnywhereAnim,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:sSitAnywhereAnim="+g_sSitAnywhereAnim,llGetOwner()); } else if (sAnimationState == "Sitting") { g_sSitAnim = llList2String(lTemp,0); - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sSitAnim="+g_sSitAnim,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:sSitAnim="+g_sSitAnim,llGetOwner()); if (g_sSitAnim != "") g_iSitAnimOn = TRUE; else g_iSitAnimOn = FALSE; - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iSitAnimOn="+(string)g_iSitAnimOn,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:iSitAnimOn="+(string)g_iSitAnimOn,llGetOwner()); } else if (sAnimationState == "Walking"){ g_sWalkAnim = llList2String(lTemp,0); - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_sWaLkAnim="+g_sWalkAnim,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:sWaLkAnim="+g_sWalkAnim,llGetOwner()); } else if (sAnimationState != "Standing") lTemp = llList2List(lTemp,0,0); if (lTemp) g_sJson_Anims = llJsonSetValue(g_sJson_Anims, [sAnimationState],llDumpList2String(lTemp,"|")); @@ -320,19 +320,19 @@ default { g_iCardLine = 0; g_kCard = ""; g_iSitAnywhereOn = FALSE; - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iSitAnywhereOn="+(string)g_iSitAnywhereOn,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:iSitAnywhereOn="+(string)g_iSitAnywhereOn,llGetOwner()); integer index = llListFindList(g_lCustomCards,[g_sCard]); if (~index) g_sCard = llList2String(g_lCustomCards,index+1)+" ("+g_sCard+")"; g_lCustomCards = []; if (g_sJson_Anims == "{}") { llOwnerSay("\""+g_sCard+"\" is an invalid animation set and can't play."); g_iAO_ON = FALSE; - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iAO_ON="+(string)g_iAO_ON,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:iAO_ON="+(string)g_iAO_ON,llGetOwner()); } else { llOwnerSay("The \""+g_sCard+"\" animation set was loaded successfully."); g_iAO_ON = TRUE; llMessageLinked(LINK_THIS,AO_GIVEOVERRIDE,g_sJson_Anims,llGetOwner()); - llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE_iAOOn="+(string)g_iAO_ON,llGetOwner()); + llMessageLinked(LINK_THIS,AO_STATUS,"UPDATE:iAOOn="+(string)g_iAO_ON,llGetOwner()); } llRequestPermissions(g_kWearer,PERMISSION_OVERRIDE_ANIMATIONS); } From 352595f6a1711ca72eadb907cc4bb7b875a5698f Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Mon, 20 Jun 2022 00:09:34 +0000 Subject: [PATCH 51/97] applying the work around for who is using it. comenting out the scond llSetText to allow users to know who is using the welder. --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index e09fc7906..3d2ca802f 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -150,7 +150,7 @@ default // llSay(0, "Unwelder now in use"); llSetText("In use by\n" + llKey2Name (llDetectedKey(0)), <1,0,0>,1); - llSetText("In use..", <1,0,0>,1); + //llSetText("In use..", <1,0,0>,1); g_iLMLastSent = llGetUnixTime(); g_kUser=llDetectedKey(0); API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kUser, 0, 8))) + 0xf6eb - 0xd2; From 0102e0589564d84ae9fc70d3c96d25bb97db16a1 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Tue, 21 Jun 2022 19:45:44 +0000 Subject: [PATCH 52/97] prevent stray chatter. needed to fix that as it would drive normal users crazy. --- src/ao/oc_ao.lsl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ao/oc_ao.lsl b/src/ao/oc_ao.lsl index a1e3db340..2f12e12d1 100644 --- a/src/ao/oc_ao.lsl +++ b/src/ao/oc_ao.lsl @@ -407,7 +407,6 @@ OrderMenu(key kID,integer iAuth) { Command(key kID, string sCommand,integer iNum) { //llOwnerSay("first check:"+sCommand+"from:"+(string)iNum); if (iNumCMD_WEARER) { - llOwnerSay("not authorized"); return; } if (llSubStringIndex(llToLower(sCommand), llToLower(g_sAddon)) && llToLower(sCommand) != "menu " + llToLower(g_sAddon)) return; From 141395040c8d58fd47b52a44de31ff667a22b325 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 24 Jun 2022 00:50:26 +0000 Subject: [PATCH 53/97] ao on/off compatability restore the animation scripts ability to enabled/disable the ao. --- src/collar/oc_anim.lsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collar/oc_anim.lsl b/src/collar/oc_anim.lsl index 50d24cfcf..e78d54e96 100644 --- a/src/collar/oc_anim.lsl +++ b/src/collar/oc_anim.lsl @@ -51,6 +51,8 @@ integer MENUNAME_REQUEST = 3000; integer MENUNAME_RESPONSE = 3001; integer MENUNAME_REMOVE = 3003; +integer AO_SETOVERRIDE=40501; + integer RLV_CMD = 6000; //integer RLV_REFRESH = 6001;//RLV plugins should reinstate their restrictions upon receiving this message. @@ -80,6 +82,7 @@ string UPMENU = "BACK"; //integer TIMEOUT_FIRED = 30499; + Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { key kMenuID = llGenerateKey(); llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); @@ -312,7 +315,8 @@ integer g_iStoppedAdjust; string g_sPose = ""; MessageAOs(string sONOFF) { // send string as "ON" / "OFF" saves 2 llToUpper - llRegionSayTo(g_kWearer, -8888, (string)g_kWearer + "boot" + llToLower(sONOFF)); // for Firestorm AO + llMessageLinked(LINK_SET,AO_SETOVERRIDE, llToLower(sONOFF), g_kWearer); + //llRegionSayTo(g_kWearer, -8888, (string)g_kWearer + "boot" + llToLower(sONOFF)); // for Firestorm AO } integer g_iTimerMode; From 334d3b10105c5709797967251db9596fe8b9725f Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 24 Jun 2022 00:50:28 +0000 Subject: [PATCH 54/97] make ao respond ot on off singal from oc_anim restore the animation scripts ability to enabled/disable the ao. --- src/ao/oc_ao.lsl | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/ao/oc_ao.lsl b/src/ao/oc_ao.lsl index 2f12e12d1..4a315dc27 100644 --- a/src/ao/oc_ao.lsl +++ b/src/ao/oc_ao.lsl @@ -407,7 +407,25 @@ OrderMenu(key kID,integer iAuth) { Command(key kID, string sCommand,integer iNum) { //llOwnerSay("first check:"+sCommand+"from:"+(string)iNum); if (iNumCMD_WEARER) { - return; + if(iNum == AO_SETOVERRIDE){ + if (sCommand == "on") { + g_iAO_ON = TRUE; + llMessageLinked(LINK_THIS,AO_SETTINGS,"iAO_ON="+(string)g_iAO_ON,kID); + llMessageLinked(LINK_THIS,AO_SETTINGS,"start",kID); + ShowStatus(); + } else if (sCommand == "off") { + g_iAO_ON = FALSE; + llMessageLinked(LINK_THIS,AO_SETTINGS,"iAO_ON="+(string)g_iAO_ON,kID); + llMessageLinked(LINK_THIS,AO_SETOVERRIDE,"RESET:ALL",kID); + //llResetAnimationOverride("ALL"); + ShowStatus(); + } else { + return; + } + } + else { + return; + } } if (llSubStringIndex(llToLower(sCommand), llToLower(g_sAddon)) && llToLower(sCommand) != "menu " + llToLower(g_sAddon)) return; if (iNum == CMD_OWNER && llToLower(sCommand) == "runaway") { @@ -640,6 +658,9 @@ default { } ShowStatus(); } + if( iNum == AO_ANTISLIDE){ + llMessageLinked(LINK_THIS,AO_ANTISLIDE,"AOantislide off",g_kWearer); + } } listen(integer iChannel, string sName, key kID, string sMessage) { @@ -672,6 +693,9 @@ default { { Command(kID, sStr, iNum); } + else if ( iNum == AO_SETOVERRIDE){ + Command(kID, sStr, iNum); + } } } } From 54ddfbb724365ad8cae438c5a2e76fc945132eb9 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 24 Jun 2022 01:38:39 +0000 Subject: [PATCH 55/97] because some think the call is unessisary remove the custom call because some think its unnecessary and there would never possibly be any edge cases where some one would wan't to use that instead of the all command, for situations where the device falls between updates, and needs an immediate update, so addon creators will just have to wait for the system up ping or request a flood of information. --- src/collar/oc_rlvsys.lsl | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index c8adb532e..e5c148bcd 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -69,7 +69,6 @@ integer DO_RLV_REFRESH = 26001;//RLV plugins should reinstate their restrictions integer RLV_CLEAR = 6002;//RLV plugins should clear their restriction lists upon receiving this message. integer RLV_VERSION = 6003; //RLV Plugins can recieve the used RLV viewer version upon receiving this message.. integer RLVA_VERSION = 6004; //RLV Plugins can recieve the used RLVa viewer version upon receiving this message.. -integer RLV_VERSION_REQUEST = 6005; //RLV Plugins and addons can exclusivly request which version was detected. integer RLV_CMD_OVERRIDE=6010; //RLV Plugins can send one-shot (force) commands with a list of restrictions to temporarily lift if required to ensure that the one-shot commands can be executed integer RLV_OFF = 6100; @@ -491,13 +490,6 @@ state active llMessageLinked(LINK_SET,RLV_VERSION, (string) g_iRlvVersion,NULL_KEY); } } - } else if(iNum == RLV_VERSION_REQUEST ){ - if (g_iRlvaVersion) { - llMessageLinked(LINK_SET, RLVA_VERSION, (string) g_iRlvaVersion, NULL_KEY); - } - else { - llMessageLinked(LINK_SET,RLV_VERSION, (string) g_iRlvVersion,NULL_KEY); - } } else if(iNum == TIMEOUT_FIRED) { From e14ec08f2cc4c3f63a43e4b67f6c9c1de7b20e5d Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 9 Jul 2022 21:41:31 -0500 Subject: [PATCH 56/97] Ask mode fix In Ask mode only the first relay command was accepted. --- src/collar/oc_relay.lsl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index 40e0095c2..e96b26d37 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -11,13 +11,15 @@ Aria (Tashia Redrose) Felkami (Caraway Ohmai) *Dec 2020 - Fixed #461, Modified runaway language to not assume relay on at runaway - - *May 2020 - Fixed bug: !release or @clear sent to the relay would clear all +Kristen Mynx, Phidoux (taya Maruti) + *May 2021 - Fixed bug: !release or @clear sent to the relay would clear all restrictions and exceptions from the collar. Changed the relay to send all RLV commands through RLV_CMD link messages instead of directly to the viewer. oc_rlvsys will process them, and arbitrate between collar and relay restrictions and exceptions. Also removed DO_RLV_REFRESH which cleared all restrictions and exceptions. + *July 2020 - Fixed bug: Ask mode only accepted one RLV command from the object. + et al. Licensed under the GPLv2. See LICENSE for full details. @@ -258,7 +260,7 @@ list g_lPendingRLV; key g_kObjectOwner; PromptForSource(key kID, string sPendingCommand){ - g_lPendingRLV = [sPendingCommand]; + g_lPendingRLV = [sPendingCommand] + g_lPendingRLV; g_kObjectOwner = kID; Dialog(llGetOwner(), "[Relay]\n\nObject Name: "+llKey2Name(g_kPendingSource)+"\nObject ID: "+(string)g_kPendingSource+"\nObject Owner: secondlife:///app/agent/"+(string)kID+"/about\n\nIs requesting to use your RLV Relay, do you want to allow it?", ["Yes", "No"], [], 0, CMD_WEARER, "AskPrompt"); } From 6adf1b3bdcd4c5f9504ecd8403bdd21fec75d96e Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 9 Jul 2022 21:42:21 -0500 Subject: [PATCH 57/97] Corrected date --- src/collar/oc_relay.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index e96b26d37..2a72263fc 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -18,7 +18,7 @@ Kristen Mynx, Phidoux (taya Maruti) will process them, and arbitrate between collar and relay restrictions and exceptions. Also removed DO_RLV_REFRESH which cleared all restrictions and exceptions. - *July 2020 - Fixed bug: Ask mode only accepted one RLV command from the object. + *July 2021 - Fixed bug: Ask mode only accepted one RLV command from the object. et al. From fdc4ee636807678e53a17be4411746f7e59a5f93 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Sat, 9 Jul 2022 21:46:34 -0500 Subject: [PATCH 58/97] corrected dates again yes its 2022 --- src/collar/oc_relay.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/collar/oc_relay.lsl b/src/collar/oc_relay.lsl index 2a72263fc..c4c9d3bcd 100644 --- a/src/collar/oc_relay.lsl +++ b/src/collar/oc_relay.lsl @@ -12,13 +12,13 @@ Felkami (Caraway Ohmai) *Dec 2020 - Fixed #461, Modified runaway language to not assume relay on at runaway Kristen Mynx, Phidoux (taya Maruti) - *May 2021 - Fixed bug: !release or @clear sent to the relay would clear all + *May 2022 - Fixed bug: !release or @clear sent to the relay would clear all restrictions and exceptions from the collar. Changed the relay to send all RLV commands through RLV_CMD link messages instead of directly to the viewer. oc_rlvsys will process them, and arbitrate between collar and relay restrictions and exceptions. Also removed DO_RLV_REFRESH which cleared all restrictions and exceptions. - *July 2021 - Fixed bug: Ask mode only accepted one RLV command from the object. + *July 2022 - Fixed bug: Ask mode only accepted one RLV command from the object. et al. From 0de30a73664fda94350e773d60c89c01bc0aa5a7 Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Thu, 14 Jul 2022 12:24:02 -0500 Subject: [PATCH 59/97] Fix "BACK" Buttons --- src/cuffs/oc_cuff_resizer.lsl | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cuffs/oc_cuff_resizer.lsl b/src/cuffs/oc_cuff_resizer.lsl index 2779e62c4..97d772255 100644 --- a/src/cuffs/oc_cuff_resizer.lsl +++ b/src/cuffs/oc_cuff_resizer.lsl @@ -10,6 +10,9 @@ // Based on a split of OpenCollar - appearance by Romka Swallowtail // Virtual Disgrace - Resizer is derivative of OpenCollar - adjustment +// Kristen Mynx July 2022 +// Fix "BACK" buttons + string g_sScriptVersion = "8.1"; string g_sAddon = "OpenCollar Cuffs"; @@ -293,7 +296,7 @@ default else if (sMessage == SIZEMENU) SizeMenu(kAv, iAuth); } else if (sMenuType == POSMENU) { if (sMessage == UPMENU) { - llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + DoMenu(kAv, iAuth); //llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); return; } else if (llGetAttached()) { if (sMessage == "forward ↳") AdjustPos(); @@ -309,7 +312,7 @@ default PosMenu(kAv, iAuth); } else if (sMenuType == ROTMENU) { if (sMessage == UPMENU) { - llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + DoMenu(kAv, iAuth); //llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); return; } else if (llGetAttached()) { if (sMessage == "tilt right ↘") AdjustRot(); @@ -322,7 +325,7 @@ default RotMenu(kAv, iAuth); } else if (sMenuType == SIZEMENU) { if (sMessage == UPMENU) { - llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); + DoMenu(kAv, iAuth); //llMessageLinked(LINK_SET, 33, (string)kAv, (key)((string)iAuth)); return; } else { integer iMenuCommand = llListFindList(SIZEMENU_BUTTONS, [sMessage]); @@ -395,4 +398,4 @@ default } if (iChange & (CHANGED_SHAPE | CHANGED_LINK)) Store_StartScale(); } -} \ No newline at end of file +} From f998bffc3215372bbbbdfca366ddeb0f460670bd Mon Sep 17 00:00:00 2001 From: Kristen Mynx Date: Thu, 14 Jul 2022 12:26:34 -0500 Subject: [PATCH 60/97] Fix "BACK" Buttons (support for resizer) --- src/cuffs/oc_cuff.lsl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cuffs/oc_cuff.lsl b/src/cuffs/oc_cuff.lsl index 939dc9475..0b11b8a7a 100644 --- a/src/cuffs/oc_cuff.lsl +++ b/src/cuffs/oc_cuff.lsl @@ -13,6 +13,9 @@ Ping (Pingout Duffield) * April 2022 - Remove SyncLock, Clean Up Script Style Kristen Mynx * May 2022 - Added resizer support +Kristen Mynx + * July 2022 - Fix "BACK" buttons on resizer + et al. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -457,6 +460,8 @@ default PosesMenu((key)llList2String(lTmp,0), (integer)llList2String(lTmp,1), 0); } else if(iNum == 999) { Link(llJsonGetValue(sMsg, ["pkt"]), (integer)llJsonGetValue(sMsg, ["iNum"]), llJsonGetValue(sMsg, ["sMsg"]), (key)llJsonGetValue(sMsg,["kID"])); + } else if (iNum == 33) { + Menu((key)sMsg, (integer)((string)kID)); } } From e37f4e047f2896a5d751542f19f7af608f21b0e4 Mon Sep 17 00:00:00 2001 From: Silkie Sabra Date: Mon, 25 Jul 2022 16:21:33 -0400 Subject: [PATCH 61/97] Update oc_folders.lsl --- src/collar/oc_folders.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_folders.lsl b/src/collar/oc_folders.lsl index 4ac2472e3..d300349cc 100644 --- a/src/collar/oc_folders.lsl +++ b/src/collar/oc_folders.lsl @@ -303,7 +303,7 @@ integer g_iMenuAuth; LocksMenu(key kAv, integer iAuth, integer iMask) { - string sPrompt = "[Folders]\n> Locks\n\nPath: "+g_sPath+"\n\n* The subfolder options will lock/unlock this folder and all subfolders contained. It only affects your current path. To unlock every folder and clear all locks, see the main menu"; + string sPrompt = "[Folders]\n> Locks\n\nPath: "+g_sPath+"\n\n* The subfolder options will lock (check) / unlock (uncheck) this folder and all subfolders contained. It only affects your current path. To unlock every folder and clear all locks, see the main menu"; list lButtons = []; if(iMask & 1)lButtons += [Checkbox(TRUE, "det. subfolder")]; else lButtons += Checkbox(FALSE, "det. subfolder"); From a5ce4b0197d7ee2477f3ad0695fce655ec46838a Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:28:27 +0100 Subject: [PATCH 62/97] Update oc_core.lsl Fixes for issue #774. This is not a complete solution, but checks agent key match g_kWearer rather than checking auth level is CMD_WEARER throughout the script. This should fix the issues discussed in the #774, but there are other points in a few other scripts that will have to be addressed before closing that issue. --- src/collar/oc_core.lsl | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index e5bdaa1d6..f2230076c 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -23,7 +23,14 @@ Medea (Medea Destiny) Sept 2021 - Added sleep before notify for device name chage, issue #672 - Added confirmation messages when group or public access is toggled and fixed a typo - Efficiency pass, inlined majorminor(), docheckupdate() and docheckdevupdate(). - Removed g_lTestReports, left over from alpha.a + Removed g_lTestReports, left over from alpha. + Nov 2021 - Auth check for hide didn't account for situations when wearer tries to use hide with + AllowHiding ticked but access level is not CMD_WEARER (i.e. wearer set to trusted). + Jun 2021 - Fixes for #774 (extension to above, allowing for wearer set to trusted). Using + kID == g_kWearer instead of iNum==CMD_WEARER in UserCommad() for: + Safeword report, verbosity level, locking + And kAv == g_kWearer instead of iAuth == CMD_WEARER in meu dialog responses for: + + / - trusted / blacklist when wearer is permitted, displaying access list, print settigns Licensed under the GPLv2. See LICENSE for full details. @@ -225,7 +232,7 @@ UserCommand(integer iNum, string sStr, key kID) { llMessageLinked(LINK_SET,NOTIFY, "0Fixed menus", kID); llMessageLinked(LINK_SET,0,"initialize",""); } else if(sChangetype == "update"){ - if(iNum == CMD_OWNER || iNum == CMD_WEARER){ + if(iNum == CMD_OWNER || kID == g_kWearer){ g_iUpdatePin = llRound(llFrand(0x7FFFFFFF))+1; // Maximum integer size llSetRemoteScriptAccessPin(g_iUpdatePin); @@ -260,7 +267,7 @@ UserCommand(integer iNum, string sStr, key kID) { } } } else { - if(iNum == CMD_OWNER || iNum == CMD_WEARER){ + if(iNum == CMD_OWNER || kID == g_kWearer){ llMessageLinked(LINK_SET, NOTIFY, "0The safeword is current set to: '"+g_sSafeword+"'",kID); } } @@ -328,7 +335,7 @@ UserCommand(integer iNum, string sStr, key kID) { llMessageLinked(LINK_SET,NOTIFY,"0%NOACCESS% to toggling Allow Hide", kID); if(sChangevalue == "remenu")Settings(kID,iNum); } - } else if(llToLower(sChangetype)=="lock" && !g_iWelded && (iNum == CMD_OWNER || iNum == CMD_WEARER)){ + } else if(llToLower(sChangetype)=="lock" && !g_iWelded && (iNum == CMD_OWNER || kID == g_kWearer)){ // allow locking g_iLocked=TRUE; llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_locked="+(string)g_iLocked,""); @@ -535,19 +542,19 @@ state active iRespring=FALSE; Menu(kAv,iAuth); } else if(llGetSubString(sMsg,0,0) == "+"){ - if(iAuth == CMD_OWNER || (iAuth==CMD_WEARER && (sMsg=="+ Trust"||sMsg=="+ Block") && g_iAllowWearerSetTrusted==TRUE) ){ + if(iAuth == CMD_OWNER || (kAv == g_kWearer && (sMsg=="+ Trust"||sMsg=="+ Block") && g_iAllowWearerSetTrusted==TRUE) ){ iRespring=FALSE; llMessageLinked(LINK_SET, iAuth, "add "+llToLower(llGetSubString(sMsg,2,-1)), kAv); } else llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to adding a person", kAv); } else if(llGetSubString(sMsg,0,0)=="-"){ - if(iAuth == CMD_OWNER || (iAuth==CMD_WEARER && (sMsg=="- Trust"||sMsg=="-Block") && g_iAllowWearerSetTrusted==TRUE) ){ + if(iAuth == CMD_OWNER || (kAv == g_kWearer && (sMsg=="- Trust"||sMsg=="-Block") && g_iAllowWearerSetTrusted==TRUE) ){ iRespring=FALSE; llMessageLinked(LINK_SET, iAuth, "rem "+llToLower(llGetSubString(sMsg,2,-1)), kAv); } else llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to removing a person", kAv); } else if(sMsg == "Access List"){ - if(iAuth == CMD_OWNER || iAuth == CMD_WEARER ){ + if(iAuth == CMD_OWNER || kAv == g_kWearer ){ llMessageLinked(LINK_SET, iAuth, "print auth", kAv);} } else if(sMsg == Checkbox(bool((g_kGroup!="")), "Group")){ if(iAuth ==CMD_OWNER){ @@ -613,25 +620,21 @@ state active }else{ llMessageLinked(LINK_SET,NOTIFY,"0%NOACCESS% to changing policy on listening to local chat for collar commands.",kAv);} } else if(sMsg == "Print"){ - if(iAuth==CMD_OWNER || iAuth==CMD_WEARER) llMessageLinked(LINK_SET, iAuth, "print settings", kAv); + if(iAuth==CMD_OWNER || kAv == g_kWearer) llMessageLinked(LINK_SET, iAuth, "print settings", kAv); else llMessageLinked(LINK_SET,NOTIFY,"0%NOACCESS% to reading settings.",kAv); } else if(sMsg == "Fix Menus"){ llMessageLinked(LINK_SET, iAuth, "fix", kAv); llMessageLinked(LINK_SET, NOTIFY, "0Menus have been fixed", kAv); } else if(sMsg == Checkbox(g_iHide,"Hide")){ - - if(!g_iAllowHide && iAuth == CMD_WEARER){ - llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to hiding the collar", kAv); - return; + if((kAv == g_kWearer && g_iAllowHide==TRUE)||iAuth==CMD_OWNER){ + g_iHide=1-g_iHide; + llMessageLinked(LINK_SET, iAuth, setor(g_iHide, "hide", "show"), kAv); + llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_hide="+(string)g_iHide, ""); } - if(iAuth != CMD_OWNER && iAuth!= CMD_WEARER){ - llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to hiding the collar", kAv); + else { + llMessageLinked(LINK_SET, NOTIFY, "0%NOACCESS% to hiding the collar", kAv); return; } - - g_iHide=1-g_iHide; - llMessageLinked(LINK_SET, iAuth, setor(g_iHide, "hide", "show"), kAv); - llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_hide="+(string)g_iHide, ""); } else if(sMsg == "Load"){ llMessageLinked(LINK_SET, iAuth, sMsg, kAv); } else if(sMsg == "Resize"){ From bbf4d238eec64ba8ed467909c0beb841f00a8978 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:38:03 +0100 Subject: [PATCH 63/97] Update oc_core.lsl --- src/collar/oc_core.lsl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index f2230076c..65009e85f 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -24,8 +24,9 @@ Medea (Medea Destiny) - Added confirmation messages when group or public access is toggled and fixed a typo - Efficiency pass, inlined majorminor(), docheckupdate() and docheckdevupdate(). Removed g_lTestReports, left over from alpha. - Nov 2021 - Auth check for hide didn't account for situations when wearer tries to use hide with - AllowHiding ticked but access level is not CMD_WEARER (i.e. wearer set to trusted). + Nov 2021 - Auth check for hide didn't account for when wearer tries to use hide with AllowHiding + ticked but access is not CMD_WEARER (i.e. wearer set to trusted). (see #774) + March 2022 - Stormed Darkshade (StormedStormy) Added a button for reboot to help/about menu. Jun 2021 - Fixes for #774 (extension to above, allowing for wearer set to trusted). Using kID == g_kWearer instead of iNum==CMD_WEARER in UserCommad() for: Safeword report, verbosity level, locking @@ -193,7 +194,7 @@ HelpMenu(key kID, integer iAuth){ llMessageLinked(LINK_SET, NOTIFY, sPrompt, kID); return; } - list lButtons = ["Update", "Support", "License"]; + list lButtons = ["Update", "Support", "License", "Reboot"]; Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Help"); } @@ -685,6 +686,8 @@ state active if(sMsg == UPMENU){ iRespring=FALSE; Menu(kAv,iAuth); + } else if(sMsg == "Reboot") + {llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); } else if(sMsg == "Support"){ From 5e39b717737a778975fe8151d0dec486308f1902 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:42:11 +0100 Subject: [PATCH 64/97] Update oc_core.lsl --- src/collar/oc_core.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index 65009e85f..5934f717f 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -686,8 +686,8 @@ state active if(sMsg == UPMENU){ iRespring=FALSE; Menu(kAv,iAuth); - } else if(sMsg == "Reboot") - {llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); + } else if(sMsg == "Reboot"){ + llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); } else if(sMsg == "Support"){ From b291e0dd3b14c61fa443de65cba4e3ea1745975d Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 02:44:22 +0100 Subject: [PATCH 65/97] Update oc_core.lsl --- src/collar/oc_core.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index 5934f717f..f4365ca9f 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -686,7 +686,7 @@ state active if(sMsg == UPMENU){ iRespring=FALSE; Menu(kAv,iAuth); - } else if(sMsg == "Reboot"){ + } else if(sMsg == "Reboot") { llMessageLinked(LINK_SET, iAuth, "Reboot", kAv); } else if(sMsg == "License"){ llGiveInventory(kAv, ".license"); From 71da0dfee8e3d9d1d043b12365215456677926a3 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 03:03:55 +0100 Subject: [PATCH 66/97] Update oc_rlvextension.lsl --- src/collar/oc_rlvextension.lsl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 033d54539..3ffb80df0 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -46,6 +46,7 @@ Medea Destiny - Feb2021 - SetAllExes triggered on RLV_REFRESH / RLV_ON was saving values, causing exception settings to be restored to defaults if trigged before settings are received. (fixes #740, #720, #719) + */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; From d2f89991576647e8479434bda8b337b44eb50790 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 03:16:55 +0100 Subject: [PATCH 67/97] Update oc_rlvextension.lsl Fixes triggering of SetAllExes save values on RLV_Refresh or RLV_ON, causing exceptions to be restored to defaults if it's triggered before settings are received (fixes #740, #720, #719) Disengages a restriction set by strict sit if one already exists due to sitting when strict sit is switched off. --- src/collar/oc_rlvextension.lsl | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 3ffb80df0..7c772dfe5 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -46,7 +46,10 @@ Medea Destiny - Feb2021 - SetAllExes triggered on RLV_REFRESH / RLV_ON was saving values, causing exception settings to be restored to defaults if trigged before settings are received. (fixes #740, #720, #719) - + + +Krysten Minx - + May2022 - Added check for valid UUID when setting custom exception */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -588,12 +591,15 @@ state active g_sTmpExceptionName=sMsg; MenuAddCustomExceptionID(kAv,iAuth); } else if(sMenu == "Exceptions~AddCustomID"){ - g_kTmpExceptionID = (key)sMsg; - llMessageLinked(LINK_SET,NOTIFY,"0Adding exception..", kAv); - g_lCustomExceptions += [g_sTmpExceptionName,g_kTmpExceptionID,0]; - - Save(SAVE_CUSTOM); - MenuSetExceptions(kAv, iAuth, "Custom"); + if ((key)sMsg) { // true if valid UUID, false if not + g_kTmpExceptionID = (key)sMsg; + llMessageLinked(LINK_SET,NOTIFY,"0Adding exception..", kAv); + g_lCustomExceptions += [g_sTmpExceptionName,g_kTmpExceptionID,0]; + Save(SAVE_CUSTOM); + MenuSetExceptions(kAv, iAuth, "Custom"); + } else { + llMessageLinked(LINK_SET,NOTIFY,"0Invalid UUID "+sMsg, kAv); + } } else if (sMenu == "Exceptions~Set") { if (sMsg == UPMENU) MenuExceptions(kAv,iAuth); else { From a1faad9489836099100a8ea0c6b32be6405c3774 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 3 Aug 2022 03:23:14 +0100 Subject: [PATCH 68/97] Update oc_core.lsl --- src/collar/oc_core.lsl | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index f4365ca9f..c4e89b275 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -25,14 +25,15 @@ Medea (Medea Destiny) - Efficiency pass, inlined majorminor(), docheckupdate() and docheckdevupdate(). Removed g_lTestReports, left over from alpha. Nov 2021 - Auth check for hide didn't account for when wearer tries to use hide with AllowHiding - ticked but access is not CMD_WEARER (i.e. wearer set to trusted). (see #774) - March 2022 - Stormed Darkshade (StormedStormy) Added a button for reboot to help/about menu. + ticked but access is not CMD_WEARER (i.e. wearer set to trusted). (see #774) Jun 2021 - Fixes for #774 (extension to above, allowing for wearer set to trusted). Using kID == g_kWearer instead of iNum==CMD_WEARER in UserCommad() for: Safeword report, verbosity level, locking And kAv == g_kWearer instead of iAuth == CMD_WEARER in meu dialog responses for: - + / - trusted / blacklist when wearer is permitted, displaying access list, print settigns - + + / - trusted / blacklist when wearer is permitted, displaying access list, print settings + +Stormed Darkshade (StormedStormy) + March 2022 - Added a button for reboot to help/about menu. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar From ead68d38e1a6d53d57c32dbdbf28586f18d1136e Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:18:58 +0000 Subject: [PATCH 69/97] moving to q1 to help roan out a tool to allow creators to test the debugger from a plugin script format. --- src/spares/plugin_test_debugger.lsl | 144 ++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 src/spares/plugin_test_debugger.lsl diff --git a/src/spares/plugin_test_debugger.lsl b/src/spares/plugin_test_debugger.lsl new file mode 100644 index 000000000..fe79eb9be --- /dev/null +++ b/src/spares/plugin_test_debugger.lsl @@ -0,0 +1,144 @@ +/* +THIS FILE IS HEREBY RELEASED UNDER THE Public Domain +This script is released public domain, unlike other OC scripts for a specific and limited reason, because we want to encourage third party plugin creators to create for OpenCollar and use whatever permissions on their own work they see fit. No portion of OpenCollar derived code may be used excepting this script, without the accompanying GPLv2 license. +-Authors Attribution- +Phidoux (taya.maruti) - (july 2022) +*/ + + +string g_sParentMenu = "Apps"; +string g_sSubMenu = "dbgTest"; + + +//MESSAGE MAP +//integer CMD_ZERO = 0; +integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +integer CMD_WEARER = 503; +//integer CMD_EVERYONE = 504; +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; + +//integer NOTIFY = 1002; +integer REBOOT = -1000; + +//integer LM_SETTING_SAVE = 2000;//scripts send messages on this channel to have settings saved +//str must be in form of "token=value" +integer LM_SETTING_REQUEST = 2001;//when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002;//the settings script sends responses on this channel +integer LM_SETTING_DELETE = 2003;//delete token from settings +//integer LM_SETTING_EMPTY = 2004;//sent when a token has no value + +integer MENUNAME_REQUEST = 3000; +integer MENUNAME_RESPONSE = 3001; +//integer MENUNAME_REMOVE = 3003; + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; +string UPMENU = "BACK"; + +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { + key kMenuID = llGenerateKey(); + llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); + + integer iIndex = llListFindList(g_lMenuIDs, [kID]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kID, kMenuID, sName], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kID, kMenuID, sName]; +} + +Menu(key kID, integer iAuth) { + string sPrompt = "\n[Menu App]\n this menu allows you to test the debug plugin!."; + list lButtons = ["Error","Warn","Info"]; + Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Main"); +} + +UserCommand(integer iNum, string sStr, key kID) { + if (iNumCMD_WEARER){ + return; + } + if (llSubStringIndex(llToLower(sStr),llToLower(g_sSubMenu)) && llToLower(sStr) != "menu "+llToLower(g_sSubMenu)){ + return; + } + if (llToLower(sStr)==llToLower(g_sSubMenu) || llToLower(sStr) == "menu "+llToLower(g_sSubMenu)){ + Menu(kID, iNum); + } + else { + } +} + +key g_kWearer; +list g_lMenuIDs; +integer g_iMenuStride; + +integer ALIVE = -55; +integer READY = -56; +integer STARTUP = -57; +default +{ + on_rez(integer iNum){ + llResetScript(); + } + state_entry(){ + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); + } + link_message(integer iSender, integer iNum, string sStr, key kID){ + if(iNum == REBOOT){ + if(sStr == "reboot"){ + llResetScript(); + } + } else if(iNum == READY){ + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(), ""); + } else if(iNum == STARTUP){ + state active; + } + } +} +state active +{ + on_rez(integer t){ + if(llGetOwner()!=g_kWearer) llResetScript(); + } + state_entry() + { + g_kWearer = llGetOwner(); + llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global_locked",""); + } + link_message(integer iSender,integer iNum,string sStr,key kID){ + if(iNum >= CMD_OWNER && iNum <= CMD_WEARER){ + UserCommand(iNum, sStr, kID); + } else if(iNum == MENUNAME_REQUEST && sStr == g_sParentMenu) { + llMessageLinked(iSender, MENUNAME_RESPONSE, g_sParentMenu+"|"+ g_sSubMenu,""); + } else if(iNum == DIALOG_RESPONSE){ + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if(iMenuIndex!=-1){ + string sMenu = llList2String(g_lMenuIDs, iMenuIndex+1); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex-1, iMenuIndex-2+g_iMenuStride); + list lMenuParams = llParseString2List(sStr, ["|"],[]); + key kAv = llList2Key(lMenuParams,0); + string sMsg = llList2String(lMenuParams,1); + integer iAuth = llList2Integer(lMenuParams,3); + + if(sMenu == "Menu~Main"){ + if(sMsg == UPMENU){ + llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); + } else if(sMsg == "Error"){ + llMessageLinked(LINK_SET,DEBUG_CHANNEL,"ERR: this is an example error message!",kAv); + Menu(kAv, iAuth); + } else if(sMsg == "Warn"){ + llMessageLinked(LINK_SET,DEBUG_CHANNEL,"WRN: this is an example warning message!",kAv); + Menu(kAv, iAuth); + } else if(sMsg == "Info"){ + llMessageLinked(LINK_SET,DEBUG_CHANNEL,"INFO: this is an example informatinal message!",kAv); + Menu(kAv, iAuth); + } + } + } + } else if (iNum == DIALOG_TIMEOUT) { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex +3); //remove stride from g_lMenuIDs + } + } +} From 97d05c8368e3c7628db44ff7e073f06b83bcb733 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:22:55 +0000 Subject: [PATCH 70/97] Create addon_test_debugger.lsl moving to help roan with the merge of q1 --- src/spares/addon_test_debugger.lsl | 227 +++++++++++++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 src/spares/addon_test_debugger.lsl diff --git a/src/spares/addon_test_debugger.lsl b/src/spares/addon_test_debugger.lsl new file mode 100644 index 000000000..d8e8d4c18 --- /dev/null +++ b/src/spares/addon_test_debugger.lsl @@ -0,0 +1,227 @@ +/* +THIS FILE IS HEREBY RELEASED UNDER THE Public Domain +This script is released public domain, unlike other OC scripts for a specific and limited reason, because we want to encourage third party plugin creators to create for OpenCollar and use whatever permissions on their own work they see fit. No portion of OpenCollar derived code may be used excepting this script, without the accompanying GPLv2 license. +-Authors Attribution- +Taya'Phidoux' (taya.maruti) - (july 2022) +*/ + +integer API_CHANNEL = 0x60b97b5e; + +//list g_lCollars; +string g_sAddon = "dbgTest"; + +//integer CMD_ZERO = 0; +integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +integer CMD_WEARER = 503; +integer CMD_EVERYONE = 504; +//integer CMD_BLOCKED = 598; // <--- Used in auth_request, will not return on a CMD_ZERO +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; +//integer CMD_NOACCESS = 599; + +//integer LM_SETTING_SAVE = 2000; //scripts send messages on this channel to have settings saved, must be in form of "token=value" +integer LM_SETTING_REQUEST = 2001; //when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002; //the settings script sends responses on this channel +//integer LM_SETTING_DELETE = 2003; //delete token from settings +//integer LM_SETTING_EMPTY = 2004; //sent when a token has no value + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; + +/* + * Since Release Candidate 1, Addons will not receive all link messages without prior opt-in. + * To opt in, add the needed link messages to g_lOptedLM = [], they'll be transmitted on + * the initial registration and can be updated at any time by sending a packet of type `update` + * Following LMs require opt-in: + * [ALIVE, READY, STARTUP, CMD_ZERO, MENUNAME_REQUEST, MENUNAME_RESPONSE, MENUNAME_REMOVE, SAY, NOTIFY, DIALOG, SENSORDIALOG] + */ +list g_lOptedLM = []; + +list g_lMenuIDs; +integer g_iMenuStride; + +string UPMENU = "BACK"; + +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { + key kMenuID = llGenerateKey(); + + llRegionSayTo(g_kCollar, API_CHANNEL, llList2Json(JSON_OBJECT, [ "pkt_type", "from_addon", "addon_name", g_sAddon, "iNum", DIALOG, "sMsg", (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, "kID", kMenuID ])); + + integer iIndex = llListFindList(g_lMenuIDs, [kID]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [ kID, kMenuID, sName ], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kID, kMenuID, sName]; +} + +Menu(key kID, integer iAuth) { + string sPrompt = "\n[Menu App]\n this menu allows you to test the debug plugin!."; + list lButtons = ["Error","Warn","Info"]; + Dialog(kID, sPrompt, lButtons, ["DISCONNECT", UPMENU], 0, iAuth, "Menu~Main"); +} + +UserCommand(integer iNum, string sStr, key kID) { + if (iNumCMD_WEARER){ + return; + } + if (llSubStringIndex(llToLower(sStr), llToLower(g_sAddon)) && llToLower(sStr) != "menu " + llToLower(g_sAddon)){ + return; + } + if (llToLower(sStr) == llToLower(g_sAddon) || llToLower(sStr) == "menu "+llToLower(g_sAddon)) { + Menu(kID, iNum); + } else{ + } +} + +Link(string packet, integer iNum, string sStr, key kID){ + list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; + + if (packet == "online" || packet == "update") // only add optin if packet type is online or update + { + packet_data += [ "optin", llDumpList2String(g_lOptedLM, "~") ]; + } + + string pkt = llList2Json(JSON_OBJECT, packet_data); + if (g_kCollar != "" && g_kCollar != NULL_KEY) { + llRegionSayTo(g_kCollar, API_CHANNEL, pkt); + } else{ + llRegionSay(API_CHANNEL, pkt); + } +} + +key g_kCollar=NULL_KEY; +key g_kWearer=NULL_KEY; +integer g_iLMLastRecv; +integer g_iLMLastSent; + +initialize(){ + g_kWearer=llGetOwner(); + API_CHANNEL = ((integer)("0x" + llGetSubString((string)llGetOwner(), 0, 8))) + 0xf6eb - 0xd2; + llListen(API_CHANNEL, "", "", ""); + Link("online", 0, "", llGetOwner()); // This is the signal to initiate communication between the addon and the collar + llSetTimerEvent(10); + g_iLMLastRecv = llGetUnixTime(); + g_iLMLastSent = llGetUnixTime(); +} + +softreset(){ + g_kCollar = NULL_KEY; + initialize(); +} + +shutdown(){ + g_lMenuIDs = []; + g_kCollar = NULL_KEY; + llRequestPermissions(g_kWearer, PERMISSION_ATTACH ); + llDetachFromAvatar(); +} + +default +{ + state_entry(){ + initialize(); + } + + on_rez(integer start_pram){ + softreset(); + } + + attach(key kID) { + if (kID == NULL_KEY) llResetScript(); + else if (llGetAttached() <= 30) { + llOwnerSay("Sorry, this device can only be attached to the HUD."); + llRequestPermissions(kID, PERMISSION_ATTACH); + llDetachFromAvatar(); + } else if(kID != g_kWearer){ + llResetScript(); + } else { + softreset(); + } + } + + changed(integer change){ + if( change & CHANGED_REGION){ + softreset(); + } + if (change & CHANGED_INVENTORY){ + softreset(); + } + } + + timer(){ + if (llGetUnixTime() >= (g_iLMLastSent + 30)){ + g_iLMLastSent = llGetUnixTime(); + Link("ping", 0, "", g_kCollar); + } + + if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY){ + softreset(); + } + + if (g_kCollar == NULL_KEY){ + Link("online", 0, "", llGetOwner()); + } + } + + listen(integer channel, string name, key id, string msg){ + string sPacketType = llJsonGetValue(msg, ["pkt_type"]); + if (sPacketType == "approved" && g_kCollar == NULL_KEY){ + // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. + g_kCollar = id; + g_iLMLastRecv = llGetUnixTime(); // Initial message should also count as a pong for timing reasons + Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); + } + else if (sPacketType == "dc" && g_kCollar == id){ + softreset(); + } + else if (sPacketType == "pong" && g_kCollar == id){ + g_iLMLastRecv = llGetUnixTime(); + } + else if(sPacketType == "from_collar"){ + // process link message if in range of addon + if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0){ + integer iNum = (integer) llJsonGetValue(msg, ["iNum"]); + string sStr = llJsonGetValue(msg, ["sMsg"]); + key kID = (key) llJsonGetValue(msg, ["kID"]); + if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE){ + UserCommand(iNum, sStr, kID); + + } + else if (iNum == DIALOG_TIMEOUT){ + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex + 3); //remove stride from g_lMenuIDs + } + else if (iNum == DIALOG_RESPONSE){ + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if (iMenuIndex != -1){ + string sMenu = llList2String(g_lMenuIDs, iMenuIndex + 1); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); + list lMenuParams = llParseString2List(sStr, ["|"], []); + key kAv = llList2Key(lMenuParams, 0); + string sMsg = llList2String(lMenuParams, 1); + integer iAuth = llList2Integer(lMenuParams, 3); + + if (sMenu == "Menu~Main"){ + if (sMsg == UPMENU){ + Link("from_addon", iAuth, "menu Addons", kAv); + }else if(sMsg == "Error"){ + Link("from_addon",DEBUG_CHANNEL,"ERR: this is an example error message!",kAv); + Menu(kAv, iAuth); + } else if(sMsg == "Warn"){ + Link("from_addon",DEBUG_CHANNEL,"WRN: this is an example warning message!",kAv); + Menu(kAv, iAuth); + } else if(sMsg == "Info"){ + Link("from_addon",DEBUG_CHANNEL,"INFO: this is an example informatinal message!",kAv); + Menu(kAv, iAuth); + } else if (sMsg == "DISCONNECT"){ + shutdown(); + } + } + } + } + } + } + } +} From e8bf81dc02ddd3cf85944b4a95cec650654ba916 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:38:25 +0000 Subject: [PATCH 71/97] Create oc_lock_addon_template.lsl create a copy of oc_lock_addon_template to resolve the differences. --- src/spares/oc_lock_addon_template.lsl | 317 ++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 src/spares/oc_lock_addon_template.lsl diff --git a/src/spares/oc_lock_addon_template.lsl b/src/spares/oc_lock_addon_template.lsl new file mode 100644 index 000000000..4f59d1fb9 --- /dev/null +++ b/src/spares/oc_lock_addon_template.lsl @@ -0,0 +1,317 @@ +/* +THIS FILE IS HEREBY RELEASED UNDER THE Public Domain +This script is released public domain, unlike other OC scripts for a specific and limited reason, because we want to encourage third party plugin creators to create for OpenCollar and use whatever permissions on their own work they see fit. No portion of OpenCollar derived code may be used excepting this script, without the accompanying GPLv2 license. +-Authors Attribution- +Aria (tiff589) - (August 2020) +Lysea - (December 2020) +*/ + +integer API_CHANNEL = 0x60b97b5e; + +//list g_lCollars; +string g_sAddon = "Addon Name Here"; + +//integer CMD_ZERO = 0; +integer CMD_OWNER = 500; +//integer CMD_TRUSTED = 501; +//integer CMD_GROUP = 502; +integer CMD_WEARER = 503; +integer CMD_EVERYONE = 504; +//integer CMD_BLOCKED = 598; // <--- Used in auth_request, will not return on a CMD_ZERO +//integer CMD_RLV_RELAY = 507; +//integer CMD_SAFEWORD = 510; +//integer CMD_RELAY_SAFEWORD = 511; +//integer CMD_NOACCESS = 599; + +//integer LM_SETTING_SAVE = 2000; //scripts send messages on this channel to have settings saved, must be in form of "token=value" +integer LM_SETTING_REQUEST = 2001; //when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002; //the settings script sends responses on this channel +//integer LM_SETTING_DELETE = 2003; //delete token from settings +//integer LM_SETTING_EMPTY = 2004; //sent when a token has no value + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; + +/* + * Since Release Candidate 1, Addons will not receive all link messages without prior opt-in. + * To opt in, add the needed link messages to g_lOptedLM = [], they'll be transmitted on + * the initial registration and can be updated at any time by sending a packet of type `update` + * Following LMs require opt-in: + * [ALIVE, READY, STARTUP, CMD_ZERO, MENUNAME_REQUEST, MENUNAME_RESPONSE, MENUNAME_REMOVE, SAY, NOTIFY, DIALOG, SENSORDIALOG] + */ +list g_lOptedLM = []; + +list g_lMenuIDs; +integer g_iMenuStride; +integer iLockAuth = 503; + +string UPMENU = "BACK"; + +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { + key kMenuID = llGenerateKey(); + + llRegionSayTo(g_kCollar, API_CHANNEL, llList2Json(JSON_OBJECT, [ "pkt_type", "from_addon", "addon_name", g_sAddon, "iNum", DIALOG, "sMsg", (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, "kID", kMenuID ])); + + integer iIndex = llListFindList(g_lMenuIDs, [kID]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [ kID, kMenuID, sName ], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kID, kMenuID, sName]; +} + +Menu(key kID, integer iAuth) { + string sPrompt = "\n[Menu App]"; + list lButtons = [bLock]; + //llSay(0, "opening menu"); + Dialog(kID, sPrompt, lButtons, ["DISCONNECT", UPMENU], 0, iAuth, "Menu~Main"); +} + +UserCommand(integer iNum, string sStr, key kID) { + if (iNumCMD_WEARER) return; + if (llSubStringIndex(llToLower(sStr), llToLower(g_sAddon)) && llToLower(sStr) != "menu " + llToLower(g_sAddon)) return; + if (iNum == CMD_OWNER && llToLower(sStr) == "runaway") { + lock = FALSE; + check_settings(); + return; + } + + if (llToLower(sStr) == llToLower(g_sAddon) || llToLower(sStr) == "menu "+llToLower(g_sAddon)) + { + if(lock){ + if(iNum < CMD_WEARER && iNum >= CMD_OWNER){ + Menu(kID, iNum); + } + else{ + llInstantMessage(kID,"Sorry you are not authorized"); + } + } + else{ + Menu(kID, iNum); + } + } //else if (iNum!=CMD_OWNER && iNum!=CMD_TRUSTED && kID!=g_kWearer) RelayNotify(kID,"Access denied!",0); + else + { + list lCommands = llParseString2List(llToLower(sStr),[" "],[llToLower(g_sAddon)]); + string sCommand = llList2String(lCommands,1); + string sVar = llList2String(lCommands,2); + string sVal = llList2String(lCommands,3); + if( iNum == CMD_WEARER && lock) { + /* we lock out the wearer from access even if they are the one who locked it. + This Section can be commented out for it to be possible for the wearer to + unlock them self if they lock it. + */ + llInstantMessage(kID,"Sorry the lock is engaged you have no access!"); + return; + } + if (sCommand == "unlock" && iNum <= iLockAuth){ + lock = FALSE; + iLockAuth = CMD_WEARER; + llInstantMessage(kID,"/me makes a soft click as the lock is disabled"); + llPlaySound("82fa6d06-b494-f97c-2908-84009380c8d1", 1.0); + check_settings(); + } + else if (sCommand == "lock" && iNum <= iLockAuth){ + lock = TRUE; + iLockAuth = iNum; + llInstantMessage(kID,"/me makes a soft click as the lock is enabled"); + llPlaySound("dec9fb53-0fef-29ae-a21d-b3047525d312", 1.0); + check_settings(); + } else llInstantMessage(kID,"Sorry you are not authorized to unlock this device"); + } +} + +Link(string packet, integer iNum, string sStr, key kID){ + list packet_data = [ "pkt_type", packet, "iNum", iNum, "addon_name", g_sAddon, "bridge", FALSE, "sMsg", sStr, "kID", kID ]; + + if (packet == "online" || packet == "update") // only add optin if packet type is online or update + { + llListInsertList(packet_data, [ "optin", llDumpList2String(g_lOptedLM, "~") ], -1); + } + + string pkt = llList2Json(JSON_OBJECT, packet_data); + if (g_kCollar != "" && g_kCollar != NULL_KEY) + { + llRegionSayTo(g_kCollar, API_CHANNEL, pkt); + } + else + { + llRegionSay(API_CHANNEL, pkt); + } +} + +key g_kCollar=NULL_KEY; +integer g_iLMLastRecv; +integer g_iLMLastSent; +key g_kWearer; + +initialize(){ + g_kWearer = llGetOwner(); + API_CHANNEL = ((integer)("0x" + llGetSubString((string)g_kWearer, 0, 8))) + 0xf6eb - 0xd2; + llListen(API_CHANNEL, "", "", ""); + Link("online", 0, "", g_kWearer); // This is the signal to initiate communication between the addon and the collar + llSetTimerEvent(10); + g_iLMLastSent = llGetUnixTime(); + check_settings(); +} + +softreset(){ + g_kCollar = NULL_KEY; + initialize(); +} + +shutdown(){ + lock=FALSE; + llOwnerSay("@detach=y"); + g_lMenuIDs = []; + g_kCollar = NULL_KEY; + Link("offline", 0, "", llGetOwnerKey(g_kCollar)); +} + +integer l_Authorized = 503; +integer lock = FALSE; +string bLock; +string baLock = "☒Lock"; +string biLock = "☐Lock"; + +check_settings() +{ + if (lock ){ + bLock=baLock; + llOwnerSay("@detach=n"); + } + else { + bLock=biLock; + llOwnerSay("@detach=y"); + } +} + +default +{ + state_entry() + { + initialize(); + } + + on_rez(integer start_pram){ + softreset(); + } + attach(key kID) { + if (kID == NULL_KEY) llResetScript(); + else if(kID != g_kWearer){ + llResetScript(); + } else { + softreset(); + } + } + changed(integer change){ + if(change & CHANGED_REGION){ + softreset(); + } + } + + timer() + { + if (llGetUnixTime() >= (g_iLMLastSent + 30)) + { + g_iLMLastSent = llGetUnixTime(); + Link("ping", 0, "", g_kCollar); + } + + if (llGetUnixTime() > (g_iLMLastRecv + (5 * 60)) && g_kCollar != NULL_KEY) + { + //shutdown(); + softreset(); + } + + if (g_kCollar == NULL_KEY) Link("online", 0, "", g_kWearer); + } + + listen(integer channel, string name, key id, string msg){ + string sPacketType = llJsonGetValue(msg, ["pkt_type"]); + if (sPacketType == "approved" && g_kCollar == NULL_KEY) + { + // This signal, indicates the collar has approved the addon and that communication requests will be responded to if the requests are valid collar LMs. + g_kCollar = id; + Link("from_addon", LM_SETTING_REQUEST, "ALL", ""); + g_iLMLastRecv = llGetUnixTime(); + } + else if (sPacketType == "dc" && g_kCollar == id) + { + //shutdown(); + softreset(); + //llResetScript(); // This addon is designed to always be connected because it is a test + } + else if (sPacketType == "pong" && g_kCollar == id) + { + g_iLMLastRecv = llGetUnixTime(); + } + else if(sPacketType == "from_collar") + { + // process link message if in range of addon + if (llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(id, [OBJECT_POS]), 0)) <= 10.0) + { + integer iNum = (integer) llJsonGetValue(msg, ["iNum"]); + string sStr = llJsonGetValue(msg, ["sMsg"]); + key kID = (key) llJsonGetValue(msg, ["kID"]); + + if (iNum == LM_SETTING_RESPONSE) + { + list lPar = llParseString2List(sStr, ["_","="], []); + string sToken = llList2String(lPar, 0); + string sVar = llList2String(lPar, 1); + string sVal = llList2String(lPar, 2); + + if (sToken == "auth") + { + if (sVar == "owner") + { + //llSay(0, "owner values is: " + sVal); + } + } + } + else if (iNum >= CMD_OWNER && iNum <= CMD_EVERYONE) + { + UserCommand(iNum, sStr, kID); + + } + else if (iNum == DIALOG_TIMEOUT) + { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex + 3); //remove stride from g_lMenuIDs + } + else if (iNum == DIALOG_RESPONSE) + { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if (iMenuIndex != -1) + { + string sMenu = llList2String(g_lMenuIDs, iMenuIndex + 1); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex - 2 + g_iMenuStride); + list lMenuParams = llParseString2List(sStr, ["|"], []); + key kAv = llList2Key(lMenuParams, 0); + string sMsg = llList2String(lMenuParams, 1); + integer iAuth = llList2Integer(lMenuParams, 3); + + if (sMenu == "Menu~Main") + { + if (sMsg == UPMENU) + { + Link("from_addon", iAuth, "menu Addons", kAv); + } + if (sMsg == baLock ) + { + UserCommand(iAuth,g_sAddon+"unlock",kAv); + } + if (sMsg == biLock ) + { + UserCommand(iAuth,g_sAddon+"lock",kAv); + } + else if (sMsg == "DISCONNECT") + { + shutdown(); + } + } + } + } + } + } + } +} From 33cc284fe97499f9bc8900fc732bc5393445d696 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:40:48 +0000 Subject: [PATCH 72/97] Create oc_debugger move oc_debugger to q1 --- src/spares/oc_debugger | 233 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 src/spares/oc_debugger diff --git a/src/spares/oc_debugger b/src/spares/oc_debugger new file mode 100644 index 000000000..5a0dccbdc --- /dev/null +++ b/src/spares/oc_debugger @@ -0,0 +1,233 @@ +/* +THIS FILE IS HEREBY RELEASED UNDER THE Public Domain +This script is released public domain, unlike other OC scripts for a specific and limited reason, because we want to encourage third party plugin creators to create for OpenCollar and use whatever permissions on their own work they see fit. No portion of OpenCollar derived code may be used excepting this script, without the accompanying GPLv2 license. +-Authors Attribution- +Phidoux (taya.maruti) - (july 2022) +*/ + +string g_sVersion = "1.0"; +string g_sParentMenu = "Apps"; +string g_sSubMenu = "Debugger"; + +//MESSAGE MAP +integer CMD_OWNER = 500; +integer CMD_WEARER = 503; +integer REBOOT = -1000; + +integer MENUNAME_REQUEST = 3000; +integer MENUNAME_RESPONSE = 3001; +integer LM_SETTING_SAVE = 2000; //scripts send messages on this channel to have settings saved, must be in form of "token=value" +integer LM_SETTING_REQUEST = 2001; //when startup, scripts send requests for settings on this channel +integer LM_SETTING_RESPONSE = 2002; //the settings script sends responses on this channel +integer LM_SETTING_DELETE = 2003; //delete token from settings +//integer LM_SETTING_EMPTY = 2004; //sent when a token has no value + +integer DIALOG = -9000; +integer DIALOG_RESPONSE = -9001; +integer DIALOG_TIMEOUT = -9002; +integer DEBUG=DEBUG_CHANNEL; + +string UPMENU = "BACK"; +list g_lCheckBoxes = ["☐","☑"]; +list b_lCheckBoxes; +string b_sActive; +string d_sActive= "Active"; +string outType = "Info"; +string outChan = "OwnerSay"; + +Dialog(key kID, string sPrompt, list lChoices, list lUtilityButtons, integer iPage, integer iAuth, string sName) { + key kMenuID = llGenerateKey(); + llMessageLinked(LINK_SET, DIALOG, (string)kID + "|" + sPrompt + "|" + (string)iPage + "|" + llDumpList2String(lChoices, "`") + "|" + llDumpList2String(lUtilityButtons, "`") + "|" + (string)iAuth, kMenuID); + + integer iIndex = llListFindList(g_lMenuIDs, [kID]); + if (~iIndex) g_lMenuIDs = llListReplaceList(g_lMenuIDs, [kID, kMenuID, sName], iIndex, iIndex + g_iMenuStride - 1); + else g_lMenuIDs += [kID, kMenuID, sName]; +} + +Menu(key kID, integer iAuth) { + string sPrompt = "\n["+g_sSubMenu+"]\n\nOutput Type:"+outType+"\nOutput Channel:"+outChan; + if( b_lCheckBoxes != [] ) { + b_sActive = llList2String(b_lCheckBoxes,g_iDebug)+d_sActive; + } else { + b_sActive = llList2String(g_lCheckBoxes,g_iDebug)+d_sActive; + } + list lButtons = [b_sActive,"Error","Warn","Info","Public","Private"]; + Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Main"); +} + +UserCommand(integer iNum, string sStr, key kID) { + if (iNumCMD_WEARER) { + return; + } + if (llSubStringIndex(llToLower(sStr),llToLower(g_sSubMenu)) && llToLower(sStr) != "menu "+llToLower(g_sSubMenu)) { + return; + } + if (llToLower(sStr)==llToLower(g_sSubMenu) || llToLower(sStr) == "menu "+llToLower(g_sSubMenu)){ + Menu(kID, iNum); + } else { + } +} + +key g_kWearer; +list g_lMenuIDs; +integer g_iMenuStride; +integer g_iDebug=TRUE; +integer g_iOutputType = 0; +integer g_iOutputForm = 1; +integer g_iTypeInfo = 0; +integer g_iTypeWarn = 1; +integer g_iTypeError = 2; +integer g_iFormPublic = 0; +integer g_iFormPrivate = 1; + +integer ALIVE = -55; +integer READY = -56; +integer STARTUP = -57; + +integer first_run = TRUE; + +debug(string msg,integer oType){ + if(oType == g_iFormPublic){ + llSay(DEBUG_CHANNEL,msg); + } else if(oType == g_iFormPrivate){ + llOwnerSay(msg); + } +} + +default +{ + on_rez(integer iNum) { + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); + } + state_entry() { + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); + } + link_message(integer iSender, integer iNum, string sStr, key kID) { + if(iNum == REBOOT) { + if(sStr == "reboot") { + llResetScript(); + } + } else if(iNum == READY) { + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(), ""); + } else if(iNum == STARTUP) { + state active; + } + } +} +state active { + on_rez(integer t) { + if(llGetOwner()!=g_kWearer) { + //llResetScript(); + state default; + } + } + state_entry() { + if( first_run ){ + debug("Info: from "+g_sSubMenu+" this script is running for the first time since restart we need to create persitence setting for status!",g_iOutputForm); + first_run = FALSE; + llMessageLinked(LINK_SET, LM_SETTING_SAVE,"global_debugger="+(string)g_iDebug,""); + } + llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "global",""); + g_kWearer = llGetOwner(); + } + link_message(integer iSender,integer iNum,string sStr,key kID) { + if(iNum >= CMD_OWNER && iNum <= CMD_WEARER) { + UserCommand(iNum, sStr, kID); + } else if(iNum == MENUNAME_REQUEST && sStr == g_sParentMenu) { + llMessageLinked(iSender, MENUNAME_RESPONSE, g_sParentMenu+"|"+ g_sSubMenu,""); + } else if(iNum == DIALOG_RESPONSE) { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + if(iMenuIndex!=-1) { + string sMenu = llList2String(g_lMenuIDs, iMenuIndex+1); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex-1, iMenuIndex-2+g_iMenuStride); + list lMenuParams = llParseString2List(sStr, ["|"],[]); + key kAv = llList2Key(lMenuParams,0); + string sMsg = llList2String(lMenuParams,1); + integer iAuth = llList2Integer(lMenuParams,3); + + if(sMenu == "Menu~Main") { + if(sMsg == UPMENU){ + llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); + } else if(sMsg == b_sActive){ + if(g_iDebug) { + g_iDebug = FALSE; + } else { + g_iDebug = TRUE; + } + llMessageLinked(LINK_SET, LM_SETTING_SAVE,"global_debugger="+(string)g_iDebug,""); + Menu(kAv, iAuth); + } else if(sMsg == "Error") { + outType = "Error"; + g_iOutputType = g_iTypeError; + Menu(kAv, iAuth); + } else if(sMsg == "Warn") { + outType = "Warning"; + g_iOutputType = g_iTypeWarn; + Menu(kAv, iAuth); + } else if(sMsg == "Info") { + outType = "Info"; + g_iOutputType = g_iTypeInfo; + Menu(kAv, iAuth); + } else if(sMsg == "Public") { + outChan = "DEBUG_CHANNEL"; + g_iOutputForm = g_iFormPublic; + Menu(kAv, iAuth); + } else if(sMsg == "Private") { + outChan = "OwnerSay"; + g_iOutputForm = g_iFormPrivate; + Menu(kAv, iAuth); + } + } + } + } else if (iNum == DIALOG_TIMEOUT) { + integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); + g_lMenuIDs = llDeleteSubList(g_lMenuIDs, iMenuIndex - 1, iMenuIndex +3); //remove stride from g_lMenuIDs + }else if(iNum == DEBUG){ + /* + input format from other scripts is as follows + Types: ERR,WRN,INFO + (type):(message) + message can be any thing preferably descriptive of the issue. + */ + list lSettings = llParseString2List(sStr, [":"],[]); + string sToken = llList2String(lSettings,0); + string sVal = llList2String(lSettings,1); + if(sToken=="ERR"){ + if(g_iDebug && g_iOutputType >= g_iTypeError) { + debug("Error:"+sVal,g_iOutputForm); + } + debug("Error:"+sVal,2); + } else if(sToken == "WRN" && g_iDebug && g_iOutputType >= g_iTypeWarn){ + debug("Warning:"+sVal,g_iOutputForm); + } else if(sToken == "INFO" && g_iDebug && g_iOutputType >= g_iTypeInfo){ + debug("Info:"+sVal,g_iOutputForm); + } + } else if (iNum == LM_SETTING_RESPONSE) { + list lPar = llParseString2List(sStr, ["_","="], []); + string sToken = llList2String(lPar, 0); + string sVar = llList2String(lPar, 1); + string sVal = llList2String(lPar, 2); + if( sToken == "global") { + if( sVar == "checkboxes") { + debug("Info: from "+g_sSubMenu+" Recived the checkboxes "+sVal,g_iOutputForm); + b_lCheckBoxes = llParseString2List(sVal,[","],[]); + } + if( sVar == "debugger"){ + debug("Info: from "+g_sSubMenu+" Updating debugger status!",g_iOutputForm); + g_iDebug = (integer)sVal; + } + } + } else if (iNum == LM_SETTING_DELETE) { + // This is recieved back from settings when a setting is deleted + list lPar = llParseString2List(sStr, ["_","="], []); + string sToken = llList2String(lPar, 0); + string sVar = llList2String(lPar, 1); + if(sToken == "global"){ + if(sVar == "debugger"){ + debug("Warn: from debugger Debugger status has been deleted from settings this could cause issues, attempting to reassert!",g_iOutputForm); + llMessageLinked(LINK_SET, LM_SETTING_SAVE,"global_debugger="+(string)g_iDebug,""); + } + } + } + } +} From b122b25ef62fa7082730f836660f408c8ba5e28e Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 3 Aug 2022 18:48:44 +0000 Subject: [PATCH 73/97] Rename oc_debugger to oc_debugger.lsl added.lsl --- src/spares/{oc_debugger => oc_debugger.lsl} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/spares/{oc_debugger => oc_debugger.lsl} (100%) diff --git a/src/spares/oc_debugger b/src/spares/oc_debugger.lsl similarity index 100% rename from src/spares/oc_debugger rename to src/spares/oc_debugger.lsl From 9e4f6f6b4fdf2df664b3a4a4c44bb0495d402629 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sat, 20 Aug 2022 08:19:12 +0100 Subject: [PATCH 74/97] Update oc_api.lsl Fixes for #774 , #847, #843 , #849 --- src/collar/oc_api.lsl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index 471972ccc..fd92acbd4 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -14,7 +14,10 @@ Medea (Medea Destiny) - Issue #579 Restored menuto function to interface channel for backwards compatibility - Issue #579 Added control of channel 0 listening via settings menu - Fix issue 585 give wearer accept/deny dialog to confirm runaway disable setting - + *Aug 2022 - Issue #843 & #774 fixes to check g_kOwner rather than CMD_WEARER. This fixes runaway + menu for wearers set as trusted (fix typo in menu too). Also wearer adding to trusted/ + blacklist when permitted when also trusted (issue #849) + - Fixed instance where interface channel is 0, also streamlined function, fix issue #819 Yosty7b3 *Oct 2021 - Remove unused StrideOfList() function. @@ -191,15 +194,15 @@ DoListeners(){ integer g_iRunaway=TRUE; key g_kDenyRunawayRequester; RunawayMenu(key kID, integer iAuth){ - if(iAuth == CMD_OWNER || iAuth==CMD_WEARER){ + if(iAuth == CMD_OWNER || kID == g_kWearer){ string sPrompt = "\n[Runaway]\n\nAre you sure you want to runaway from all owners?\n\n* This action will reset your owners list, trusted list, and your blocked avatars list."; list lButtons = ["Yes", "No"]; if(iAuth == CMD_OWNER){ - sPrompt+="\n\nAs the owner you have the abliity to disable or enable runaway."; + sPrompt+="\n\nAs the owner you have the ability to disable or enable runaway."; if(g_iRunaway)lButtons+=["Disable"]; else lButtons += ["Enable"]; - } else if(iAuth == CMD_WEARER){ + } else if(kID == g_kWearer){ if(g_iRunaway){ sPrompt += "\n\nAs the wearer, you can choose to disable your ability to runaway, this action cannot be reversed by you"; lButtons += ["Disable"]; @@ -329,7 +332,7 @@ UserCommand(integer iAuth, string sCmd, key kID){ RunawayMenu(kID,iAuth); } - if(iAuth == CMD_OWNER || (iAuth==CMD_WEARER && g_iAllowWearerSetTrusted==TRUE) ){ + if(iAuth == CMD_OWNER || (kID==g_kWearer && g_iAllowWearerSetTrusted==TRUE) ){ list lCmd = llParseString2List(sCmd, [" "],[]); string sCmdx = llToLower(llList2String(lCmd,0)); @@ -456,10 +459,8 @@ state active g_kWearer = llGetOwner(); g_sPrefix = llToLower(llGetSubString(llKey2Name(llGetOwner()),0,1)); // make the API Channel be per user - while(g_iInterfaceChannel==0){ - g_iInterfaceChannel = (integer)("0x" + llGetSubString(g_kWearer,30,-1)); - if (g_iInterfaceChannel > 0) g_iInterfaceChannel = -g_iInterfaceChannel; - } + if (g_iInterfaceChannel==0) g_iInterfaceChannel = -llAbs((integer)("0x" + llGetSubString(g_kWearer,30,-1))); + if (g_iInterfaceChannel==0) g_iInterfaceChannel = -9876; //I mean it COULD happen. should have an offset value here, but it's too late now so just assigning a random chan. llListen(g_iInterfaceChannel, "","",""); llSleep(0.5); llRegionSayTo(g_kWearer, g_iInterfaceChannel, "OpenCollar=Yes"); @@ -737,7 +738,7 @@ state active return; } else if(sMsg == "Yes"){ // trigger runaway - if((iAuth == CMD_WEARER || iAuth == CMD_OWNER ) && g_iRunaway){ + if((kAv == g_kWearer || iAuth == CMD_OWNER ) && g_iRunaway){ g_iRunawayMode=2; llMessageLinked(LINK_SET, NOTIFY_OWNERS, "%WEARERNAME% has runaway.", ""); llMessageLinked(LINK_SET, CMD_OWNER, "runaway", g_kWearer); From 7d248196d5eb2c302953ac3fa33ae5ba6d6093db Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sat, 20 Aug 2022 08:24:42 +0100 Subject: [PATCH 75/97] Update oc_rlvsys.lsl Fix for issue #842 --- src/collar/oc_rlvsys.lsl | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index f9c8428fb..fbee244eb 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -4,13 +4,15 @@ Copyright (c) 2008 - 2016 Satomi Ahn, Nandana Singh, Wendy Starfall, Medea Destiny, littlemousy, Romka Swallowtail, Garvin Twine, Sumi Perl et al. Licensed under the GPLv2. See LICENSE for full details. - Medea Destiny - - Sept 20201 - Added RLV_CMD_OVERRIDE function. This allows one shot (=force) commands to be sent that will override any restrictions. - This command should only be used where operator has owner permission. The notion behind it is that owners should - not be restricted by wearer restictions. They can unset restrictions manually, perform the function, and then reset - the restriction, but that's a lot of hassle. This performs the function automatically. Operator and wearer are notified of - restrictions that have been temporarily restricted to avoid being misled that a restriciton is not present. + Sept 2021 - Added RLV_CMD_OVERRIDE function. This allows one shot (=force) commands to be sent that will override any + restrictions. This command should only be used where operator has owner permission. The notion behind it + is that owners should not be restricted by wearer restictions. They can unset restrictions manually, + perform the function, and then reset the restriction, but that's a lot of hassle. This performs the + function automatically. Operator and wearer are notified of restrictions that have been temporarily + restricted to avoid being misled that a restriciton is not present. + Aug 2022 - Ensure applyrem() restores a detach=n when the collar is locked, otherwise new methodology with relay would cause a + locked collar to unlock when there are no more relay sources. Fix for issue #842 Kristen Mynx - May 2022 - Removed DO_RLV_REFRESH and recheck_lock timer. Both of these were only used by the relay, which is being changed at the same time. Check the comments in oc_relay. @@ -276,6 +278,7 @@ ApplyRem(string sBehav) { //also check the exceptions list, in case its an exception g_lBaked=llDeleteSubList(g_lBaked,iRestr,iRestr); //delete it from the baked list llOwnerSay("@"+sBehav+"=y"); //remove restriction + if(sBehav=="detach" && g_iCollarLocked == TRUE) llOwnerSay("@detach=n"); //ensure we're not unlocking a locked collar } } @@ -393,7 +396,7 @@ state active g_lBaked=[]; //just been rezzed, so should have no baked restrictions */ // Begin to detect RLV - llOwnerSay("@clear"); + //llOwnerSay("@clear"); //not needed, & we're about to reset and issue the command in state entry anyway. //setRlvState(); llResetScript(); } @@ -499,6 +502,7 @@ state active } else if(iNum == LM_SETTING_DELETE){ + if(sStr=="global_locked") g_iCollarLocked=0; //integer ind = llListFindList(g_lSettingsReqs, [sStr]); //if(ind!=-1)g_lSettingsReqs = llDeleteSubList(g_lSettingsReqs, ind,ind); @@ -516,6 +520,7 @@ state active if (sToken+"_"+sVar == "auth_owner") g_lOwners = llParseString2List(sValue, [","], []); else if(sToken == "global"){ if(sVar == "locked") g_iCollarLocked=(integer)sValue; + else if (sVar=="handshakes") g_iMaxViewerChecks=(integer)sValue; } else if (sToken=="rlvsys"){ From 6718e8cd95b98ba7902ce124402378e1671baae0 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sat, 20 Aug 2022 08:26:46 +0100 Subject: [PATCH 76/97] Update oc_rlvextension.lsl Fix for issues #844 & #848 --- src/collar/oc_rlvextension.lsl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/collar/oc_rlvextension.lsl b/src/collar/oc_rlvextension.lsl index 2680e5a08..976d75d7a 100644 --- a/src/collar/oc_rlvextension.lsl +++ b/src/collar/oc_rlvextension.lsl @@ -3,7 +3,6 @@ This file is part of OpenCollar. Copyright (c) 2018 - 2019 Tashia Redrose, Silkie Sabra, lillith xue, Medea Destiny, Nirea Mercury et al. Licensed under the GPLv2. See LICENSE for full details. - Medea Destiny - Sept 2021 - Moved Exceptions menu into RLV as a main directory, and folded Menu Settings into RLVSuite menu customize @@ -43,14 +42,13 @@ Medea Destiny - - Renamed Refuse TP to Force TP to reflect what the button actually does. Dec2021 - Fixed filtering of unsit - > sit unsit for chat command and remote (issue #703 ) - Fix to disengaging strict sit when disabled via menu when already sitting. - Feb2021 - SetAllExes triggered on RLV_REFRESH / RLV_ON was saving values, causing exception + Feb2022 - SetAllExes triggered on RLV_REFRESH / RLV_ON was saving values, causing exception settings to be restored to defaults if trigged before settings are received. (fixes #740, #720, #719) - + Aug2022 - Fix auth filtering for changing exceptions. Issue #844 & #848 Krysten Minx - May2022 - Added check for valid UUID when setting custom exception - */ string g_sParentMenu = "RLV"; string g_sSubMenu1 = "Force Sit"; @@ -563,6 +561,12 @@ state active if(sMenu == "Exceptions~Main"){ if(sMsg == UPMENU) llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); + else if (iAuth!=CMD_OWNER) + { + llMessageLinked(LINK_SET,NOTIFY,"0No access to changing exceptions!", kAv); + llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); + return; + } else if(sMsg == "Custom")MenuCustomExceptionsSelect(kAv,iAuth); else MenuSetExceptions(kAv,iAuth,sMsg); } else if(sMenu == "Exceptions~Custom"){ From d3879aa73fdfc3a80d1b0de9f09418441318efe1 Mon Sep 17 00:00:00 2001 From: Autumn Sprout Date: Sun, 21 Aug 2022 11:38:04 -0400 Subject: [PATCH 77/97] Update oc_unwelder.lsl Edited for more specific, descriptive language in the local chat instructions. --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index 3d2ca802f..12bc0d2ac 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -239,7 +239,7 @@ default if(sStr == "settings=sent"){ if(g_iAddonLimitation){ - llSay(0, "Addons Limited is checked. To unweld, a collar owner (including unowned wearer) must go to the collar Settings menu and find the AddOn Settings button. Uncheck AddOns Limited and then proceed to unweld."); + llSay(0, "Addons Limited is checked. To unweld, someone with Owner rights (including wearer if they are Owner) must: 1) Open the collar menu. 2)Click the Settings button -- not the Addons button. 3) Click the Addons button. Deselect (uncheck) AddOns Limited and then proceed to unweld. NOTE: The unwelder is an AddOn. WearerAdd and Addons must both be checked and only AddOns Limit should be unchecked for the Unwelder to connect."); Link("offline", 0, "", g_kUser); llSleep(2); llResetScript(); From af1b473ab03b77e9bd465b031843be4eb02978d7 Mon Sep 17 00:00:00 2001 From: Silkie Sabra Date: Sun, 21 Aug 2022 12:20:58 -0400 Subject: [PATCH 78/97] Update oc_unwelder_hud.lsl Rewrote the text instructions for proceeding with an unweld. --- src/spares/oc_unwelder_hud.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spares/oc_unwelder_hud.lsl b/src/spares/oc_unwelder_hud.lsl index 57e0c0810..91ffbf1e6 100644 --- a/src/spares/oc_unwelder_hud.lsl +++ b/src/spares/oc_unwelder_hud.lsl @@ -228,12 +228,12 @@ default if(sStr == "settings=sent"){ if(g_iAddonLimitation){ - llOwnerSay("Error: Addon limitations are in place. Unweld tool cannot continue. To disable the addon limitation, please see the setitngs menu of your collar, inside the Addon.. submenu you will find the Limiter which must be disabled."); + llOwnerSay("Addons Limited is checked. To unweld, someone with Owner access (including wearer if they are Owner) must: 1) Open the collar menu. 2)Click Settings. 3) Click the Addons button in Settings. UNCHECK AddOns Limited. Leave WearerAdd and Addons CHECKED. The Wearer can then proceed to unweld."); Link("offline", 0, "", g_kUser); llSleep(2); llResetScript(); } else { - llOwnerSay("Checking for a existing collar weld"); + llOwnerSay("Checking for an existing collar weld"); if(g_iWelded){ llOwnerSay("Unweld tool now ready."); llOwnerSay("Building consent prompt"); From af24495438e78f5df80f739558f09aaded746cb9 Mon Sep 17 00:00:00 2001 From: Silkie Sabra Date: Sun, 21 Aug 2022 12:41:06 -0400 Subject: [PATCH 79/97] Update oc_unwelder.lsl --- src/spares/oc_unwelder.lsl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index 12bc0d2ac..abc38abc9 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -4,6 +4,8 @@ Copyright ©2021 : Contributors : Aria (Tashia Redrose) * Feb 2021 - Created oc_unwelder +Autumn Jersey (autumnerilyx.littlepaws) + * Aug 2022 - Edited wording of local chat messages to improve user comprehension et al. From bd771708a4709c67c980a48c2a93a0906fbff012 Mon Sep 17 00:00:00 2001 From: Silkie Sabra Date: Sun, 21 Aug 2022 17:21:49 -0400 Subject: [PATCH 80/97] Update oc_unwelder.lsl --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index abc38abc9..cf4c95b67 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -241,7 +241,7 @@ default if(sStr == "settings=sent"){ if(g_iAddonLimitation){ - llSay(0, "Addons Limited is checked. To unweld, someone with Owner rights (including wearer if they are Owner) must: 1) Open the collar menu. 2)Click the Settings button -- not the Addons button. 3) Click the Addons button. Deselect (uncheck) AddOns Limited and then proceed to unweld. NOTE: The unwelder is an AddOn. WearerAdd and Addons must both be checked and only AddOns Limit should be unchecked for the Unwelder to connect."); + llSay(0, "Addons Limited is checked. To unweld, someone with Owner access (including wearer if they are Owner) must: 1) Open the collar menu. 2)Click Settings. 3) Click the Addons button in Settings. UNCHECK AddOns Limited. Leave WearerAdd and Addons CHECKED. The Wearer can then proceed to unweld."); Link("offline", 0, "", g_kUser); llSleep(2); llResetScript(); From 59d16824001e7583d2822468228fbce25530736d Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Mon, 22 Aug 2022 01:26:44 +0100 Subject: [PATCH 81/97] Update oc_rlvsys.lsl --- src/collar/oc_rlvsys.lsl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index fbee244eb..248bce7b4 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -190,10 +190,13 @@ setRlvState(){ } else if (g_iRlvActive) { //Both were true, but not now. g_iViewerCheck must still be TRUE (as it was once true), so g_iRLVOn must have just been set FALSE //Debug("RLV went inactive"); g_iRlvActive=FALSE; + integer relockcheck; while (llGetListLength(g_lBaked)){ + if(llList2String(g_lBaked,-1)=="detach") relockcheck=TRUE; llOwnerSay("@"+llList2String(g_lBaked,-1)+"=y"); //remove restriction g_lBaked=llDeleteSubList(g_lBaked,-1,-1); } + if(relockcheck==TRUE && g_iCollarLocked==TRUE) llOwnerSay("@detach=n"); llMessageLinked(LINK_SET, RLV_OFF, "", NULL_KEY); } else if (g_iRLVOn){ //g_iViewerCheck must be FALSE (see above 2 cases), so g_iRLVOn must have just been set to TRUE, so do viewer check if (g_iListener) llListenRemove(g_iListener); From 42ef4b83d165d868db1b2641b7621c955913a82c Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Mon, 22 Aug 2022 01:28:59 +0100 Subject: [PATCH 82/97] Update oc_rlvsys.lsl --- src/collar/oc_rlvsys.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collar/oc_rlvsys.lsl b/src/collar/oc_rlvsys.lsl index 248bce7b4..56b934310 100644 --- a/src/collar/oc_rlvsys.lsl +++ b/src/collar/oc_rlvsys.lsl @@ -191,8 +191,8 @@ setRlvState(){ //Debug("RLV went inactive"); g_iRlvActive=FALSE; integer relockcheck; + if(llListFindList(g_lBaked,["detach"])!=-1) relockcheck=TRUE; while (llGetListLength(g_lBaked)){ - if(llList2String(g_lBaked,-1)=="detach") relockcheck=TRUE; llOwnerSay("@"+llList2String(g_lBaked,-1)+"=y"); //remove restriction g_lBaked=llDeleteSubList(g_lBaked,-1,-1); } From d00acf389680f767ad1400919c18d5913475e8b2 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Mon, 22 Aug 2022 18:57:19 +0000 Subject: [PATCH 83/97] make core folder only acessable to listed #855 this simple change would prevent any one not on trusted or owners list from accessing core folder and changing a persons avatar or folder locks. --- src/Apps/oc_outfits.lsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index e445e2530..4d77743b9 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -150,6 +150,10 @@ FolderBrowser (key kID, integer iAuth){ } CoreBrowser(key kID, integer iAuth){ + if(iAuth <= CMD_OWNER && iAuth >= CMD_WEARER) { + llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); + return; + } g_sPath = GetOutfitSystem(TRUE); g_kListenTo = kID; g_iListenToAuth = iAuth; From d68a66c8d2ea1377834a30ce9144887d0ca8f0c1 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 24 Aug 2022 01:04:41 +0100 Subject: [PATCH 84/97] Update oc_unwelder.lsl Fix for #859 --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index cf4c95b67..a6c839704 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -291,7 +291,7 @@ default } else if (sMsg == "UNWELD NOW") { - if(iAuth == CMD_OWNER || iAuth == CMD_WEARER){ + if(iAuth == CMD_OWNER || g_kUser == llGetOwnerKey(id){ Link("from_addon", NOTIFY_OWNERS, "The unweld tool was used.", ""); llSay(0, "Consent : Valid"); Link("from_addon", LM_SETTING_DELETE, "intern_weld","origin"); From 327b3d6cc56b5e89c585db3fbb1a5b9c7c4949b9 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 24 Aug 2022 01:06:33 +0100 Subject: [PATCH 85/97] Update oc_unwelder_hud.lsl --- src/spares/oc_unwelder_hud.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder_hud.lsl b/src/spares/oc_unwelder_hud.lsl index 91ffbf1e6..4547adebe 100644 --- a/src/spares/oc_unwelder_hud.lsl +++ b/src/spares/oc_unwelder_hud.lsl @@ -278,7 +278,7 @@ default } else if (sMsg == "UNWELD NOW") { - if(iAuth == CMD_OWNER || iAuth == CMD_WEARER){ + if(iAuth == CMD_OWNER || llGetOwnerKey(id)==llGetOwner()){ Link("from_addon", NOTIFY_OWNERS, "The unweld tool was used.", ""); llOwnerSay("Consent : Valid"); Link("from_addon", LM_SETTING_DELETE, "intern_weld","origin"); From f8de2b5c92045d8e3fcb378aa708de68073943e7 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 24 Aug 2022 01:11:36 +0100 Subject: [PATCH 86/97] Update oc_unwelder.lsl --- src/spares/oc_unwelder.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index a6c839704..631ef19aa 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -291,7 +291,7 @@ default } else if (sMsg == "UNWELD NOW") { - if(iAuth == CMD_OWNER || g_kUser == llGetOwnerKey(id){ + if(iAuth == CMD_OWNER || g_kUser == llGetOwnerKey(id)){ Link("from_addon", NOTIFY_OWNERS, "The unweld tool was used.", ""); llSay(0, "Consent : Valid"); Link("from_addon", LM_SETTING_DELETE, "intern_weld","origin"); From 49b478375c0902012a279360f22d86b10831a9ca Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 24 Aug 2022 00:12:22 +0000 Subject: [PATCH 87/97] only owner and wearer make it so only owner and wearer can access the folder no body else --- src/Apps/oc_outfits.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 4d77743b9..104b6be36 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -150,7 +150,7 @@ FolderBrowser (key kID, integer iAuth){ } CoreBrowser(key kID, integer iAuth){ - if(iAuth <= CMD_OWNER && iAuth >= CMD_WEARER) { + if(iAuth != CMD_OWNER || iAuth != CMD_WEARER) { llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); return; } From e3c056d2472288f1dbec0422d9bb247dfc7b1a71 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 24 Aug 2022 01:14:21 +0100 Subject: [PATCH 88/97] Update oc_unwelder.lsl --- src/spares/oc_unwelder.lsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder.lsl b/src/spares/oc_unwelder.lsl index 631ef19aa..19b2a1fa3 100644 --- a/src/spares/oc_unwelder.lsl +++ b/src/spares/oc_unwelder.lsl @@ -6,7 +6,8 @@ Aria (Tashia Redrose) * Feb 2021 - Created oc_unwelder Autumn Jersey (autumnerilyx.littlepaws) * Aug 2022 - Edited wording of local chat messages to improve user comprehension - +Medea (Medea Destiny) + Aug 2022 - Fix for issue #862, allow wearer with trusted perm to operate et al. Licensed under the GPLv2. See LICENSE for full details. From 22092d28ac2d789bc3a5706661bb8dcb6e13f94d Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 24 Aug 2022 01:14:39 +0100 Subject: [PATCH 89/97] Update oc_unwelder_hud.lsl --- src/spares/oc_unwelder_hud.lsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/spares/oc_unwelder_hud.lsl b/src/spares/oc_unwelder_hud.lsl index 4547adebe..98a305646 100644 --- a/src/spares/oc_unwelder_hud.lsl +++ b/src/spares/oc_unwelder_hud.lsl @@ -4,7 +4,8 @@ Copyright ©2021 : Contributors : Aria (Tashia Redrose) * Feb 2021 - Created oc_unwelder_hud - +Medea (Medea Destiny) + Aug 2022 - Fix for issue #862, allow wearer with trusted perm to operate et al. Licensed under the GPLv2. See LICENSE for full details. From 68e7ff86bb42b27f3507dbe8630d5b5583a942a0 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Wed, 24 Aug 2022 00:15:39 +0000 Subject: [PATCH 90/97] Update oc_outfits.lsl --- src/Apps/oc_outfits.lsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 104b6be36..045b6db9e 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -150,7 +150,7 @@ FolderBrowser (key kID, integer iAuth){ } CoreBrowser(key kID, integer iAuth){ - if(iAuth != CMD_OWNER || iAuth != CMD_WEARER) { + if(iAuth != CMD_OWNER || kID != g_kWearer) { llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); return; } From a97b8bae2677a370f976d2796475d2674f7158a8 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Fri, 26 Aug 2022 17:16:48 +0000 Subject: [PATCH 91/97] i missed somthing media noticed it. thank you for spotting this medea --- src/Apps/oc_outfits.lsl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 045b6db9e..bb4d749aa 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -418,6 +418,10 @@ state active llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); } else if(sMsg == TickBox(g_iLockCore, "Lock Core")){ + if(iAuth != CMD_OWNER || kID != g_kWearer) { + llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); + return; + } g_iLockCore=1-g_iLockCore; llSetTimerEvent(120); Commit(); From 07679e96e7dc7e4d0b5397dfd121f5a8f9daf7a9 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sun, 28 Aug 2022 06:53:46 +0100 Subject: [PATCH 92/97] Update oc_api.lsl --- src/collar/oc_api.lsl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index fd92acbd4..9afabbbc2 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -17,7 +17,8 @@ Medea (Medea Destiny) *Aug 2022 - Issue #843 & #774 fixes to check g_kOwner rather than CMD_WEARER. This fixes runaway menu for wearers set as trusted (fix typo in menu too). Also wearer adding to trusted/ blacklist when permitted when also trusted (issue #849) - - Fixed instance where interface channel is 0, also streamlined function, fix issue #819 + - Fixed instance where interface channel is 0, also streamlined function, fix issue #819 + - Prefix reset now works, and notifications sent when changing prefix. Yosty7b3 *Oct 2021 - Remove unused StrideOfList() function. @@ -380,7 +381,10 @@ UserCommand(integer iAuth, string sCmd, key kID){ return; } g_sPrefix = llList2String(lCmd,1); + _sPrefix = llList2String(lCmd,1); + if(llToLower(g_sPrefix)=="reset") g_sPrefix = llToLower(llGetSubString(llKey2Name(llGetOwner()),0,1)); llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_prefix="+g_sPrefix,kID); + llMessageLinked(LINK_SET,NOTIFY,"1Prefix has been set to "+g_sPrefix+".",kID); } } } From 95a48d54983d64166043bbec4f408e6b460dbd54 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Sun, 28 Aug 2022 06:56:45 +0100 Subject: [PATCH 93/97] Update oc_api.lsl --- src/collar/oc_api.lsl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index 9afabbbc2..c88216f97 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -381,7 +381,6 @@ UserCommand(integer iAuth, string sCmd, key kID){ return; } g_sPrefix = llList2String(lCmd,1); - _sPrefix = llList2String(lCmd,1); if(llToLower(g_sPrefix)=="reset") g_sPrefix = llToLower(llGetSubString(llKey2Name(llGetOwner()),0,1)); llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_prefix="+g_sPrefix,kID); llMessageLinked(LINK_SET,NOTIFY,"1Prefix has been set to "+g_sPrefix+".",kID); From caa176f9a5a4e19e56b962fcf9c4f588e1f63930 Mon Sep 17 00:00:00 2001 From: tayaphidoux <83609871+tayaphidoux@users.noreply.github.com> Date: Sat, 3 Sep 2022 19:38:22 +0000 Subject: [PATCH 94/97] Update oc_outfits.lsl --- src/Apps/oc_outfits.lsl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index bb4d749aa..40cf72d06 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -150,7 +150,7 @@ FolderBrowser (key kID, integer iAuth){ } CoreBrowser(key kID, integer iAuth){ - if(iAuth != CMD_OWNER || kID != g_kWearer) { + if(iAuth != CMD_OWNER && kID != g_kWearer) { llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); return; } @@ -418,7 +418,7 @@ state active llMessageLinked(LINK_SET, iAuth, "menu "+g_sParentMenu, kAv); } else if(sMsg == TickBox(g_iLockCore, "Lock Core")){ - if(iAuth != CMD_OWNER || kID != g_kWearer) { + if(iAuth != CMD_OWNER && kID != g_kWearer) { llMessageLinked(LINK_SET,NOTIFY, "0%NOACCESS% to core", kID); return; } From ae85714b543c30ca4aed7c42373d6df5a760afc6 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Mon, 5 Sep 2022 20:49:06 +0100 Subject: [PATCH 95/97] Update oc_outfits.lsl --- src/Apps/oc_outfits.lsl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Apps/oc_outfits.lsl b/src/Apps/oc_outfits.lsl index 40cf72d06..c3b7bd845 100644 --- a/src/Apps/oc_outfits.lsl +++ b/src/Apps/oc_outfits.lsl @@ -15,7 +15,8 @@ Felkami (Caraway Ohmai) * Jan 2021 - #461, Made menu call case insensitive Lillith (Lillith Xue) * Dec 2019 - Fixed bug: Outfits not working for non-wearer as menu user due to listen typo - +Phidoux (Taya Maruti) + *Sept 2022 - Limited core lock/unlock to wearer and owner (issue #855) et al. From 03ac5553b4d7689ced05b7131cb882f651febc85 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 21 Sep 2022 01:16:47 +0100 Subject: [PATCH 96/97] Yosty fixes - remove Setor() and Bool() Removes SetOr() and Bool() functions from OC core to streamline code - saves about 2KB of script RAM. This PR replaces #702 to make merging easier, but is the same code. Full credit to @Yosty7b3 --- src/collar/oc_core.lsl | 42 ++++++++++++++---------------------------- 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/src/collar/oc_core.lsl b/src/collar/oc_core.lsl index 974892b83..ad1d70708 100644 --- a/src/collar/oc_core.lsl +++ b/src/collar/oc_core.lsl @@ -27,7 +27,7 @@ Medea (Medea Destiny) Removed g_lTestReports, left over from alpha. Nov 2021 - Auth check for hide didn't account for when wearer tries to use hide with AllowHiding ticked but access is not CMD_WEARER (i.e. wearer set to trusted). (see #774) - Jun 2021 - Fixes for #774 (extension to above, allowing for wearer set to trusted). Using + Jun 2022 - Fixes for #774 (extension to above, allowing for wearer set to trusted). Using kID == g_kWearer instead of iNum==CMD_WEARER in UserCommad() for: Safeword report, verbosity level, locking And kAv == g_kWearer instead of iAuth == CMD_WEARER in meu dialog responses for: @@ -36,7 +36,8 @@ Medea (Medea Destiny) Stormed Darkshade (StormedStormy) March 2022 - Added a button for reboot to help/about menu. - +Yosty7B3 + Nov 2022 - Removed Setor() and bool() functions for streamlining. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar */ @@ -45,7 +46,7 @@ integer NOTIFY_OWNERS=1003; //string g_sParentMenu = ""; string g_sSubMenu = "Main"; -string COLLAR_VERSION = "8.2.1000"; // Provide enough room +string COLLAR_VERSION = "8.2.2020"; // Provide enough room // LEGEND: Major.Minor.Build RC Beta Alpha integer UPDATE_AVAILABLE=FALSE; string NEW_VERSION = ""; @@ -177,18 +178,19 @@ AccessMenu(key kID, integer iAuth){ return; } string sPrompt = "\nOpenCollar Access Controls\n+/- buttons to control access lists.\nGroup allows access to current group, Public allows access to all. Wearer trust allows an owned wearer to add/remove from trusted list.\nRunaway removes all owners, access list prints out who has access."; - list lButtons = ["+ Owner", "+ Trust", "+ Block", "- Owner", "- Trust", "- Block", Checkbox(bool((g_kGroup!="")), "Group"), Checkbox(g_iPublic, "Public")]; + list lButtons = ["+ Owner", "+ Trust", "+ Block", "- Owner", "- Trust", "- Block", Checkbox(g_kGroup!="", "Group"), Checkbox(g_iPublic, "Public")]; lButtons += [Checkbox(g_iAllowWearerSetTrusted, "Wearer Trust"), "Runaway", "Access List"]; Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Auth"); } HelpMenu(key kID, integer iAuth){ - string EXTRA_VER_TXT = setor(bool((llGetSubString(COLLAR_VERSION,-1,-1)=="0")), "", " (ALPHA "+llGetSubString(COLLAR_VERSION,-1,-1)+") "); - EXTRA_VER_TXT += setor(bool((llGetSubString(COLLAR_VERSION,-2,-2)=="0")), "", " (BETA "+llGetSubString(COLLAR_VERSION,-2,-2)+") "); - EXTRA_VER_TXT += setor(bool((llGetSubString(COLLAR_VERSION,-3,-3) == "0")), "", " (RC "+llGetSubString(COLLAR_VERSION,-3,-3)+") "); + string EXTRA_VER_TXT; + if(llGetSubString(COLLAR_VERSION,-1,-1)!="0") EXTRA_VER_TXT = " (ALPHA "+llGetSubString(COLLAR_VERSION,-1,-1)+") "; + if(llGetSubString(COLLAR_VERSION,-2,-2)!="0") EXTRA_VER_TXT += " (BETA "+llGetSubString(COLLAR_VERSION,-2,-2)+") "; + if(llGetSubString(COLLAR_VERSION,-3,-3)!="0") EXTRA_VER_TXT += " (RC " + llGetSubString(COLLAR_VERSION,-3,-3)+") "; - string sPrompt = "\nOpenCollar "+COLLAR_VERSION+" "+EXTRA_VER_TXT+"\nVersion: "+setor(g_iAmNewer, "(Newer than release)", "")+" "+setor(UPDATE_AVAILABLE, "(Update Available)", "(Most Current Version)"); + string sPrompt = "\nOpenCollar "+COLLAR_VERSION+" "+EXTRA_VER_TXT+"\nVersion: "+llList2String(["","(Newer than release)"],g_iAmNewer)+" "+llList2String(["(Most Current Version)","(Update Available)"],UPDATE_AVAILABLE); sPrompt += "\n\nDocumentation https://opencollar.cc"; sPrompt += "\nPrefix: "+g_sPrefix+"\nChannel: "+(string)g_iChannel; sPrompt += "\nSafeword: "+g_sSafeword; @@ -201,13 +203,9 @@ HelpMenu(key kID, integer iAuth){ Dialog(kID, sPrompt, lButtons, [UPMENU], 0, iAuth, "Menu~Help"); } -integer bool(integer a){ - if(a)return TRUE; - else return FALSE; -} list g_lCheckboxes=["▢", "▣"]; string Checkbox(integer iValue, string sLabel) { - return llList2String(g_lCheckboxes, bool(iValue))+" "+sLabel; + return llList2String(g_lCheckboxes, (iValue>0))+" "+sLabel; } integer g_iUpdatePin = 0; //string g_sDeviceName; @@ -398,19 +396,6 @@ Compare(string V1, string V2){ key g_kUpdateCheck = NULL_KEY; key g_kCheckDev; -///The setor method is derived from a similar PHP proposed function, though it was denied, -///https://wiki.php.net/rfc/ifsetor -///The concept is roughly the same though we're not dealing with lists in this method, so is just modified -///The ifsetor proposal would give a function which would be more like -///ifsetor(list[index], sTrue, sFalse) -///LSL can't check if a list item is set without a stack heap if it is out of range, this is significantly easier for us to just check for a integer boolean -string setor(integer iTest, string sTrue, string sFalse){ - if(iTest)return sTrue; - else return sFalse; -} - - - integer g_iDoTriggerUpdate=FALSE; key g_kWelder = NULL_KEY; StartUpdate(){ @@ -560,7 +545,7 @@ state active } else if(sMsg == "Access List"){ if(iAuth == CMD_OWNER || kAv == g_kWearer ){ llMessageLinked(LINK_SET, iAuth, "print auth", kAv);} - } else if(sMsg == Checkbox(bool((g_kGroup!="")), "Group")){ + } else if(sMsg == Checkbox((g_kGroup!=""), "Group")){ if(iAuth ==CMD_OWNER){ if(g_kGroup!=""){ g_kGroup=""; @@ -632,7 +617,7 @@ state active } else if(sMsg == Checkbox(g_iHide,"Hide")){ if((kAv == g_kWearer && g_iAllowHide==TRUE)||iAuth==CMD_OWNER){ g_iHide=1-g_iHide; - llMessageLinked(LINK_SET, iAuth, setor(g_iHide, "hide", "show"), kAv); + llMessageLinked(LINK_SET, iAuth, llList2String(["show","hide"],g_iHide), kAv); llMessageLinked(LINK_SET, LM_SETTING_SAVE, "global_hide="+(string)g_iHide, ""); } else { @@ -959,3 +944,4 @@ state active } } } + From 6175159f0af6e87f0939d5c3da69d4db0167d936 Mon Sep 17 00:00:00 2001 From: Medea-Destiny <37522714+Medea-Destiny@users.noreply.github.com> Date: Wed, 21 Sep 2022 01:22:36 +0100 Subject: [PATCH 97/97] Update oc_api.lsl Changes to reset oc_api only when needed rather than every boot event. Part of speeding up boot process. This PR replaces #734, but is the same code. Full credit to @Yosty7B3 --- src/collar/oc_api.lsl | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/collar/oc_api.lsl b/src/collar/oc_api.lsl index c88216f97..5e07f34f6 100644 --- a/src/collar/oc_api.lsl +++ b/src/collar/oc_api.lsl @@ -21,7 +21,7 @@ Medea (Medea Destiny) - Prefix reset now works, and notifications sent when changing prefix. Yosty7b3 *Oct 2021 - Remove unused StrideOfList() function. - + *Feb 2022 - Only reset when needed (part of boot speedup project). et al. Licensed under the GPLv2. See LICENSE for full details. https://github.com/OpenCollarTeam/OpenCollar @@ -442,7 +442,7 @@ default link_message(integer iSender, integer iNum, string sStr, key kID){ if(iNum == REBOOT){ if(sStr == "reboot"){ - llResetScript(); + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); } } else if(iNum == READY){ llMessageLinked(LINK_SET, ALIVE, llGetScriptName(), ""); @@ -454,9 +454,11 @@ default state active { on_rez(integer iNum){ - llResetScript(); + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); + } + changed(integer change){ + if (change & CHANGED_OWNER) llResetScript(); } - state_entry(){ if(llGetStartParameter()!=0)llResetScript(); g_kWearer = llGetOwner(); @@ -664,10 +666,11 @@ state active } } else if(iNum == REBOOT){ if(sStr=="reboot"){ - llResetScript(); + llMessageLinked(LINK_SET, ALIVE, llGetScriptName(),""); } - } - else if(iNum == DIALOG_RESPONSE){ + } else if(iNum == STARTUP && sStr=="ALL"){ + llMessageLinked(LINK_SET, LM_SETTING_REQUEST, "ALL",""); + } else if(iNum == DIALOG_RESPONSE){ integer iMenuIndex = llListFindList(g_lMenuIDs, [kID]); if(iMenuIndex!=-1){ string sMenu = llList2String(g_lMenuIDs, iMenuIndex+1);