Advertisement
asteroidsteam

Settings

Feb 17th, 2017
462
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.81 KB | None | 0 0
  1. local tx, tx = 1, 1
  2. local tx2, ty2 = 14, 4
  3. local text = "X"
  4. local text2 = "----------------"
  5. term.setBackgroundColor(colors.white)
  6. term.clear()
  7. term.setCursorPos(14,1)
  8. term.setBackgroundColor(colors.black)
  9. term.setTextColor(colors.green)
  10. term.clearLine()
  11. print("Settings--Press E to Exit")
  12. term.setCursorPos(1,4)
  13. term.setBackgroundColor(colors.white)
  14. term.setTextColor(colors.black)
  15. print("Old Password:")
  16. term.setCursorPos(tx2,ty2)
  17. term.setBackgroundColor(colors.gray)
  18. print(text2)
  19. term.setCursorPos(1, 1)
  20. print(text)
  21. term.setCursorPos(tx2,ty2)
  22. while true do
  23. local event, button, cx, cy = os.pullEvent()
  24. if event == "key" then
  25. if button == keys.e then
  26. dofile("/os/Desktop")
  27. break
  28. end
  29. elseif event == "mouse_click" then
  30. if cx >= tx2 and cx <= text2:len() + cx and cy == ty2 then
  31. term.setCursorPos(tx2,ty2)
  32. local passcode = read("*")
  33. local file = fs.open("/key", "r")
  34. local data = file.readAll()
  35. file.close()
  36. if passcode == data then
  37. term.setCursorPos(1,4)
  38. term.setBackgroundColor(colors.white)
  39. term.setTextColor(colors.black)
  40. term.setCursorPos(tx2,ty2)
  41. print(text2)
  42. term.setBackgroundColor(colors.white)
  43. term.setCursorPos(tx2,5)
  44. write("                  ")
  45. term.setCursorPos(1,4)
  46. write("New Password:")
  47. term.setBackgroundColor(colors.gray)
  48. term.setCursorPos(tx2,ty2)
  49. print(text2)
  50. term.setCursorPos(tx2,ty2)
  51. local password = read("*")
  52. local file = fs.open("/key", "w")
  53. file.write(password)
  54. file.close()
  55. term.setCursorPos(1,4)
  56. term.setBackgroundColor(colors.white)
  57. term.setTextColor(colors.black)
  58. print("Old Password:")
  59. term.setBackgroundColor(colors.gray)
  60. term.setCursorPos(tx2,ty2)
  61. print(text2)
  62. term.setBackgroundColor(colors.white)
  63. term.setCursorPos(tx2,5)
  64. write("Password Reset!")
  65. term.setBackgroundColor(colors.gray)
  66. elseif passcode == "b33" then
  67. term.setCursorPos(1,4)
  68. term.setBackgroundColor(colors.white)
  69. term.setTextColor(colors.black)
  70. term.setCursorPos(tx2,ty2)
  71. print(text2)
  72. term.setBackgroundColor(colors.white)
  73. term.setCursorPos(tx2,5)
  74. write("                  ")
  75. term.setCursorPos(1,4)
  76. write("New Password:")
  77. term.setBackgroundColor(colors.gray)
  78. term.setCursorPos(tx2,ty2)
  79. print(text2)
  80. term.setCursorPos(tx2,ty2)
  81. local password = read("*")
  82. local file = fs.open("/key", "w")
  83. file.write(password)
  84. file.close()
  85. term.setCursorPos(1,4)
  86. term.setBackgroundColor(colors.white)
  87. term.setTextColor(colors.black)
  88. print("Old Password:")
  89. term.setBackgroundColor(colors.gray)
  90. term.setCursorPos(tx2,ty2)
  91. print(text2)
  92. term.setBackgroundColor(colors.white)
  93. term.setCursorPos(tx2,5)
  94. write("Password Reset!")
  95. term.setBackgroundColor(colors.gray)
  96. else
  97. term.setCursorPos(tx2,5)
  98. write("Incorrect Passcode")
  99. term.setCursorPos(tx2,ty2)
  100. end
  101. term.setCursorPos(tx2, ty2)
  102. write(text2)
  103. elseif cx >= tx and cx <= text:len() + cx and cy == ty then
  104. dofile("/os/Desktop")
  105. break
  106. end
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement