Posted 13 June 2013 - 03:38 PM
Hi,
I'm trying to create a train station in minecraft with the mod railcraft. I have it built and everything works fine. However I want to use computercraft to remotely control all the trains. At the moment i have to drive the trains then using a boarding track the train stops at the station and will go on a redstone signal. I want to be able to remotely control the stations from one computer at a control room type thing so i may be asking a load of questions in the near future as i'm terrible at programming.
So I've made a test world and set up some track and basically one thing i want to be able to do is track the locations of the trains. The best way i've thought of is by using a detector track and as the cart goes over it, it will send a redstone signal to a computer which will then send to the control computer something like "train is at station 1" (i may name the stations). I've set a test track up so that it prints out "x carts" where x its number of carts. this works completely fine however i need it to be sent through rednet which i can't get it to do. This is my attempt of trying to send it to another computer.
local i = 0
rednet.open("right")
while true do
sleep(0.01)
if redstone.getInput("back",true) then
i = i + 1
rednet.send(16, (i.." carts"))
sleep(1)
end
end
the rednet.getInput line was print(i .." carts") and worked fine and updated each time the cart went over the detector track so it went "1 carts, 2 carts, 3 carts" and so on. How do i send this to another computer and i have also set another computer up with a program like so:
rednet.open("left")
while true do
rednet.receive()
end
but nothing prints on the receiving computer.
I'm trying to create a train station in minecraft with the mod railcraft. I have it built and everything works fine. However I want to use computercraft to remotely control all the trains. At the moment i have to drive the trains then using a boarding track the train stops at the station and will go on a redstone signal. I want to be able to remotely control the stations from one computer at a control room type thing so i may be asking a load of questions in the near future as i'm terrible at programming.
So I've made a test world and set up some track and basically one thing i want to be able to do is track the locations of the trains. The best way i've thought of is by using a detector track and as the cart goes over it, it will send a redstone signal to a computer which will then send to the control computer something like "train is at station 1" (i may name the stations). I've set a test track up so that it prints out "x carts" where x its number of carts. this works completely fine however i need it to be sent through rednet which i can't get it to do. This is my attempt of trying to send it to another computer.
local i = 0
rednet.open("right")
while true do
sleep(0.01)
if redstone.getInput("back",true) then
i = i + 1
rednet.send(16, (i.." carts"))
sleep(1)
end
end
the rednet.getInput line was print(i .." carts") and worked fine and updated each time the cart went over the detector track so it went "1 carts, 2 carts, 3 carts" and so on. How do i send this to another computer and i have also set another computer up with a program like so:
rednet.open("left")
while true do
rednet.receive()
end
but nothing prints on the receiving computer.