Author Topic: Processing onRelay.  (Read 526 times)

I'm trying to make a script that processes the input event onRelay on any bricks within a radius, I'm using a containerRadiusSearch to do this, and it doesn't seem to work. It only activates on the brick that the search is started at.

I tried processing a single brick in the console, and no matter what I did, it'd just process it on the brick that did the radius search, even when it wasn't included.

Code: [Select]
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs"))
{
if(!$RTB::RTBR_ServerControl_Hook)
exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("Max. Radius","radiusRelay","$Pref::RadiusRelay::MaxRadius","int 1 100","Event_RadiusRelay", 32, 1, 1);
RTB_registerPref("Admin Only","radiusRelay","$Pref::RadiusRelay::AdminOnly","bool","Event_RadiusRelay", 0, 0, 1);
}

registerOutputEvent("fxDTSBrick", "radiusRelay", "int 0 "@$Pref::RadiusRelay::MaxRadius@" 0", 1);


function fxDTSBrick::radiusRelay(%brick, %radius, %client)
{
if(%radius > $Pref::RadiusRelay::MaxRadius)
%radius = $Pref::RadiusRelay::MaxRadius;
if(%radius <= 0)
return;
if($Pref::RadiusRelay::AdminOnly && (!%client.isAdmin && !%client.isSuperAdmin))
return;
%pos = %brick.position;
initContainerRadiusSearch(%pos, %radius, $TypeMasks::FxBrickObjectType);
for(%i = containerSearchNext(); %i != 0; %i = containerSearchNext())
{
if(%i != %brick)
%i.processInputEvent("OnRelay", %i);
}
}

Is that the valid arguments for process event?

You are saying %brick.processEvent(something, %brick)? Why are you putting brick in there again.
I could be wrong as I'm not at home to verify :/

%brick.processInputEvent("onRelay",%client);

%brick.processInputEvent("onRelay",%client);
Well, that makes sense, doesn't it!

Thanks.

It still only seems to affect the brick that activated it when doing the event, and if i processing onRelay from a brick that was in the radius.

If I try from one outside the radius, it seems to choose two random bricks other than the one that activated it and activate those.

It still only seems to affect the brick that activated it when doing the event, and if i processing onRelay from a brick that was in the radius.

If I try from one outside the radius, it seems to choose two random bricks other than the one that activated it and activate those.

Well, something is wrong with your search method obviously, put in echos to see what's wrong.