Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("btn")
- mon = peripheral.wrap("top")
- rednet.open("right")
- local serverID = 121
- local curPass = ""
- local pass
- local passLength = 0
- local id
- local msg
- local event
- local button
- local x
- local y
- function addNumber(number)
- if passLength+1 <= 10 then
- passLength = passLength+1
- curPass = curPass..number
- end
- end
- function delNumber()
- if passLength-1 >= 0 then
- passLength = passLength-1
- curPass = string.sub(curPass, -#curPass, #curPass-1)
- end
- end
- function blank()
- end
- local function mainScreen()
- mon.setTextScale(1)
- local yPos = 5
- mon.setBackgroundColor(colors.lightGray)
- mon.clear()
- mon.setCursorPos(1,1)
- btn.createScreen()
- mon.setBackgroundColor(colors.gray)
- for i = 1,5 do
- mon.setCursorPos(24,yPos)
- for i = 24,47 do
- mon.write(" ")
- end
- yPos = yPos+1
- end
- mon.setCursorPos(25, 7)
- mon.setBackgroundColor(colors.black)
- for i = 25,46 do
- mon.write(" ")
- end
- mon.setCursorPos(27,7)
- for i = 1,passLength do
- mon.write("*")
- end
- end
- function checkPass()
- rednet.send(serverID, curPass)
- curPass = ""
- passLength = 0
- mainScreen()
- id, msg, dis = rednet.receive(10)
- if id == serverID and msg == "Correct" then
- print("Correct")
- mon.clear()
- mon.setTextScale(4)
- btn.centerText(3,"Dont Move!!",colors.white)
- sleep(.5)
- mon.clear()
- btn.centerText(3,"Dont Move!!",colors.white)
- sleep(.5)
- rs.setOutput("left",true)
- sleep(1)
- rs.setOutput("right",true)
- sleep(2)
- rs.setOutput("right",false)
- sleep(1)
- rs.setOutput("left",false)
- else
- print("Incorrect")
- end
- end
- btn.fillTable("1",4,8,2,6,"1",addNumber,colors.green,true)
- btn.fillTable("2",10,14,2,6,"2",addNumber,colors.green,true)
- btn.fillTable("3",16,20,2,6,"3",addNumber,colors.green,true)
- btn.fillTable("4",4,8,8,12,"4",addNumber,colors.green,true)
- btn.fillTable("5",10,14,8,12,"5",addNumber,colors.green,true)
- btn.fillTable("6",16,20,8,12,"6",addNumber,colors.green,true)
- btn.fillTable("7",4,8,14,18,"7",addNumber,colors.green,true)
- btn.fillTable("8",10,14,14,18,"8",addNumber,colors.green,true)
- btn.fillTable("9",16,20,14,18,"9",addNumber,colors.green,true)
- btn.fillTable("0",10,14,20,24,"0",addNumber,colors.green,true)
- btn.fillTable("blank1",4,8,20,24," ",blank,colors.green,true)
- btn.fillTable("blank2",16,20,20,24," ",blank,colors.green,true)
- btn.fillTable("enter",24,47,11,15,"Enter",checkPass,colors.lime,true)
- btn.fillTable("delete",24,47,17,21,"Delete ",delNumber,colors.red,true)
- while true do
- mainScreen()
- event, button, x, y = os.pullEvent("monitor_touch")
- btn.checkClick(x,y)
- end
Advertisement
Add Comment
Please, Sign In to add comment