From a56a54b88da9e84de0be8035f260b57e3c0f7d36 Mon Sep 17 00:00:00 2001 From: zontreck Date: Sat, 22 Feb 2025 21:10:17 -0700 Subject: [PATCH] Adds another helper function --- functions.lsl | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/functions.lsl b/functions.lsl index 5c61704..1ec33c8 100644 --- a/functions.lsl +++ b/functions.lsl @@ -9,6 +9,10 @@ string DecipherService(string payload, string ident) return llJsonGetValue(payload, [ident,"protocol"]) + "://" + llJsonGetValue(payload,[ident,"host"]) + ":" + llJsonGetValue(payload,[ident,"port"]); } +ReadAPIServer(string payload) { + API_SERVER = DecipherService(payload, "api" ) + "/zni"; +} + initBasicSupport() { g_lSupport = [RED_QUEEN, R_ADMIN|R_DEVELOPER|R_SUPPORT, @@ -32,7 +36,12 @@ integer checkSupportUser(key kID, integer minAccessRights) checkSupport() { - UpdateDSRequest(NULL, llHTTPRequest(API_SERVER + "/zni/Get_Support.php", [], ""), SetDSMeta(["get_support"])); + UpdateDSRequest(NULL, llHTTPRequest(API_SERVER + "/Get_Support.php", [], ""), SetDSMeta(["get_support"])); +} + +parseSupport(string sValue) { + list lParse = llParseString2List(sValue, [";;", ";"], []); + g_lSupport = llParseString2List(llList2String(lParse,1), ["~"], []); } string MakeTimeNotation(integer iSec) @@ -401,3 +410,24 @@ integer mask(integer states, integer source, integer mask) return source; } } + + +string stripMetatags(string sInput) +{ + list lTmp = llParseString2List(sInput,[], ["<",">"]); + integer iIndex = llListFindList(lTmp,[">"]); + while(iIndex!=-1){ + lTmp = llDeleteSubList(lTmp, iIndex-2, iIndex); + iIndex=llListFindList(lTmp,[">"]); + } + return llDumpList2String(lTmp, ""); +} +integer timeAsSeconds(string sInput) +{ + // Converts a string like 02:00 into its seconds equivalent (ie. 120) + + list lTmp = llParseString2List(stripMetatags(sInput), [":"],[]); + integer iMin = (integer)llList2String(lTmp,0); + integer iSec = (integer)llList2String(lTmp,1); + return (iSec+(iMin*60)); +} \ No newline at end of file