Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("c")
- m = peripheral.find("monitor")
- ae = true
- plaz = true
- sus = true
- kezza = true
- def = colors.black --Wished default color
- background = colors.lightGray -- The background color
- on = colors.lime -- "on" color
- off = colors.red -- "off" color
- toggle = true -- background or text colors
- -- off the current state
- -- Off limits below here unless ur experienced. --
- rednet.open("right")
- function colDef()
- if toggle == true then
- m.setBackgroundColor(background)
- else
- m.setTextColor(def)
- end
- end
- function colOn()
- if toggle == true then
- m.setBackgroundColor(on)
- else
- m.setTextColor(on)
- end
- end
- function colOff()
- if toggle == true then
- m.setBackgroundColor(off)
- else
- m.setTextColor(off)
- end
- end
- function disp()
- m.setCursorPos(1,1)
- m.setTextColor(colors.black)
- c.mWrite("AE:")
- m.setCursorPos(1,2)
- m.write("On/Off")
- m.setCursorPos(1,4)
- c.mWrite("Plaz")
- m.setCursorPos(1,5)
- c.mWrite(" Power:")
- m.setCursorPos(1,6)
- m.write("On/Off")
- m.setCursorPos(1,8)
- c.mWrite("Sus")
- m.setCursorPos(1,9)
- c.mWrite("Power:")
- m.setCursorPos(1,10)
- m.write("On/Off")
- m.setCursorPos(1,12)
- c.mWrite("Kezza")
- m.setCursorPos(1,13)
- c.mWrite("Power:")
- m.setCursorPos(1,14)
- m.write("On/Off")
- end
- function AEButt()
- if x >= 1 and x < 8 and y == 2 then
- print("Registered at: "..x.. "and at :".. y)
- if ae == false then
- ae = true
- rednet.send(69,"on")
- m.setCursorPos(1,2)
- colOn()
- m.write("On")
- m.setCursorPos(4,2)
- colDef()
- m.write("Off")
- elseif ae == true then
- ae = false
- rednet.send(69,"off")
- m.setCursorPos(1,2)
- colDef()
- m.write("On")
- colOff()
- m.setCursorPos(4,2)
- m.write("Off")
- end
- end
- end
- function plazPower()
- if x > 1 and x < 7 and y == 6 then
- print("Reg: "..x .." ".. y)
- if plaz == true then
- plaz = false
- rednet.send(71, "off")
- print("Plaz Off")
- m.setCursorPos(4,6)
- colOff()
- m.write("Off")
- m.setCursorPos(1,6)
- colDef()
- m.write("On")
- elseif plaz == false then
- plaz = true
- rednet.send(71, "on")
- print("Plaz: ON")
- m.setCursorPos(1,6)
- colOn()
- m.write("On")
- m.setCursorPos(4,6)
- colDef()
- m.write("Off")
- end
- end
- end
- function susPower()
- if x > 1 and x < 7 and y == 10 then
- print("Reg: ".. x.." "..y)
- if sus == true then
- sus = false
- rednet.send(72, "off")
- colOff()
- m.setCursorPos(4,10)
- m.write("Off")
- colDef()
- m.setCursorPos(1,10)
- m.write("On")
- elseif sus == false then
- sus = true
- rednet.send(72, "on")
- colOn()
- m.setCursorPos(1,10)
- m.write("On")
- colDef()
- m.setCursorPos(4,10)
- m.write("Off")
- end
- end
- end
- function kezzaPower()
- if x > 1 and x < 7 and y == 14 then
- print("Reg: "..x.." "..y)
- if kezza == false then
- kezza = true
- rednet.send(73, "on")
- colOn()
- m.setCursorPos(1,14)
- m.write("On")
- colDef()
- m.setCursorPos(4,14)
- m.write("Off")
- elseif kezza == true then
- kezza = false
- rednet.send(73, "off")
- colDef()
- m.setCursorPos(1,14)
- m.write("On")
- m.setCursorPos(4,14)
- colOff()
- m.write("Off")
- end
- end
- end
- m.setBackgroundColor(background)
- c.mClear()
- disp()
- while true do
- event, side, x, y = os.pullEvent("monitor_touch")
- if x == 1 and x == 1 and y == 1 then
- shell.run("edit but")
- end
- AEButt()
- plazPower()
- susPower()
- kezzaPower()
- sleep(0.5)
- end
Add Comment
Please, Sign In to add comment