Advertisement
Meridius_IX

Simple Antenna Communication Script

Apr 29th, 2017
889
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. //Meridius_IX's Simple Antenna Communication Script
  2.  
  3. string antenna_name = "Antenna"; //Change this to the name of the antenna you are using to broadcast from.
  4. string timer_name = "Timer Block"; //Change this to the name of the timer block you want to trigger on the receiving end.
  5. string receiver_command = "Trigger Timer"; //This string will be used as the argument to trigger the receiving programmable block.
  6.  
  7. void Main(string argument){
  8.    
  9.     if(argument == receiver_command){
  10.        
  11.         //Receiver Actions
  12.         IMyTimerBlock timer = GridTerminalSystem.GetBlockWithName(timer_name) as IMyTimerBlock;
  13.         if(timer != null){
  14.            
  15.             timer.ApplyAction("TriggerNow");
  16.            
  17.         }
  18.        
  19.         return;
  20.        
  21.     }else{
  22.        
  23.         //Transmitter Actions
  24.         IMyRadioAntenna antenna = GridTerminalSystem.GetBlockWithName(antenna_name) as IMyRadioAntenna;
  25.         if(antenna != null){
  26.            
  27.             bool transmit = antenna.TransmitMessage(receiver_command);
  28.            
  29.         }
  30.        
  31.     }
  32.    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement