Advertisement
WaffleJohns

More Advanced Password for Tekkit

Jan 19th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. --Check out the last password script I posted for more comments
  2.  
  3. local pullEvent = os.pullEvent --Lines 3,4, and 26 came from the computercraft WIKI
  4. os.pullEvent = os.pullEventRaw
  5.  
  6. local correct= false
  7. local attempts = 0
  8.  
  9. while correct == false do
  10. print("Password Required")
  11.  
  12. if read("*") == "Password" then
  13. correct = true
  14. term.clear() --Clear the screen and reset cursor
  15. term.setCursorPos(1,1)
  16. else
  17. attempts = attempts + 1
  18. term.clear() --Clear the screen and reset cursor
  19. term.setCursorPos(1,1)
  20. for i = 5*attempts,0,-1 do --Time increases with all failed attempts
  21. print("Password Incorrect ".. "Attempts: ".. attempts) --Incorrect password cooldown
  22. print(i)
  23. sleep(1)
  24. term.clear() --Clear the screen and reset cursor
  25. term.setCursorPos(1,1)
  26. end
  27.  
  28. end
  29. end
  30.  
  31. attempts = 0
  32. os.pullEvent = pullEvent
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement