Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("top")
- term.redirect(mon)
- if fs.exists("bg") then
- print("Loading Background...")
- else
- print("Downloading Background...")
- shell.run("pastebin get ZTPGu6zq bg")
- print("Loading Background Image")
- sleep(3)
- end
- bg = paintutils.loadImage("bg")
- function drawBG()
- term.clear()
- term.setCursorPos(1,1)
- paintutils.drawImage(bg,1,1)
- end
- function fillIn()
- xH = 1
- mon.setCursorPos(1,xH)
- for i = 1,3 do
- for i = 1,2 do
- mon.setBackgroundColor(colors.white)
- repeat
- xC,yC = mon.getCursorPos()
- mon.write(" ")
- until xC == 6
- mon.setCursorPos(12,xH)
- end
- xH = xH+1
- mon.setCursorPos(1,xH)
- end
- end
- function getDigit()
- if x == 4 and y == 4 then return 1
- elseif x == 7 and y == 4 then return 2
- elseif x == 11 and y == 4 then return 3
- elseif x == 4 and y == 6 then return 4
- elseif x == 7 and y == 6 then return 5
- elseif x == 11 and y == 6 then return 6
- elseif x == 4 and y == 7 then return 7
- elseif x == 7 and y == 7 then return 8
- elseif x == 11 and y == 7 then return 9
- elseif x == 7 and y == 9 then return 0
- end
- end
- function number()
- if y >= 1 and y <= 3 then
- --
- if x >= 1 and x <= 6 then
- return 1
- elseif x >= 7 and x <= 12 then
- return 2
- elseif x >= 13 and x <= 17 then
- return 3
- end
- -- 1-2-3 ^
- elseif y >= 4 and y <= 6 then
- --
- if x >= 1 and x <= 6 then
- return 4
- elseif x >= 7 and x <= 12 then
- return 5
- elseif x >=13 and x <= 17 then
- return 6
- end
- elseif y >= 7 and y <= 9 then
- -- 4-5-6 ^
- if x >= 1 and x <= 6 then
- return 7
- elseif x >= 7 and x <= 12 then
- return 8
- elseif x >= 13 and x <=17 then
- return 9
- -- 7-8-9 ^
- end
- elseif y >= 10 then return 0
- end
- end
- function draw()
- mon.setBackgroundColor(colors.white)
- mon.setTextColor(colors.black)
- mon.setTextScale(0.9)
- mon.clear()
- mon.setCursorPos(4,3)
- mon.write("[1][2][3]")
- mon.setCursorPos(4,5)
- mon.write("[4][5][6]")
- mon.setCursorPos(4,7)
- mon.write("[7][8][9]")
- mon.setCursorPos(4,9)
- mon.write(" [0]")
- end
- function auth()
- input = {}
- for i = 1,4 do
- event,side,x,y = os.pullEvent("monitor_touch")
- table.insert(input,tonumber(number()))
- end
- result = tonumber(table.concat(input))
- end
- while true do
- drawBG()
- auth()
- if result == 4002 then
- print("Correct!")
- rs.setOutput("bottom",true)
- sleep(2)
- rs.setOutput("bottom",false)
- else
- print(result.." is incorrect!")
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement