Space Engineers

Space Engineers

评价数不足
[broken] RPBARS - Remote Programmable Block Activation: Receiver & Sender
   
奖励
收藏
已收藏
取消收藏
文件大小
发表于
更新日期
17.160 KB
2018 年 10 月 21 日 下午 3:35
2018 年 11 月 4 日 上午 4:31
3 项改动说明 ( 查看 )

订阅以下载
[broken] RPBARS - Remote Programmable Block Activation: Receiver & Sender

描述
Latest Update

v2.0.1 - bug fix

Fixed a bug that caused the script to throw an exception when sending/receiving messages with newline characters in the message.

Features

  • Allows remote-run of scripts on other PB's on other grids using antennas
  • Channel binding to control which "reveivers" action your commands
  • Receiver naming to allow control of individual receivers
  • Works with any other PB script that accepts arguments to its run command
  • Can relay messages over longer distances with intermediary antennae

Tested with


Receiver setup

  1. Place the programmable block on your grid and load this script into it.
  2. In the custom data of the programmable block enter the name that you want this ship to be known by in the following format:

    ReceiverName=<your name here>

  3. In the custom data of the programmable block enter the list of channels that you want this grid to listen on:

    ReceiverChannels=#Miners,#Automated

    Note: RecieverChannels should not contain ANY spaces.

    The #'s aren't needed, I just think it makes it looks nicer.

  4. Recompile the script !important

  5. Set the "Programmable Block" option in your Ship's Antenna to use this scripts programmable block

Relay Mode

If you would like the receiver to also re-broadcast the received message, simply set RelayMode=true in the custom data of the programmable block.

This can be useful to extend the range that your base can broadcast by creating relay stations on the boundary of your base antenna's range. You can also have your ships act as relay's in the same way.

The script protects its self from feedback loops by recording a history of each message received/relayed. If the message has already been relayed by a given Programmable Block, it will not be broadcast again.

Transmitter setup

  1. Place the programmable block on your grid and load this script into it.
  2. Optional In the custom data of the programmable block enter the name of the antenna you would like to use for broadcasting in the following format:

    BroadcastAntenna=<your antenna name here>

    If you do not enter this, the script will select the antenna with the largest broadcast range automatically.

  3. Recompile the script !important

Button panel configuration / Using the script

To use the script you simply have to run the Transmitter PB with an argument in the following format:

<channel-name>:<receiver-name>:<receiver-pb-to-run>:<arguments>

You can do this from the terminal, by dragging the Transmitter PB to a button, or onto the hotbar of a ship or remote control block, etc.

Sending to all channels

Use the channel #all

Sending to all receivers on a specific channel

Use the receiver name @all


Examples

Since each button you create can have its own arguments you can create buttons for pretty much anything.

For example, in my base I have 4 mining ships, each running https://psteamcommunity.yuanyoumao.com/sharedfiles/filedetails/?id=1507646929.

They are named "Miner 1", "Miner 2", etc. in the ReceiverName setting. They all have the "#Miners" channel. I've also given each one an additional channel depending if they are in hangar 1 or hangar 2 (#MinerHangar1 and #MinerHangar2 respectively)

In each hangar I have a button panel at the back of the hangar that has all 4 buttons running my script... each with different arguments. Below is my hangar 1 configuration:

  1. #Miners:@all:PB PAM:CONT
  2. #Miners:@all:PB PAM:HOMEPOS
  3. #MinerHangar1:@all:PB PAM:CONT
  4. #MinerHangar1:@all:PB PAM:HOMEPOS

I also have another panel condigured as follows in hangar 1:

  1. #Miners:Miner 1:PB PAM:CONT
  2. #Miners:Miner 1:PB PAM:HOMEPOS
  3. #Miners:Miner 2:PB PAM:CONT
  4. #Miners:Miner 2:PB PAM:HOMEPOS

This setup allows me to control my miners as a group, or individually. I can send them out to continue mining when I log on, and recall them just before I log off.

Future Plans

  • Auto-detect broadcast antennas DONE
  • Timestamped messages DONE
  • Structured messages DONE
  • Relay mode DONE

  • Acknowledgement broadcasts

    So that the transmitter can report whether the receiver actually received and acted on the message.

Bug reports & Suggestions

