Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function displayTime(time)
- minutes = 0
- while time >= 60 do
- time = time-60
- minutes = minutes + 1
- end
- seconds = time
- if minutes < 10 then
- minutes = "0"..tostring(minutes)
- else
- minutes = tostring(minutes)
- end
- if seconds < 10 then
- seconds = "0"..tostring(seconds)
- else
- seconds = tostring(seconds)
- end
- return minutes..":"..seconds
- end
- timer = 1200
- monitor_1 = peripheral.wrap("back")
- monitor_2 = peripheral.wrap("monitor_0")
- monitor_1.setTextScale(5)
- monitor_2.setTextScale(5)
- xSize, ySize = monitor_1.getSize()
- while true do
- if timer < 0 then
- monitor_1.setBackgroundColor(colors.white)
- monitor_2.setBackgroundColor(colors.white)
- monitor_1.setTextColor(colors.black)
- monitor_2.setTextColor(colors.black)
- text = "Time!"
- else
- text = displayTime(timer)
- end
- monitor_1.clear()
- monitor_2.clear()
- monitor_1.setCursorPos(xSize/2-(string.len(text)/2)+1,ySize/2+1)
- monitor_2.setCursorPos(xSize/2-(string.len(text)/2)+1,ySize/2+1)
- monitor_1.write(text)
- monitor_2.write(text)
- timer = timer - 1
- sleep(1)
- if timer < -1 then
- os.pullEvent("key")
- monitor_1.setBackgroundColor(colors.black)
- monitor_2.setBackgroundColor(colors.black)
- monitor_1.setTextColor(colors.white)
- monitor_2.setTextColor(colors.white)
- monitor_1.clear()
- monitor_2.clear()
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement