Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local sizemul = 1
- local txthi = 2
- local widsize = 80
- local hisize = 10
- hisize = hisize * txthi
- local dedwid = 2
- local dedhi = 5
- os.loadAPI("AndysPrograms/gltime/api/getmnth")
- local mineminute = 60 / 72
- mineminute = mineminute * 0.999
- local sizediv = 1
- widsize = widsize / sizediv
- hisize = hisize / sizediv
- local scaletsize = sizemul / sizediv
- local canvas = peripheral.wrap("back").canvas()
- canvas.clear() -- Get rid of our previous clock
- local group = canvas.addGroup({ 0, 0 })
- -- Look, we add items to our group instead
- --group.addRectangle(0, 0, widsize, hisize, 0xFF000064)
- local text = group.addText({ 5, 5 }, "")
- local text2 = group.addText({ 5, 5 }, "")
- text.setScale(scaletsize)
- text.setColour(255,1,255)
- local x, y, dx, dy = 0, 0, 5, 5
- -- Compute the dimensions we can move within
- local width, height = canvas.getSize()
- width = width - widsize
- height = height - hisize
- width = width - dedwid
- height = height - dedhi
- y = height
- while true do
- time_st = os.epoch()
- local _, day, month, _ = getmnth.getmnth()
- print(os.epoch())
- group.setPosition(x, y)
- if true then
- otftim2 = string.gsub(textutils.formatTime( os.time(), true ), ":", "")
- --print(otftim2)
- --print(tonumber(otftim2))
- if tonumber(otftim2) >= 1600 and tonumber(otftim2) < 1800 then
- text.setColour(252, 136, 3)
- elseif tonumber(otftim2) >= 1800 and tonumber(otftim2) <= 2359 then
- text.setColour(191, 72, 61)
- elseif tonumber(otftim2) >= 0 and tonumber(otftim2) <= 600 then
- text.setColour(191, 72, 61)
- else
- text.setColour(255, 255, 255)
- end
- end
- -- And update the time
- time_nospace_zero = string.gsub(textutils.formatTime(os.time(), false), " ", " ")
- time_nospace_10error = string.gsub(time_nospace_zero, "0:", "12:")
- time_nospace = string.gsub(time_nospace_10error, "112:", "10:")
- text.setText(time_nospace)
- text2.setText("\n"..day.." "..month)
- if time_en == nil then
- time_sub = 0
- end
- mineminute = 60 / 72
- time_en = os.epoch()
- time_sub = time_en - time_st
- if time_sub < 0 then
- time_sub = time_sub / -1
- end
- mineminute = mineminute - (time_sub / 1000)
- sleep(mineminute)
- end
Add Comment
Please, Sign In to add comment