Skip to content

Commit

Permalink
Fix to the "initialize" spam that caused extra delays
Browse files Browse the repository at this point in the history
"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.
  • Loading branch information
Yosty7B3 authored Nov 10, 2023
1 parent 8969b56 commit 244c51b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/collar/oc_states.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ state running
{
state_entry()
{
llResetTime();
llSetTimerEvent(5);
llMessageLinked(LINK_SET, TIMEOUT_READY, "","");

Expand All @@ -291,7 +292,7 @@ state running
}

on_rez(integer iRez){
llMessageLinked(LINK_SET, STARTUP, "ALL", "");
llResetTime();
}
changed(integer iChange){
if(iChange&CHANGED_INVENTORY){
Expand Down Expand Up @@ -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,"");
}
Expand Down

0 comments on commit 244c51b

Please sign in to comment.