1 posts
Posted 01 April 2012 - 06:00 PM
I'm trying to make a nuclear powerplant (using industrialcraft) with a main console, this console is going to have a gui and options to control reactor cooling and doors, shutters, power distribution etc. Of course one redstone output won't be enough to make this work. So I decided to make it transmit messages via wireless modems and rednet to other pc's that then execute commands, in this case mostly activating redstone currents. Being new to coding in general, how could i do this?
(my current version of minecraft is 1.1 because i'm using tekkit)
718 posts
Location
Hawaii
Posted 01 April 2012 - 09:10 PM
I'm trying to make a nuclear powerplant (using industrialcraft) with a main console, this console is going to have a gui and options to control reactor cooling and doors, shutters, power distribution etc. Of course one redstone output won't be enough to make this work. So I decided to make it transmit messages via wireless modems and rednet to other pc's that then execute commands, in this case mostly activating redstone currents. Being new to coding in general, how could i do this?
(my current version of minecraft is 1.1 because i'm using tekkit)
Sender:
rednet.open("side of modem")
rednet.send(*INSERT ID OF RECEIVER*, "doors")
Receive:
rednet.open("side")
while true do
a, b = rednet.receive()
if b == "doors" then
redstone.setOutput("back", true)
sleep(1)
redstone.setOutput("back", true)
end
To add more commands, add this to sender:
rednet.send(*INSERT ID OF RECEIVER*, "command")
and this to receiver:
if b == "command" then
--add code here
end
6 posts
Posted 18 June 2012 - 07:32 PM
I'm trying to make a nuclear powerplant (using industrialcraft) with a main console, this console is going to have a gui and options to control reactor cooling and doors, shutters, power distribution etc. Of course one redstone output won't be enough to make this work. So I decided to make it transmit messages via wireless modems and rednet to other pc's that then execute commands, in this case mostly activating redstone currents. Being new to coding in general, how could i do this?
(my current version of minecraft is 1.1 because i'm using tekkit)
Sender:
rednet.open("side of modem")
rednet.send(*INSERT ID OF RECEIVER*, "doors")
Receive:
rednet.open("side")
while true do
a, b = rednet.receive()
if b == "doors" then
redstone.setOutput("back", true)
sleep(1)
redstone.setOutput("back", true)
end
you mean false? true then false, or then doors would be stuck open.
To add more commands, add this to sender:
rednet.send(*INSERT ID OF RECEIVER*, "command")
and this to receiver:
if b == "command" then
--add code here
end
2 posts
Posted 26 December 2012 - 01:29 AM
this script is not working, why doe it expect to end at line:2?
799 posts
Location
Land of Meh
Posted 26 December 2012 - 06:18 AM
That wasn't a full script - I think ComputerCraftFan11 intended it to be something to lead you in the right direction, not for you to use it as it is.
Anyway, fixed version (he forgot to end the while true statement):
Again, this is also to lead you in the right direction, not be a complete working application.
rednet.open("side")
while true do
local a, b = rednet.receive()
if b == "doors" then
redstone.setOutput("back", true)
sleep(1)
redstone.setOutput("back", false)
elseif b == "reactor off" then
redstone.setOutput("right", false)
elseif b == "reactor on" then
redstone.setOutput("right", true)
end
-- Add more elseif statements to add more commands
end
rednet.open("side")
rednet.send(ID OF SENDER, "doors")
rednet.send(ID OF SENDER, "reactor on")
sleep(10)
rednet.send(ID OF SENDER, "reactor off")