From 244c51b1685a4759326c52803b2ae7824eaaaedd Mon Sep 17 00:00:00 2001 From: Yosty7B3 <67095583+Yosty7B3@users.noreply.github.com> Date: Fri, 10 Nov 2023 23:02:09 +0100 Subject: [PATCH] Fix to the "initialize" spam that caused extra delays "initialize" was being spammed on every script that sent an ALIVE signal, and "STARTUP ALL" was being send before oc_api was even alive. Changed it so that STARTUP and initialize are only send once. --- src/collar/oc_states.lsl | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/collar/oc_states.lsl b/src/collar/oc_states.lsl index 40483d885..bd7b93ad3 100644 --- a/src/collar/oc_states.lsl +++ b/src/collar/oc_states.lsl @@ -283,6 +283,7 @@ state running { state_entry() { + llResetTime(); llSetTimerEvent(5); llMessageLinked(LINK_SET, TIMEOUT_READY, "",""); @@ -291,7 +292,7 @@ state running } on_rez(integer iRez){ - llMessageLinked(LINK_SET, STARTUP, "ALL", ""); + llResetTime(); } changed(integer iChange){ if(iChange&CHANGED_INVENTORY){ @@ -474,9 +475,15 @@ state running }else if(iNum == -99999){ if(sStr == "update_active")state inUpdate; } else if(iNum == ALIVE){ - llMessageLinked(LINK_SET, STARTUP, sStr, ""); - llSleep(1); - llMessageLinked(LINK_SET, 0, "initialize", llGetKey()); + if(sStr == "oc_api" || llGetTime() > 5){ + llMessageLinked(LINK_SET, STARTUP, "ALL", ""); + + if (llGetTime() > 5){ // prevent initialize spam + llSleep(1); + llMessageLinked(LINK_SET, 0, "initialize", llGetKey()); + } + llResetTime(); + } } else if(iNum == MENUNAME_REQUEST && sStr == "Settings") { llMessageLinked(iSender, MENUNAME_RESPONSE, "Settings|"+g_sSubmenu,""); }