This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
robertcarr22's profile picture

[lua] Train station program

Started by robertcarr22, 01 February 2013 - 11:45 AM
robertcarr22 #1
Posted 01 February 2013 - 12:45 PM
On a multiplayer sever we have a train station.

What I want to do is for a monitor to display how far away a train is and say when it has arrived.

I have thought of a couple ways to do this but need help to decide the best choice.

Also note I am using FTB direwolf20 pack so misc peripherals is installed.

Option 1-
Use a detector rails and have separate wireless Redstone frequencies for each detector rail that represent a certain distance from the station. Then near monitor have a turtles with a Wireless Redstone module and wireless modem attached to them. There would be 1 turtle for each frequency. Each turtle waits for a Redstone signal through wireless Redstone module and then sends the distance cart is over rednet to the monitor.

Option 2-
Use detector rails and frequencies again but have each frequency output into a certain colour that goes into a bundled cable which attaches to a computer. Each colour would represent a certain distance. The computer waits for signal through a colour. Then converts that to a distance and sends to monitor to be displayed.

These are the only two options I could think of so if anyone has a better way of doing it that would be great!
I hope both methods make sense! :P/>
Thanks!
imef #2
Posted 01 February 2013 - 01:31 PM
I'd probably use the bundled cables.
In both cases, if you have very long tracks and put many detectors, it will be demanding for the server.
TheArchitect #3
Posted 01 February 2013 - 05:33 PM
I'd suggest going with bundled cables too, but like imef says, it may be demanding if you have a lot of distance sensors to probe.
robertcarr22 #4
Posted 02 February 2013 - 06:33 AM
thanks for the reply guys!
Okay ill use bundled cable method but I won't use too many detector points :)/>
mikesaa309 #5
Posted 18 June 2013 - 07:05 AM
i havbe built a train station too and the way I did it was to tell me when a train arrives at a station a station and when it leaves a station. I wanted this as i am working on a program where i can control the whole system so a train could be at a station and from the computer at the control room i can send a redstone signal to allow the train boarding track (from railcraft) to be activated and let the train go. I did this by placing detector tracks down at the station with a computer underneath it which basically waits for a redstone signal, when it does it sends a message to one computer saying "train is at station 1" for example. Then when the redstone signal turns of it sends a message to the same computer saying "train has left station 1". This way i know what stations are occupied by a train. I used rednet to send the message and just changed the rednet sending limit in the config file so i didn't have to mess around with extra computers to relay the message.