Author Topic: Radios  (Read 1295 times)

Ok, now another dilemma. For some reason, this doesn't work either. Here is the code:
Code: [Select]
//This is the radio stuff
    if(strstr(%text, ", over") > -1)//This checks to see if it's actually in the sentence
    { //^That makes it so I know there's ", over" in the sentence
if(getSubStr(%text, strlen(%text) - strlen(", over"), strlen(%text)) $= ", over")
{
   InitContainerRadiusSearch(%speakerpos,$Survival::ChatRange, $TypeMasks::FxBrickAlwaysObjectType);
   while((%Dah = ContainerSearchNext()) != 0)
   {
      if(%Dah.getDatablock().getName $= "RadioBrick" && isObject(%Dah.attachment))
      {
%DahPos = %Dah.getTransform(); //I use this later for more protection on double messaging
         MessageRadio(%Cprefix,%Cname,%Csuffix,%text,%Dahpos);
      }
   }
        }
             }
And here is the MessageRadio function:
Code: [Select]
function MessageRadio(%Cprefix,%Cname,%Csuffix,%text,%Dahpos)
{
   echo("LOLOLOLOLOLOLOLOL");
   for(%i=0;%i<BrickRadioSet.getCount();%i++)
   {
      %oRadio = BrickRadioSet.getObject(%i);
      %oRadioPos = %oRadio.getTransform();
      echo("Radio "@ %i @": "@ %oRadioPos);
      if(%oRadioPos != %Dahpos)
      {
         InitcontainerRadiusSearch(%oRadioPos, $Survival::ChatRange, $Typemasks::PlayerObjectType);
         while((%Raggle = ContainerSearchNext()) != 0)
         {
messageClient(%Raggle.client,"","\c5[Local] \c7"@ %Cprefix @"\c3"@ %Cname @"\c7"@ %Csuffix @"\c6: "@ %text);
         }
      }
   }
}
For some reason, the message Radio function does not activate...

Bump Oh wow, I think I found the problem.
« Last Edit: June 26, 2009, 10:15:33 AM by AGlass0fMilk »

Well, now I am going to implement channels. But I need to know where I could store the channel numbers, and I need to store the channel numbers onto the bricks. I plan to have it so when you close the radio gui, it updates the storage thing or whatever. But I am going to store the channel variables on the bricks through:

%brick.channel

But I don't know how to transmit the bricks object through all of these functions. So.... Yeah. How could I store the channels variable on the brick that the person activated to open the GUI when they close the GUI.

I think if you set the command on the button to something like %brick.channel++; or make a new method for fxDTSBricks you can use on radios you can do that.  it'd have to have the buttons being a servercmd and having it do it though.

It'd be something like where the Wrench GUI gets the brick that was wrenched, and then takes it's Object ID and puts it as the title of the Window.

Tom

Bump Oh wow, I think tom helped me find the problem.

No, I found it on my own later:
Code: [Select]
if(%Dah.getDatablock().getName $= "RadioBrick" && isObject(%Dah.attachment))
Turns out I left out the "()" on GetName, and thus the check before that was failing. It works now, just channels need to be implemented. But thanks for some help anyways, well on making it a static shape and all.