Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pass = "1234"
- shell.run("clear")
- sides = {"top","bottom","left","right","front","back"}
- mon = nil
- for v, k in pairs(sides) do
- if peripheral.getType(k) == "monitor" then
- mon = peripheral.wrap(k)
- end
- end
- if mon ~= nil then
- mon.clear()
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.green)
- gx,gy = mon.getSize()
- numpad = {}
- numpad[1] = {"1",2,2}
- numpad[2] = {"2",4,2}
- numpad[3] = {"3",6,2}
- numpad[4] = {"4",2,3}
- numpad[5] = {"5",4,3}
- numpad[6] = {"6",6,3}
- numpad[7] = {"7",2,4}
- numpad[8] = {"8",4,4}
- numpad[9] = {"9",6,4}
- numpad[0] = {"0",4,5}
- for v, k in pairs(numpad) do
- mon.setCursorPos(k[2],k[3])
- mon.write(k[1])
- end
- id = {}
- n = 1
- id[1] = {"",1,1,""}
- id[2] = {"",3,1,""}
- id[3] = {"",5,1,""}
- id[4] = {"",7,1,""}
- defB = colors.black
- defT = colors.green
- function mbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = defB
- end
- if tcol == nil then
- tcol = defT
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(defB)
- mon.setTextColor(defT)
- end
- while true do
- if n > 4 then
- sleep(1)
- sPass = id[1][1] .. id[2][1] .. id[3][1] .. id[4][1]
- if sPass == pass then
- mbut(gx,gy," ",colors.green,nil)
- rs.setOutput("right",true)
- sleep(2)
- mbut(gx,gy," ",colors.black,nil)
- rs.setOutput("right",false)
- else
- mbut(gx,gy," ",colors.red,nil)
- sleep(1)
- mbut(gx,gy," ",colors.black,nil)
- end
- mon.setCursorPos(1,1)
- mon.clearLine()
- id[1] = {"",1,1}
- id[2] = {"",3,1}
- id[3] = {"",5,1}
- id[4] = {"",7,1}
- n = 1
- end
- evt = {os.pullEvent("monitor_touch")}
- x = evt[3]
- y = evt[4]
- for v, k in pairs(numpad) do
- if k[2] == x and k[3] == y then
- id[n][1] = k[1]
- mbut(id[n][2],id[n][3],id[n][1],nil,colors.red)
- n = n + 1
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment