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

Powered Computer Help

Started by HiddenShadow55, 07 August 2012 - 06:40 AM
HiddenShadow55 #1
Posted 07 August 2012 - 08:40 AM
Recently i have been attempting to make a code which makes it so that the computer needs a Redstone input in order to stay on. So far i have this:


term.clear()
term.setCursorPos(1,1)

if redstone.getInput("back", true) then
print("Welcome User")
else
print("Not Enough Power")
sleep(3)
os.shutdown()
end

This works fine when the computer is first switched on. The computer will switch off if a Redstone current is not applied to the back of the computer. I have been having trouble trying to figure out how to make it so that if during use the computer does not have a Redstone current it will immediately switch off.

Help is greatly appreciated
ChiknNuggets #2
Posted 07 August 2012 - 01:19 PM
put the restone part inside a loop?
Luanub #3
Posted 07 August 2012 - 01:28 PM
See this post for some help. MysticT posted some code that should do just what you want. This question seems to pop up from time to time.

http://www.computercraft.info/forums2/index.php?/topic/3114-need-help-adding-electricity-to-computers/
HiddenShadow55 #4
Posted 07 August 2012 - 03:10 PM
See this post for some help. MysticT posted some code that should do just what you want. This question seems to pop up from time to time.

http://www.computerc...y-to-computers/

Thank you. This was extremely helpful. Im new to coding