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

Computer controlled force-field

Started by Tharr, 19 January 2014 - 06:53 AM
Tharr #1
Posted 19 January 2014 - 07:53 AM
I'm trying to use a computer to turn on my tekkit classic force-field. I want to be able to input activate to turn it on and have it stay on. and later input a diffrent passcode to deactivate it. Any tips or suggestions would be very welcomed and apreciated. Also i need it to automaticly run on startup if possable. Many thanks in advance, I hope to one day concour this Lua beast.
CometWolf #2
Posted 19 January 2014 - 02:14 PM
Im assuming you can use redstone to controll it, so just use the redstone API for that.
to read user input you can use read()

redstone.setOutput("back",false)
while true do
  local input = read()
  if input == "activate" then
    redstone.setOutput("back",true)
  elseif input == "deactivate" then
    redstone.setOutput("back",false)
  end
end
To run it on startup, just name the program "startup".