1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
function F.lookahead_3(dep3t, arr2t, dep2t, arr1t, dep1t)
if event.ext_int then
if event.message=="dep3" then
time2 = dep3t
elseif event.message=="arr2" then
time2 = arr2t
elseif event.message=="dep2" then
time1 = dep2t
time2 = nil
elseif event.message=="arr1" then
time1 = arr1t
elseif event.message=="dep1" then
time0 = dep1t
time1 = nil
else
time0 = nil
end
tmseq = ((tmseq or 0)+1)%10
elseif event.int and event.message==tmseq then
if time0 then time0 = time0 - 5 end
if time1 then time1 = time1 - 5 end
if time2 then time2 = time2 - 5 end
end
if (time0 or time1 or time2) and (time0 or time1 or time2)>=0 then
digiline_send("disp", F.make_big_number_str(time0 or time1 or time2))
if (not event.int or event.message==tmseq) then
interrupt(5,tmseq)
end
else
digiline_send("disp", " | | ----- -----")
end
digiline_send("dinf", (time2 or "nil") .. " | "..(time1 or "nil") .. " | "..(time0 or "nil") .. " | ")
end
local function t(tab)
for i=0,9 do
local s = ""
for p=1,5 do
s=s..(string.sub(tab[i], p, p)=="#" and "8" or "~")
end
tab[i] = s
end
return tab
end
local digitl1 = t({
[0] = "#####", [1] = " #", [2] = "#####", [3] = "#####", [4] = "# #",
[5] = "#####", [6] = "#####", [7] = "#####", [8] = "#####", [9] = "#####"})
local digitl2 = t({
[0] = "# #", [1] = " #", [2] = " #", [3] = " #", [4] = "# #",
[5] = "# ", [6] = "# ", [7] = " #", [8] = "# #", [9] = "# #"})
local digitl3 = t({
[0] = "# #", [1] = " #", [2] = "#####", [3] = "#####", [4] = "#####",
[5] = "#####", [6] = "#####", [7] = " #", [8] = "#####", [9] = "#####"})
local digitl4 = t({
[0] = "# #", [1] = " #", [2] = "# ", [3] = " #", [4] = " #",
[5] = " #", [6] = "# #", [7] = " #", [8] = "# #", [9] = " #"})
local digitl5 = t({
[0] = "#####", [1] = " #", [2] = "#####", [3] = "#####", [4] = " #",
[5] = "#####", [6] = "#####", [7] = " #", [8] = "#####", [9] = "#####"})
function F.make_big_number_str(num)
local d1 = tonumber(string.sub(num,1,1))
local d2 = tonumber(string.sub(num,2,2))
if not d2 then
d2 = d1
d1 = 0
end
if not d1 then d1=0 end
return "" .. digitl1[d1] .. " " .. digitl1[d2] .. " | "
.. digitl2[d1] .. " " .. digitl2[d2] .. " | "
.. digitl3[d1] .. " " .. digitl3[d2] .. " | "
.. digitl4[d1] .. " " .. digitl4[d2] .. " | "
.. digitl5[d1] .. " " .. digitl5[d2] .. ""
end
|