summaryrefslogtreecommitdiff
path: root/tricks/marquee.lua
blob: 546f374a8af25b4fa537c083ffa58b1f8cd4aeec (plain)
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
-- marquee
function Marquee(mString, mDelay)
    local length = string.len(mString)
 
    for i = 1,length+12 do
 
        local mRight = ""
        local mIddle = " "
        local mLeft  = ""
 
        -- right
        for j = i-5,i do
            if j <= 0 then mRight = mRight .. " " end
            if j > 0 and j <= length then mRight = mRight .. string.sub(mString, j, j) end
            if j > length then mRight = mRight .. " " end
        end
        -- middle
        j = i - 6
        if j > 0 and j <= length then mIddle = string.sub(mString, j , j) end
        -- left
        for j = i-12,i-7 do
            if j <= 0 then mLeft = mLeft .. " " end
            if j > 0 and j <= length then mLeft = mLeft .. string.sub(mString, j, j) end
            if j > length then mLeft = mLeft .. " " end
        end
 
 
        SetRightDigits(mRight)
        SetGearDigit(mIddle)
        SetLeftDigits(mLeft)
 
        SLISendReport(1)
        SLISleep(mDelay)
    end
end