Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local input = nil
- local rOut = "back"
- local rOn = true
- local mon = peripheral.wrap("right")
- local launching = false
- local mX, mY = mon.getSize()
- function centerText(monitor, userString)
- y = mY/2
- x = math.floor(mX/2) - math.floor(string.len(userString)/2)
- monitor.setCursorPos(x, y)
- monitor.write(UserString)
- end
- function redstoneChange()
- if rOn then
- -- print("Redstone on")
- rs.setOutput(rOut, true)
- else
- -- print("Redstone off")
- rs.setOutput(rOut, false)
- end
- end
- function monitorTimer()
- --mon.clear()
- --mon.setTextScale(2)
- --print("working")
- -- print("Monitor Timer")
- for i = 0, 25 do
- if (i == 5) or (i < 5) then
- mon.clear()
- mon.setTextColor(colors.green)
- print(25 - i)
- centerText(mon, 25 - i)
- elseif (i == 15) or (i < 15) then
- mon.clear()
- mon.setTextColor(colors.orange)
- print(25 -i)
- centerText(mon, 25 - i)
- elseif (i == 25) or (i < 25) then
- mon.clear()
- mon.setTextColor(colors.red)
- print(25 - i)
- centerText(mon, 25 - i)
- else
- mon.clear()
- mon.setTextColor(colors.white)
- print(15 - i)
- centerText(mon, 15 - i)
- end
- i= i + 1
- sleep(1)
- end
- end
- redstoneChange()
- while true do
- -- input = read()
- -- if input ~= nil or input ~= "" then
- -- if input == "open" then
- os.pullEvent("redstone")
- launching = rs.getInput("left")
- if launching then
- mon.clear()
- rOn = false
- redstoneChange()
- monitorTimer()
- rOn = true
- redstoneChange()
- end
- -- end
- -- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement