Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local title = "Spawn Oxygen"
- local monitorSide = "right"
- local redstoneSide = "left"
- function pullRedstone()
- os.pullEvent("redstone")
- end
- function sleepASec()
- sleep(1)
- end
- while (true) do
- mon = peripheral.wrap(monitorSide)
- mon.clear()
- sizeX,sizeY = mon.getSize()
- titlePos = math.floor(sizeX/2) - math.floor(#title / 2)
- if (titlePos < 1) then
- titlePos = 1
- end
- if (redstone.getInput(redstoneSide)) then
- oxyStatus = colors.lightBlue
- else
- oxyStatus = colors.red
- end
- mon.setCursorPos(titlePos+1,1)
- mon.write(title)
- mon.setBackgroundColor(oxyStatus)
- for x = 2, sizeX - 1, 1 do
- for y = 3, sizeY - 1, 1 do
- mon.setCursorPos(x,y)
- mon.write(" ")
- end
- end
- mon.setBackgroundColor(colors.black)
- parallel.waitForAny(sleepASec, pullRedstone)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement