Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local seconds = 12000 -- секунд
-
- local com = require("component")
- local gpu = com.gpu
- local w,h = gpu.getResolution()
- local nums = {}
- nums[0] = {"███", "█ █", "█ █", "█ █", "███"}
- nums[1] = {"██ ", " █ ", " █ ", " █ ", "███"}
- nums[2] = {"███", " █", "███", "█ ", "███"}
- nums[3] = {"███", " █", "███", " █", "███"}
- nums[4] = {"█ █", "█ █", "███", " █", " █"}
- nums[5] = {"███", "█ ", "███", " █", "███"}
- nums[6] = {"███", "█ ", "███", "█ █", "███"}
- nums[7] = {"███", " █", " █", " █", " █"}
- nums[8] = {"███", "█ █", "███", "█ █", "███"}
- nums[9] = {"███", "█ █", "███", " █", "███"}
- local function SplitNumber(num)
- local n1, n2
- if num >= 10 then
- n1, n2 = tostring(num):match("(%d)(%d)")
- n1, n2 = tonumber(n1), tonumber(n2)
- else
- n1, n2 = 0, num
- end
- return n1, n2
- end
- local function DrawNumbers(hh, mm, ss)
- local n1, n2, n3, n4, n5, n6
- n1, n2 = SplitNumber(hh)
- n3, n4 = SplitNumber(mm)
- n5, n6 = SplitNumber(ss)
- for i = 1, 5, 1 do
- local lineToDraw = nums[n1][i].." "..nums[n2][i].." : ".. nums[n3][i].." "..nums[n4][i].." : "..nums[n5][i].." "..nums[n6][i]
- gpu.set((w / 3), (h / 3) + i, lineToDraw)
- end
- end
- gpu.fill(1,1,w,h," ")
- while true do
- local hh, mm, ss
- for i = seconds, 1, -1 do
- mm = math.floor(i / 60)
- ss = i % 60
- hh = math.floor(mm / 60)
- mm = mm % 60
- DrawNumbers(hh, mm, ss)
- os.sleep(1)
- end
- -- выполнить код
- end
Add Comment
Please, Sign In to add comment