Please post bug reports to my issue tracker at https://bitbucket.org/lee-conlin/se_rpbars/issues?status=new&status=open
热门讨论 查看全部(1)
0
2018 年 10 月 21 日 下午 3:46
置顶: Bug Reports
Kyr
13 条留言
Kyr  [作者] 2020 年 7 月 5 日 下午 12:41 
Sorry about that. I've not got the source to this as my hard drive blew up a few months back. I originally wrote this to be able to control PAM miners remotely and Keks then implemented that functionality into PAM.
Fendralor 2020 年 4 月 25 日 上午 7:37 
This is broken as of 1.194, probably because of the changes to the API. If you could fix this, it would be much appreciated. :)
Kyr  [作者] 2019 年 2 月 24 日 上午 10:10 
I’ve only tested with regular antennas. I know laser antennas are a completely different object type so it won’t work with them. Unsure about modded antennas. If they behave exactly like normal antennas then it might work. Let me know 🙂
thorman123456789 2019 年 2 月 21 日 下午 3:58 
do you know if this script will work with modded antennas or laser antennas?
Kyr  [作者] 2018 年 12 月 25 日 下午 6:15 
Let me know how it goes. The relay piece is the only piece I've not been able to do that much testing on, though the 2-sec rebroadcast prevention seems to work nicely.
Emiricol4Rl 2018 年 12 月 24 日 下午 8:31 
I'm planning a drone base in the center of my 5 installations (home base, plus HullTec's four factories, for survival RP gaming). This will make it easy for me to send the drone swarmt to whichever quadrant is under attack, then search the area by patrolling established waypoints.

Using another mod for in-game scripting, I may even be able to automate sending them out and when they come home, for when I'm not there to mash the buttons myself. I *may* even be able to automate sending mining drones out with PAM, so all I'd be doing is scouting ore locations and adding their GPS to the list of sites to be mined. Lol. The key there is your script's ability to rebroadcast without repeating the broadcast. I'm kind of excited to try that out, now :)
Kyr  [作者] 2018 年 12 月 24 日 上午 6:10 
Glad you like it!

I've mainly used it with PAM and with SPUGs autodocking script along with Kolts command consoles to act as buttons. The RPBARS script is entirely generic though - all its really doing is relaying a set of params to another programmable block on the receiving grid.

Any other script that receives params can be used with it.
Emiricol4Rl 2018 年 12 月 23 日 下午 2:25 
This... is awesome! Timestamps and acknowledgements are so cool. I wonder if there's any way to give this audio "radio chatter" to go with it lol. Do you have other examples of this in use, or YouTube vids of that? I see the value for mining, but it should work with other things, too, right? As for mining, is using this with PAM just a way to have a single interface for sending commands out? By itself, that's worth it if I'm using other command scripts, but I'm wondering if it adds to PAM's functionality too :) ^5 on a great script!
Kyr  [作者] 2018 年 10 月 28 日 上午 6:36 
v2.0.0 - Big improvements

WILL NOT WORK WITH V1 - UPDATE ALL PROGRAMMABLE BLOCKS TO THIS VERSION AND UPDATE ALL BUTTONS TO NEW MESSAGE FORMAT


- Restructured the message for easier parsing. Now uses ':' to seperate each segment of the message - see updated docs below.
- Added script version check (see output in receiver for info if versions mismatch)
-Added Timestamp to message. Messages older than 2 seconds are ignored.
- Made BroadcastAntenna setting optional - script will find the best antenna it can on your grid if not provided.
- Added relay capability
Kyr  [作者] 2018 年 10 月 23 日 下午 11:50 
@D4rkSh4d0w That's great to hear, thank you.

As for a debug option, if you look in the programmable blocks detail area (bottom right of the terminal) there should be some output there after you transmit.

Also, on the receiving programmable block there should be some output too, after it receives a message.

On each grid you may also add an LCD with a tag in the name. To do this, in that grid's programmable block, in the custom data field add ...

StatusLcd=<name of yor LCD>

<name of yor LCD> can be a partial name or a tag like other scripts use (i.e. [rpbars-debug] )

Once you've added that, recompile the script and it will write it's output to the LCD instead of the programmable block detail area.

I'm still getting to grips with LCD's and it's not perfect yet, which is why I didn't put it in the documentation. Also be aware that the implementation of the LCD(s) that the script uses may change in coming versions as I figure them out more.