Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- t = term.setTextColor
- local monitor = peripheral.find("monitor")
- local timer = os.startTimer(1)
- term.redirect(monitor)
- local p ={
- p ="Temps depuis le redemarrage du serveur."
- }
- function clear()
- term.clear()
- term.setCursorPos(1,1)
- end
- function clock()
- local secondes = 0
- local minutes = 0
- local heures = 0
- while true do
- shell.run("clear")
- t(colors.red)
- print(heures,"h", ":", minutes,"m", ":", secondes,"s")
- t(colors.green)
- print(p.p)
- local event,timerId = os.pullEvent("timer")
- if timerId == timer then
- print(secondes)
- secondes = secondes + 1
- if secondes == 60 then
- minutes = minutes + 1
- secondes = 0
- end
- if minutes == 60 then
- heures = heures + 1
- minutes = 0
- secondes = 0
- end
- timer = os.startTimer(1)
- end
- end
- end
- clear()
- clock()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement