Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- imgWidth = 71
- imgHeight = 33
- if fs.exists("clocks") then
- imgs = paintutils.loadImage("clocks")
- else
- shell.run("pastebin get NkF2vfMN clocks")
- --Assumes you have http enabled
- imgs = paintutils.loadImage("clocks")
- end
- local function readLines(sPath)
- local file = fs.open(sPath, "r")
- if file then
- local tLines = {}
- local sLine = file.readLine()
- while sLine do
- table.insert(tLines, sLine)
- sLine = file.readLine()
- end
- file.close()
- return tLines
- end
- return nil
- end
- function drawImg(index, x,y, dark)
- index = index - 1
- curY = 0
- for yy = index*imgHeight+1, (index+1)*imgHeight do
- for xx = 1, imgWidth do
- color = imgs[yy][xx]
- if not dark then
- if color == '0' then
- color = 'F'
- end
- if color == 'b' then
- color = '0'
- end
- end
- paintutils.drawPixel(x+xx-1, y+curY, color)
- end
- curY = curY + 1
- end
- end
- mon = peripheral.wrap("back")
- term.redirect(mon)
- term.clear()
- function toint(n)
- local s = tostring(n)
- local i, j = s:find('%.')
- if i then
- return tonumber(s:sub(1, i-1))
- else
- return n
- end
- end
- function main()
- while true do
- local time = os.time()
- local hour = toint(time)
- if hour > 12 then
- hour = hour - 12
- end
- drawImg(hour, 1,1, hour <= 7 or hour >= 19)
- os.sleep(4)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement