Posted 02 January 2013 - 02:37 PM
I play on Tekkit with my friends, and I made a password protected door successfully, but I want it to print a message out when they type "hint" in the password input (instead of the actual password). The code has no errors when I run it, yet it does nothing when I type hint in.
My code is as follows, (please note: I'm a beginner at this, so my code might be a bit messy.)
I had to put two ends for some reason, otherwise it would say "end" expected at line 14 (where the second to last end is at the moment) to execute while true do or something like that.
Anyways, how can I make it print out the "It has pass in it." if they type hint?
Thank you:)!
My code is as follows, (please note: I'm a beginner at this, so my code might be a bit messy.)
while true do
term.clear()
term.setCursorPos(1, 1)
print ("A password is required:")
print ("Forgot the pasword? Type hint.")
local input = read("*")
if input == "password" then
redstone.setOutput("back", true)
sleep(5)
redstone.setOutput("back", false)
else if input == "hint" then
print ("It has pass in it.")
end
end
end
I had to put two ends for some reason, otherwise it would say "end" expected at line 14 (where the second to last end is at the moment) to execute while true do or something like that.
Anyways, how can I make it print out the "It has pass in it." if they type hint?
Thank you:)!