Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- speaker = peripheral.find("speaker")
- os.pullEvent = os.pullEventRaw
- monitor = peripheral.find("monitor")
- monitor.setTextScale(0.5)
- --Enter Code
- code = "11829"
- --
- term.redirect(monitor)
- width, height = term.getSize()
- term.setBackgroundColor(colors.black)
- term.clear()
- paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
- right = false
- term.setCursorPos(2, height - 5)
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- write("1")
- term.setCursorPos(4, height - 5)
- write("2")
- term.setCursorPos(6, height - 5)
- write("3")
- term.setCursorPos(2, height - 3)
- write("4")
- term.setCursorPos(4, height - 3)
- write("5")
- term.setCursorPos(6, height - 3)
- write("6")
- term.setCursorPos(2, height - 1)
- write("7")
- term.setCursorPos(4, height - 1)
- write("8")
- term.setCursorPos(6, height - 1)
- write("9")
- pass = ""
- redstone.setOutput("left",false)
- term.setTextColor(colors.black)
- term.setBackgroundColor(colors.gray)
- function display()
- while true do
- sleep(0.1)
- term.setCursorPos(2,height - 7)
- write(pass)
- end
- end
- function control()
- while true do
- repeat
- _, m, x, y = os.pullEvent("monitor_touch")
- if string.len(pass) < 5 and pass ~= code then
- if y == height - 5 then
- if x == 2 then
- pass = pass.."1"
- elseif x == 4 then
- pass = pass.."2"
- elseif x == 6 then
- pass = pass.."3"
- end
- elseif y == height - 3 then
- if x == 2 then
- pass = pass.."4"
- elseif x == 4 then
- pass = pass.."5"
- elseif x == 6 then
- pass = pass.."6"
- end
- elseif y == height - 1 then
- if x == 2 then
- pass = pass.."7"
- elseif x == 4 then
- pass = pass.."8"
- elseif x == 6 then
- pass = pass.."9"
- end
- end
- if pass == code then
- right = true
- end
- else
- pass = ""
- paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
- end
- until right == true
- right = false
- redstone.setOutput("back",true)
- pass = ""
- paintutils.drawLine(2,height - 7,6,height - 7,colors.gray)
- os.pullEvent("key")
- redstone.setOutput("back",false)
- end
- end
- parallel.waitForAll(control,display)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement