Advertisement
Guest User

startup

a guest
Mar 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. while true do
  2.   term.clear()
  3.   term.setCursorPos(1, 1)
  4.   print("<Waiting for input>")
  5.    
  6.   local curPos = 1
  7.   local curPass = ""
  8.   input = ""    
  9.   while true do
  10.      local event, param = os.pullEventRaw()
  11.              
  12.      if event == "char" and curPos < 20 then
  13.        term.setCursorPos(curPos, 2)
  14.        print(param)
  15.        curPos = curPos + 1
  16.        curPass = curPass .. param
  17.      end
  18.  
  19.     if event == "key" and param == 14 and curPos ~= 0 then
  20.       curPos = curPos - 1
  21.       term.setCursorPos(curPos, 2)
  22.       print(" ")
  23.       curPass = string.sub(curPass, 1, string.len(curPass) - 1)      
  24.     end
  25.  
  26.     if event == "key" and param == 28 then
  27.       input = curPass            
  28.       break
  29.     end          
  30.   end
  31.  
  32.   term.setCursorPos(1, 3)
  33.   print("You have entered " .. input)
  34.   if input == "catamorphism" then
  35.     print("Welcome home.")
  36.  
  37.     redstone.setOutput("back", true)
  38.     sleep(10)
  39.     redstone.setOutput("back", false)
  40.   end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement