Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.pullEvent = os.pullEventRaw
- sleep(0.1)
- shell.switchTab(2)
- m = peripheral.wrap("top")
- m.clear()
- m.setTextScale(1.5)
- m.setBackgroundColor(colors.black)
- m.setTextColor(colors.white)
- inp = {}
- sPos = 4
- function mGUI()
- gui = {
- [[ wo (5x4) ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- [[ ]],
- }
- m.setTextColor(colors.white)
- for i = 1,10 do
- m.setCursorPos(1,i)
- if i == 3 then
- m.setTextColor(colors.white)
- end
- m.write(gui[i])
- end
- m.setCursorPos(2,1)
- m.setBackgroundColor(colors.lime)
- m.setTextColor(colors.white)
- m.write("wo")
- end
- function open()
- if autoReset then
- if waitTime == 0 then waitTime = 2 end
- sleep(waitTime)
- rs.setOutput(redstoneSide,false)
- os.reboot()
- else
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextScale(5)
- m.setCursorPos(1,1)
- m.write("<")
- ev, side, xPos, yPos = os.pullEvent("monitor_touch")
- rs.setOutput(redstoneSide,false)
- os.reboot()
- end
- end
- function checkInp()
- if #inp == #code then
- for f = 1,#code do
- if inp[f] == code[f] then
- if f == #code then
- m.setCursorPos(3,4)
- m.setBackgroundColor(colors.lime)
- m.write(" CORRECT! ")
- rs.setOutput(redstoneSide,true)
- open()
- end
- else
- m.setCursorPos(3,4)
- m.setBackgroundColor(colors.red)
- m.write("WRONG CODE!")
- shell.run("test")
- sleep(3)
- os.reboot()
- end
- end
- else
- m.setCursorPos(3,4)
- m.setBackgroundColor(colors.red)
- m.write("WRONG CODE!")
- shell.run("test")
- sleep(3)
- os.reboot()
- end
- end
- function input()
- mGUI()
- while true do
- ev, side, xPos, yPos = os.pullEvent("monitor_touch")
- if ev == "monitor_touch" then
- if xPos > 1 and xPos < 4 and yPos == 1 then
- table.insert(inp,wo)
- m.setCursorPos(sPos,4)
- shell.run("images/wo")
- elseif xPos > 6 and xPos < 10 and yPos == 6 then
- table.insert(inp,2)
- m.setCursorPos(sPos,4)
- sPos = sPos+1
- elseif xPos > 10 and xPos < 14 and yPos == 6 then
- table.insert(inp,wo)
- shell.run("images/wo")
- elseif xPos > 3 and xPos < 5 and yPos == 7 then
- table.insert(inp,4)
- m.setCursorPos(sPos,4)
- sPos = sPos+1
- elseif xPos > 7 and xPos < 9 and yPos == 7 then
- table.insert(inp,5)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 11 and xPos < 13 and yPos == 7 then
- table.insert(inp,6)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 3 and xPos < 5 and yPos == 8 then
- table.insert(inp,7)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 7 and xPos < 9 and yPos == 8 then
- table.insert(inp,8)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 11 and xPos < 13 and yPos == 8 then
- table.insert(inp,9)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 3 and xPos < 5 and yPos == 9 then
- inp = {}
- m.setCursorPos(3,4)
- m.write(" ")
- sPos = 4
- elseif xPos > 7 and xPos < 9 and yPos == 9 then
- table.insert(inp,0)
- m.setCursorPos(sPos,4)
- m.write("*")
- sPos = sPos+1
- elseif xPos > 11 and xPos < 13 and yPos == 9 then
- checkInp()
- end
- end
- end
- end
- input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement