Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rs.setBundledOutput("bottom", colors.red+colors.blue+colors.lime+colors.yellow)
- m = peripheral.wrap("back")
- function writePos(x,y,txt)
- m.setCursorPos(x,y)
- m.write(txt)
- end
- function writeBox(name,x,y,color)
- m.setCursorPos(x,y)
- m.setBackgroundColor(color)
- m.write(" ")
- m.setCursorPos(x,y+1)
- m.write(" ")
- m.setCursorPos(x,y+2)
- m.write(" ")
- m.setCursorPos(x+2,y+1)
- m.write(name)
- end
- function RemainingTime()
- writePos(4,12,"Remaining Time: 30 sec.")
- sleep(10)
- writePos(4,12,"Remaining Time: 20 sec.")
- sleep(10)
- writePos(4,12,"Remaining Time: 10 sec.")
- sleep(10)
- writePos(4,12,"Remaining Time: 0 sec.")
- sleep(3)
- shell.run("reboot")
- end
- writePos(7,1,"Sappling Selector")
- writeBox("Oak",5,4,colors.red)
- writeBox("Spruce",17,4,colors.red)
- writeBox("Birch",5,8,colors.red)
- writeBox("Rubber",17,8,colors.red)
- while true do
- event,side,x,y = os.pullEvent()
- print(x)
- print(y)
- if event == "monitor_touch" then
- if (x>4 and x<15 and y>3 and y<7) then
- writeBox("Oak",5,4,colors.lime)
- rs.setBundledOutput("bottom",colors.blue+colors.lime+colors.yellow)
- RemainingTime()
- end
- if (x>16 and x< 27 and y>3 and y<7) then
- writeBox("Spruce",17,4,colors.lime)
- rs.setBundledOutput("bottom",colors.red+colors.lime+colors.yellow)
- RemainingTime()
- end
- if (x>4 and x<15 and y>7 and y<18) then
- writeBox("Birch",5,8,colors.lime)
- rs.setBundledOutput("bottom",colors.red+colors.blue+colors.yellow)
- RemainingTime()
- end
- if (x>16 and x<27 and y>7 and y<18) then
- writeBox("Rubber",17,8,colors.lime)
- rs.setBundledOutput("bottom",colors.red+colors.blue+colors.lime)
- RemainingTime()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement