fishermedders

Craftersland ComputerCraft Tutorial Code

Dec 21st, 2015
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.71 KB | None | 0 0
  1. password = "ilovecookies" -- password to get in
  2. time = 3 -- time in seconds to get in the door
  3. side = "left" -- usable sides are top, bottom, left, right, front, and back
  4. while true do -- loop that runs forever
  5.   rs.setOutput(side,false) -- close door
  6.   print("What is the password to get in?") -- ask question
  7.   input = read("*") -- get user's answer
  8.   if input == password then -- you got the pass right
  9.     rs.setOutput(side,true) --open door
  10.     print("You got the password right!") -- congrats
  11.   else -- if wrong
  12.     rs.setOutput(side,false) -- close the door
  13.     print("Sorry, but that's incorrect!") -- nope lol
  14.   end -- end the if statement
  15.   sleep(time) -- wait for 'time'
  16. end -- end the forever loop.
Add Comment
Please, Sign In to add comment