Posted 07 March 2013 - 04:18 PM
I've recently started futzing about with ComputerCraft, since my server is doing a for fun feed the beast server for admins and trusted players. I decided it would be pretty cool to have a tower surrounded by a canyon, and deploy turtles to greet anyone entering and prompt them for the entry password after they press the doorbell. For the program of the greeting turtle, I can get as far as responding to the redstone signal before getting an error. The code is written here.
rednet.open("right")
signal = redstone.getInput("top")
if signal == true then
turtle.forward()
end
while not turtle.detectDown() do
turtle.foward()
end
turtle.left()
turtle.clear()
turtle.setCursorPos(1,1)
turtle.write("Welcome to the lab! Password: ")
local input = read ("*")
turtle.clear()
turtle.setCursorPos(1,1)
turtle.write("Wait here while I check!")
sleep(5)
turtle.right()
turtle.backward()
while not turtle.detectDown() do
turtle.backward()
end
rednet.broadcast(input)
rednet.open("right")
signal = redstone.getInput("top")
if signal == true then
turtle.forward()
end
while not turtle.detectDown() do
turtle.foward()
end
turtle.left()
turtle.clear()
turtle.setCursorPos(1,1)
turtle.write("Welcome to the lab! Password: ")
local input = read ("*")
turtle.clear()
turtle.setCursorPos(1,1)
turtle.write("Wait here while I check!")
sleep(5)
turtle.right()
turtle.backward()
while not turtle.detectDown() do
turtle.backward()
end
rednet.broadcast(input)