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

Railcraft/Traincraft Automated Network Project

Started by MrMoriarty, 19 August 2015 - 12:37 PM
MrMoriarty #1
Posted 19 August 2015 - 02:37 PM
Hey everyone, newbie poster and relative newb to computercraft and coding. (Note to mods; if this is adds to the noise ratio or is in the wrong board, please let me know or remove it >.< don't wanna add to the problem)

I can do some basic things with turtles thus far, filling, building simple structures etc.

My project and ask is this;

I'm building a massive train network using railcraft &amp; traincraft. What I want to be able to do with it is;

Have it pass checkpoints and relay that information to a network, things like time taken between checkpoints, ETAs on next checkpoint, automatically stop and start at stations (with reasonable boarding times, this isn't British Rail :D/>), and where a train is (i.e when it passed a checkpoint, I can't imagine real-time being possible or at least not bloody difficult).

Question being, I'm not familiar with rednet stuff yet so after the rails/stations are built, what do I need to create these checkpoints block-wise and where should I look/start when it comes to writing the necessaries for this? This was an idea inspired by a friend of mine and he got me started but he's not around for a good while so I can't pick his brain but he seemed to think this was a) possible and B)/> a good exercise for fun and developing my coding skills.
HPWebcamAble #2
Posted 19 August 2015 - 11:14 PM
It would be challenging, but it could work.

You can obviously detect when a train passes with a computer next to a detector rail.
It will fire the event 'redstone', you then use rs.getInput() to figure out what changed.
(The full redstone API)

In terms of rednet:
The transmission distance of modems is limed. You can get around this a few ways:
Use Rednet (As opposed to the modem API), and have each computer run your custom program, as well as the 'repeat' program to make sure messages get where they need to go
Assuming each computer is close enough to its neighbor, messages should be sent with no problem
OR
Increase the distance in your CC Config, if you have the ability to do so

You'll need to figure out what each computer will send to the others, and when.
(You might want to look into my Protocol Manager API :)/> )
Edited on 19 August 2015 - 09:15 PM
MrMoriarty #3
Posted 20 August 2015 - 04:40 PM
Haha cheers, HP, I had a feeling I'd be digging into your stuff for this. I haven't used rednet really so I'll read up while I wait on my massive dig and start building the actual rails. The 'simple' part seems to be having it send and receive signals, but what I'm scratching my head at is where to start on how to present this data from a computer, possibly on a display (I've seen some good tuts on making simple displays and a friend showed me how to make temp gauges for rods on a reactor) but having it track the trains as it passes checkpoints is tricky to picture. I will start small though and have a small loop track to start programming this before I scale this to the whole network.