3 posts
Posted 20 May 2012 - 01:11 AM
Alright, so, what I'm trying to do is a full lockdown code for my base in Tekkit. What I want to happen is send out a redstone signal from one computer and lock all doors that have computers next to them. Is it possible to generate code that when the redstone is active at a point on the computer that it will automatically access a program to shutdown the computer itself?
1604 posts
Posted 20 May 2012 - 03:01 AM
You can make a program that waits for redstone input and then run some program or code. If you need to have the shell running at the same time you could use the parallel api. So, it's possible, just give it a try and come back if you have any question.
3 posts
Posted 20 May 2012 - 04:54 PM
You can make a program that waits for redstone input and then run some program or code. If you need to have the shell running at the same time you could use the parallel api. So, it's possible, just give it a try and come back if you have any question.
Now, I'm a noob at coding. I know how to do a simple lock code, but I don't know the code to open programs with a signal.
1604 posts
Posted 20 May 2012 - 07:33 PM
If you want to make a program that waits for redstone input and then does something, you can use a loop that checks for the "redstone" event:
while true do
os.pullEvent("redstone")
if rs.getInput("side") then -- change side to the side you want to check
break
end
end
-- code to run after signal here
If you need to have the shell running at the same time and just start a program when you get the signal you can use the parallel api to run it on the background. It would require some more work, but it's not that hard.
3 posts
Posted 21 May 2012 - 02:04 AM
If you want to make a program that waits for redstone input and then does something, you can use a loop that checks for the "redstone" event:
while true do
os.pullEvent("redstone")
if rs.getInput("side") then -- change side to the side you want to check
break
end
end
-- code to run after signal here
If you need to have the shell running at the same time and just start a program when you get the signal you can use the parallel api to run it on the background. It would require some more work, but it's not that hard.
Right, thank you
123 posts
Posted 26 May 2012 - 07:09 AM
From your scenario you may be better suited to using wireless modems, just seems silly to run round with redstone wires when the air itself can be your medium.