Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- monitor = peripheral.wrap("right")
- m = peripheral.wrap("right")
- function button(xb,yb,cb,ct,t)
- m.setCursorPos(xb,yb)
- m.setBackgroundColor(cb)
- m.setTextColor(ct)
- m.write(t)
- end
- function click(xmin,xmax,ymin,ymax)
- if event=="monitor_touch" and xPos>=xmin and xPos<=xmax and yPos>=ymin and yPos<=ymax then
- return true
- else
- return false
- end
- end
- function bar()
- button(1,16,colors.lime,colors.black," (!) ")
- button(8,16,colors.green,colors.black," [] ")
- button(28,16,colors.lime,colors.black,"</>")
- button(31,16,colors.yellow,colors.white,"Lua")
- end
- function clearDesk()
- menu = 0
- m.setBackgroundColor(colors.black)
- m.clear()
- m.setTextScale(2.5)
- m.setTextColor(colors.white)
- desk = paintutils.loadImage("desk")
- paintutils.drawImage(desk,8,2)
- button(33,3,colors.red,colors.white,"<")
- button(33,4,colors.brown,colors.white,"<")
- bar()
- end
- clearDesk()
- os.startTimer(0.5)
- function shutDown()
- m.setCursorPos(13,12)
- m.setBackgroundColor(colors.green)
- m.setTextColor(colors.black)
- m.write("Shutdown?")
- m.setCursorPos(13,13)
- m.write(" ")
- m.setBackgroundColor(colors.lime)
- m.write("Yes")
- m.setBackgroundColor(colors.green)
- m.write(" ")
- m.setBackgroundColor(colors.lime)
- m.write("No")
- m.setBackgroundColor(colors.green)
- m.write(" ")
- end
- function editCode()
- m.setCursorPos(13,12)
- m.setBackgroundColor(colors.green)
- m.setTextColor(colors.black)
- m.write("Edit Code?")
- m.setCursorPos(13,13)
- m.write(". ")
- m.setBackgroundColor(colors.lime)
- m.setCursorPos(14,13)
- m.write("Yes")
- m.setCursorPos(20,13)
- m.write("No")
- end
- function nether()
- m.setBackgroundColor(colors.red)
- m.setCursorPos(26,3)
- m.setTextColor(colors.white)
- m.write("> ")
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(27,3)
- m.write("ON")
- m.setCursorPos(30,3)
- m.write("OFF")
- end
- function spawner()
- button(26,4,colors.brown,colors.white,"> ")
- button(27,4,colors.purple,colors.white,"ON")
- button(30,4,colors.purple,colors.white,"OFF")
- end
- while true do
- event, side, xPos, yPos = os.pullEvent()
- if click(8,27,16,16) then
- clearDesk()
- end
- if click(1,7,16,16) and menu ~= 2 then
- menu = 1
- shutDown()
- end
- if menu == 1 and click(13,15,13,13) then
- os.shutdown()
- elseif menu == 1 and click(18,19,13,13) then
- clearDesk()
- end
- if click(28,30,16,16) and menu ~= 1 then
- menu = 2
- editCode()
- end
- if menu==2 and click(14,16,13,13) then
- monitor.setBackgroundColor(colors.black)
- monitor.setTextColor(colors.lime)
- monitor.clear()
- monitor.setCursorPos(10,6)
- monitor.write("Reboot after")
- monitor.setCursorPos(12,7)
- monitor.write("editing!")
- shell.run("code")
- elseif menu == 2 and click(20,21,13,13) then
- clearDesk()
- end
- if menu==0 and click(30,33,16,16) then
- monitor.clear()
- monitor.setCursorPos(11,6)
- monitor.setTextColor(colors.yellow)
- monitor.setBackgroundColor(colors.black)
- monitor.write("Now in Lua")
- shell.run("dolua")
- end
- if menu==0 and click(33,33,3,3) then
- menu=3
- nether()
- end
- if menu==3 and click(27,28,3,3) then
- rs.setBundledOutput("back",colors.white)
- elseif menu==3 and click(30,32,3,3) then
- rs.setBundledOutput("back",0)
- elseif menu==3 and click(26,26,3,3) then
- clearDesk()
- end
- if menu==0 and click(33,33,4,4) then
- menu=4
- spawner()
- end
- if menu==4 and click(30,32,4,4) then
- rs.setBundledOutput("back",colors.orange)
- elseif click(26,26,4,4) then
- clearDesk()
- end
- if event=="timer" then
- clock=textutils.formatTime(os.time(),true)
- m.setCursorPos(28,1)
- m.setTextColor(colors.green)
- m.setBackgroundColor(colors.black)
- m.write(clock)
- os.startTimer(0.5)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement