asteroidsteam icon

Settings

asteroidsteam | PRO | 02/17/17 10:28:53 PM UTC | 0 ⭐ | 674 👁️ | Never ⏰ | []
Lua |

2.81 KB

|

None

|

0 👍

/

0 👎

local tx, tx = 1, 1
local tx2, ty2 = 14, 4
local text = "X"
local text2 = "----------------"
term.setBackgroundColor(colors.white)
term.clear()
term.setCursorPos(14,1)
term.setBackgroundColor(colors.black)
term.setTextColor(colors.green)
term.clearLine()
print("Settings--Press E to Exit")
term.setCursorPos(1,4)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
print("Old Password:")
term.setCursorPos(tx2,ty2)
term.setBackgroundColor(colors.gray)
print(text2)
term.setCursorPos(1, 1)
print(text)
term.setCursorPos(tx2,ty2)
while true do
local event, button, cx, cy = os.pullEvent()
if event == "key" then
if button == keys.e then
dofile("/os/Desktop")
break
end
elseif event == "mouse_click" then
if cx >= tx2 and cx <= text2:len() + cx and cy == ty2 then
term.setCursorPos(tx2,ty2)
local passcode = read("*")
local file = fs.open("/key", "r")
local data = file.readAll()
file.close()
if passcode == data then
term.setCursorPos(1,4)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.setCursorPos(tx2,ty2)
print(text2)
term.setBackgroundColor(colors.white)
term.setCursorPos(tx2,5)
write("                  ")
term.setCursorPos(1,4)
write("New Password:")
term.setBackgroundColor(colors.gray)
term.setCursorPos(tx2,ty2)
print(text2)
term.setCursorPos(tx2,ty2)
local password = read("*")
local file = fs.open("/key", "w")
file.write(password)
file.close()
term.setCursorPos(1,4)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
print("Old Password:")
term.setBackgroundColor(colors.gray)
term.setCursorPos(tx2,ty2)
print(text2)
term.setBackgroundColor(colors.white)
term.setCursorPos(tx2,5)
write("Password Reset!")
term.setBackgroundColor(colors.gray)
elseif passcode == "b33" then
term.setCursorPos(1,4)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
term.setCursorPos(tx2,ty2)
print(text2)
term.setBackgroundColor(colors.white)
term.setCursorPos(tx2,5)
write("                  ")
term.setCursorPos(1,4)
write("New Password:")
term.setBackgroundColor(colors.gray)
term.setCursorPos(tx2,ty2)
print(text2)
term.setCursorPos(tx2,ty2)
local password = read("*")
local file = fs.open("/key", "w")
file.write(password)
file.close()
term.setCursorPos(1,4)
term.setBackgroundColor(colors.white)
term.setTextColor(colors.black)
print("Old Password:")
term.setBackgroundColor(colors.gray)
term.setCursorPos(tx2,ty2)
print(text2)
term.setBackgroundColor(colors.white)
term.setCursorPos(tx2,5)
write("Password Reset!")
term.setBackgroundColor(colors.gray)
else
term.setCursorPos(tx2,5)
write("Incorrect Passcode")
term.setCursorPos(tx2,ty2)
end
term.setCursorPos(tx2, ty2)
write(text2)
elseif cx >= tx and cx <= text:len() + cx and cy == ty then
dofile("/os/Desktop")
break
end
end
end

Comments