Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mouseWidth = 0
- mouseHeight = 0
- monitor3 = peripheral.wrap("monitor_5")
- monitor3.setBackgroundColor((colors.black))
- monitor3.clear()
- monitor3.setTextScale(.5)
- monitor3.setCursorPos(5,9)
- monitor3.write(" B3 ")
- monitor2 = peripheral.wrap("monitor_4")
- monitor2.setBackgroundColor((colors.black))
- monitor2.clear()
- monitor2.setTextScale(.5)
- monitor2.setCursorPos(5,9)
- monitor2.write(" B2 ")
- monitor1 = peripheral.wrap("monitor_6")
- monitor1.setBackgroundColor((colors.black))
- monitor1.clear()
- monitor1.setTextScale(.5)
- monitor1.setCursorPos(5,9)
- monitor1.write(" B1 ")
- function buttons()
- monitor1.setBackgroundColor((colors.lime))
- monitor1.setCursorPos(1,1)
- monitor1.write("Call")
- monitor1.setBackgroundColor((colors.blue))
- monitor1.setCursorPos(5,2)
- monitor1.write(" E3 ")
- monitor1.setBackgroundColor((colors.blue))
- monitor1.setCursorPos(5,3)
- monitor1.write(" E2 ")
- monitor1.setBackgroundColor((colors.blue))
- monitor1.setCursorPos(5,4)
- monitor1.write(" E1 ")
- monitor1.setBackgroundColor((colors.blue))
- monitor2.setBackgroundColor((colors.lime))
- monitor2.setCursorPos(1,1)
- monitor2.write("Call")
- monitor2.setBackgroundColor((colors.blue))
- monitor2.setCursorPos(5,2)
- monitor2.write(" E3 ")
- monitor2.setBackgroundColor((colors.blue))
- monitor2.setCursorPos(5,3)
- monitor2.write(" E2 ")
- monitor2.setBackgroundColor((colors.blue))
- monitor2.setCursorPos(5,4)
- monitor2.write(" E1 ")
- monitor2.setBackgroundColor((colors.blue))
- monitor3.setBackgroundColor((colors.lime))
- monitor3.setCursorPos(1,1)
- monitor3.write("Call")
- monitor3.setBackgroundColor((colors.blue))
- monitor3.setCursorPos(5,2)
- monitor3.write(" E3 ")
- monitor3.setBackgroundColor((colors.blue))
- monitor3.setCursorPos(5,3)
- monitor3.write(" E2 ")
- monitor3.setBackgroundColor((colors.blue))
- monitor3.setCursorPos(5,4)
- monitor3.write(" E1 ")
- monitor3.setBackgroundColor((colors.blue))
- end
- function floorB3()
- rs.setBundledOutput("left",colors.white)
- monitor1.setBackgroundColor((colors.red))
- monitor1.setCursorPos(5,2)
- monitor1.write(" E3 ")
- monitor2.setBackgroundColor((colors.red))
- monitor2.setCursorPos(5,2)
- monitor2.write(" E3 ")
- monitor3.setBackgroundColor((colors.red))
- monitor3.setCursorPos(5,2)
- monitor3.write(" E3 ")
- end
- function floorB2()
- rs.setBundledOutput("left",colors.gray)
- monitor1.setBackgroundColor((colors.red))
- monitor1.setCursorPos(5,3)
- monitor1.write(" E2 ")
- monitor2.setBackgroundColor((colors.red))
- monitor2.setCursorPos(5,3)
- monitor2.write(" E2 ")
- monitor3.setBackgroundColor((colors.red))
- monitor3.setCursorPos(5,3)
- monitor3.write(" E2 ")
- end
- function floorB1()
- rs.setBundledOutput("left",colors.purple)
- monitor1.setBackgroundColor((colors.red))
- monitor1.setCursorPos(5,4)
- monitor1.write(" E1 ")
- monitor2.setBackgroundColor((colors.red))
- monitor2.setCursorPos(5,4)
- monitor2.write(" E1 ")
- monitor3.setBackgroundColor((colors.red))
- monitor3.setCursorPos(5,4)
- monitor3.write(" E1 ")
- end
- buttons()
- function checkClickPosition()
- buttons()
- if mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 3 then
- print "b3"
- floorB3()
- elseif mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 4 then
- print "b2"
- floorB2()
- elseif mouseWidth > 5 and mouseWidth < 12 and mouseHeight == 5 then
- print "b1"
- floorB1()
- elseif mouseWidth < 5 and mouseHeight < 3 then
- if p1 == "monitor_3" then
- floorB3()
- elseif p1 == "monitor_4" then
- floorB2()
- elseif p1 == "monitor_0" then
- floorB1()
- end
- end
- monitor1.setBackgroundColor((colors.black))
- monitor2.setBackgroundColor((colors.black))
- monitor3.setBackgroundColor((colors.black))
- end
- -- event will be "monitor_touch"
- -- p1 will be the side the monitor is on (top)
- -- p2 is the width postion of the click
- -- p3 is the height postition of the click
- repeat
- -- repeat runs a loop of code.
- event,p1,p2,p3 = os.pullEvent()
- if event=="monitor_touch" then
- mouseWidth = p2
- mouseHeight = p3
- checkClickPosition()
- end
- until event=="char" and p1==("x")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement