Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 48 additions & 29 deletions src/collar/oc_relay.lsl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ Nikki Lacrima
*Oct 2025 - init() function for rez state, factory clean on CHANGE_OWNER
reducing memory use to handle large relay messages
only default state, remove RLV function (just a wrapper to linkmessage RLV_CMD)
*May 2026 - Add relay ping after teleport
*Jul 2026 - Display correct object owner in PromptForSource(key kID), removed global g_kObjectOwner.
Proposed solution by SheryBanana in world.

et al.

Expand Down Expand Up @@ -125,7 +128,6 @@ list g_lPendingReapply; // sourceId to wait for pong reply

key g_kForceSitSource; // LSD relay_sitter = UUID
key g_kSitTarget; // LSD relay_sittarget=UUID
key g_kObjectOwner;
key g_kWearer;
integer g_iHasOwners=FALSE;

Expand Down Expand Up @@ -447,15 +449,25 @@ CheckAskSource(){
if (llGetListLength(g_lPendingSourceList) == 0) return;
key kSource = llList2Key(g_lPendingSourceList,0);
if (g_iTrustOwners || g_iTrustTrusted) {
g_kObjectOwner = llList2Key(llGetObjectDetails(kSource, [OBJECT_OWNER]),0);
llMessageLinked(LINK_SET, AUTH_REQUEST, "relay", g_kObjectOwner);
key kOwner = llList2Key(llGetObjectDetails(kSource, [OBJECT_OWNER]),0);
llMessageLinked(LINK_SET, AUTH_REQUEST, "relay", kOwner);
} else {
PromptForSource(kSource);
}
}

PromptForSource(key kID){
Dialog(llGetOwner(), "[Relay]\n\nObject Name: "+llKey2Name(kID)+"\nObject ID: "+(string)kID+"\nObject Owner: secondlife:///app/agent/"+(string)g_kObjectOwner+"/about\n\nIs requesting to use your RLV Relay, do you want to allow it?", ["Yes", "No"], [], 0, CMD_WEARER, "AskPrompt");
PromptForSource(key kID)
{
key kOwner = llList2Key(llGetObjectDetails(kID, [OBJECT_OWNER]), 0);

Dialog(
llGetOwner(),
"[Relay]\n\nObject Name: " + llKey2Name(kID) +
"\nObject ID: " + (string)kID +
"\nObject Owner: secondlife:///app/agent/" + (string)kOwner + "/about" +
"\n\nIs requesting to use your RLV Relay, do you want to allow it?",
["Yes", "No"], [], 0, CMD_WEARER, "AskPrompt"
);
llSetTimerEvent(60);
}

Expand Down Expand Up @@ -495,6 +507,29 @@ CheckSitTarget() {
LSDWrite("sittarget", (string)g_kSitTarget);
}

DoRelayPing() {
// read list of previous sources to ping for reapply
g_lPendingReapply = [];
integer i;
list sources = llLinksetDataFindKeys(LSDPrefix+"_source_.*", 0, 20);
for (i=0; i< llGetListLength(sources); i++) {
list data = llParseString2List(llList2String(sources,i),["_"],[""]);
key kID = llList2Key(data, 2);
g_lPendingReapply += [kID];
}

if (g_iMode) {
for (i=0;i<llGetListLength(g_lPendingReapply);i++) {
// ping the sources
key kSource = llList2Key(g_lPendingReapply,i);
llRegionSayTo(kSource, RLV_RELAY_CHANNEL,"ping,"+(string)kSource+",ping,ping");
// llOwnerSay("oc_relay:ping,"+(string)kSource+",ping,ping");
}
}
// pong timer
llSetTimerEvent(30);
}

// Starup code, called instead of reset on rez
// Normal behavor on rez is to simply call init()
// pending sources are cleared, allowed and disallowed lists are kept
Expand Down Expand Up @@ -575,7 +610,8 @@ default
if (llGetListLength(g_lPendingReapply)>0) {
integer i = 0;
for (i=0; i<llGetListLength(g_lPendingReapply); i++) {
// llOwnerSay("no pong: "+LSDRead("source_"+llList2String(g_lPendingReapply,i)));
// llOwnerSay("no pong: "+LSDRead("source_"+llList2String(g_lPendingReapply,i)));
llMessageLinked(LINK_THIS, RLV_CMD, "clear",(key)llList2String(g_lPendingReapply,i));
LSDWrite("source_"+llList2String(g_lPendingReapply,i),"");
}
g_lPendingReapply = [];
Expand Down Expand Up @@ -708,29 +744,8 @@ default
}
} else if (iNum == RLV_ON) {
if (g_iRlvActive) return; // RLV already set as active, not much to do

// read list of previous sources to ping for reapply
g_lPendingReapply = [];
integer i;
list sources = llLinksetDataFindKeys(LSDPrefix+"_source_.*", 0, 20);
for (i=0; i< llGetListLength(sources); i++) {
list data = llParseString2List(llList2String(sources,i),["_"],[""]);
key kID = llList2Key(data, 2);
g_lPendingReapply += [kID];
}
// start listener for !pong
// llOwnerSay("oc_relay:RLV ON start listener for ping/pong, mode is "+(string)g_iMode);
if (g_iMode) {
RELAY_LISTENER = llListen(RLV_RELAY_CHANNEL, "", NULL_KEY, "");
for (i=0;i<llGetListLength(g_lPendingReapply);i++) {
// ping the sources
key kSource = llList2Key(g_lPendingReapply,i);
llRegionSayTo(kSource, RLV_RELAY_CHANNEL,"ping,"+(string)kSource+",ping,ping");
// llOwnerSay("oc_relay:RLV ON ping,"+(string)kSource+",ping,ping");
}
// pong timer
llSetTimerEvent(30);
}
if (g_iMode) RELAY_LISTENER = llListen(RLV_RELAY_CHANNEL, "", NULL_KEY, "");
DoRelayPing();
g_iRlvActive = 1;
} else if (iNum == RLV_OFF) {
ReleaseAll(FALSE);
Expand Down Expand Up @@ -887,6 +902,10 @@ default
llLinksetDataDeleteFound("^relay_","");
llResetScript();
}
if(change & CHANGED_TELEPORT)
{
DoRelayPing();
}
}

}