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

Lock Script Don't Work...

Started by Bennievv, 25 February 2012 - 10:59 AM
Bennievv #1
Posted 25 February 2012 - 11:59 AM
I have maded a script that opens the door with a password. But it won't run…


local function clearScreen()
term.clear()
print("Welcome at the house of Bennievv!")
print("Type a password please...")
while true do
if read ("*") == "«PASSWORD»" then
print ("CORRECT!")
sleep(2)
clearScreen()
print("Opening...")
redstone.setOutput("left", true)
sleep(2)
redstone.setOutput("left", false)
clearScreen()
print("Closing...")
else
print("Incorrect!")
sleep(3)
end
end

Yeah, I'm new at LUA…
TheVarmari #2
Posted 25 February 2012 - 12:02 PM
I have maded a script that opens the door with a password. But it won't run…


local function clearScreen()
term.clear()
term.setCursorPos(1,1)
end

print("Welcome at the house of Bennievv!")
print("Type a password please...")

while true do
ent_pass = read("*")
if ent_pass == "«PASSWORD»" then
print ("CORRECT!")
sleep(2)
clearScreen()

print("Opening...")
redstone.setOutput("left", true)
sleep(2)
redstone.setOutput("left", false)
clearScreen()
print("Closing...")
else
print("Incorrect!")
sleep(3)
end
end

Yeah, I'm new at LUA…

Your fail is you did not end the function.
This should be correct.
Bennievv #3
Posted 25 February 2012 - 01:28 PM
Oh, okay!

Thanks!