Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- foundMonitor = false
- mw, mh = 0
- spawners = {}
- spawners[0] = false
- spawners[1] = true
- red = 16384
- green = 32
- scale = 3
- function drawBox(x,y,w,h,c, label)
- x = x/scale
- y = y/scale
- w = w/scale
- h = h/scale
- i = x
- _w = w + x
- _h = h+y
- while i < _w do
- j = y
- while j < _h do
- paintutils.drawPixel(i,j,c)
- j = j+1
- end
- i = i+1
- end
- mon.setCursorPos(x+w/2 - 0.5, y+h/w - 0.5)
- mon.write(label)
- end
- function drawGUI()
- mon.setCursorPos(1,1)
- if spawners[0] == false then
- drawBox(3,3,10,6, red, "OFF")
- else
- drawBox(3,3,10,6, green, "ON")
- end
- if spawners[1] == false then
- drawBox(3,12,10,6, red, "OFF")
- else
- drawBox(3,12,10,6, green, "ON")
- end
- end
- function update()
- if spawners[0] == true then spawners[0] = false
- else spawners[0] = true
- end
- function init()
- if peripheral.isPresent("bottom") then
- mon = peripheral.wrap("bottom")
- mw, mh = mon.getSize()
- mon.setBackgroundColor(1)
- mon.setTextScale(scale)
- mon.clear()
- term.redirect(mon)
- foundMonitor = true
- else
- foundMonitor = false
- print("Monitor not found - Aborting")
- end
- if foundMonitor == true then
- while true do
- update()
- drawGUI()
- sleep(1)
- end
- term.restore()
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment