Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- sides = {"top","bottom","left","right","front","back"}
- for getPeris = 1, table.maxn(sides), 1 do
- if peripheral.getType(sides[getPeris]) ~= nil then
- if peripheral.getType(sides[getPeris]) == "monitor" then
- mon = peripheral.wrap(sides[getPeris])
- end
- end
- end
- mon.setTextScale(1)
- mon.clear()
- if fs.exists("config") == false then
- print("Password eingeben")
- pw = io.read()
- pw = string.lower(pw)
- sFile = fs.open("config","w")
- sFile.writeLine(pw)
- sFile.close()
- else
- rFile = fs.open("config","r")
- pw = rFile.readLine(1)
- rFile.close()
- end
- function writeLetters()
- click = {}
- lx = 2
- ly = 4
- for v = 97, 122,1 do
- table.insert(click,{["Letter"] = string.char(v),["X"] = lx,["Y"] = ly})
- lx = lx + 1
- end
- table.insert(click,{["Letter"] = "<",["X"] = click[1].X,["Y"] = ly + 1})
- table.insert(click,{["Letter"] = "=",["X"] = click[1].X + 1,["Y"] = ly + 1})
- mon.setTextColor(colors.cyan)
- for a = 1, #click, 1 do
- mon.setCursorPos(click[a].X,click[a].Y)
- mon.write(click[a].Letter)
- end
- mon.setTextColor(colors.white)
- end
- fx = 2
- function send(check)
- if pw == testPass then
- mon.setCursorPos(2,3)
- mon.setTextColor(colors.green)
- mon.write("Password akzeptiert")
- mon.setTextColor(colors.white)
- rs.setOutput("bottom",true)
- sleep(4)
- rs.setOutput("bottom",false)
- else
- mon.setCursorPos(2,3)
- mon.setTextColor(colors.red)
- mon.write("Password falsch")
- mon.setTextColor(colors.white)
- sleep(3)
- end
- mon.clear()
- end
- testPass = ""
- while true do
- writeLetters()
- evt, side, x, y = os.pullEvent("monitor_touch")
- mon.setCursorPos(fx,2)
- for co = 1, #click, 1 do
- if x == click[co].X and y == click[co].Y then
- if click[co].Letter == "<" then
- fx = fx - 1
- if fx == 1 then
- fx = 2
- end
- if string.len(testPass) < 1 then
- shell.run("reboot")
- end
- mon.setCursorPos(fx,2)
- mon.write(" ")
- testPass = testPass:sub(1,-2)
- elseif click[co].Letter == "=" then
- send(testPass)
- testPass = ""
- fx = 2
- else
- mon.setTextColor(colors.orange)
- mon.write(click[co].Letter)
- mon.setTextColor(colors.white)
- testPass = testPass .. click[co].Letter
- fx = fx + 1
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement