Posted 30 December 2014 - 02:10 PM
Hello everyone, im making a system called Magnet Systems, but the clock if getting on my nerves.
It is supposed to update every .5 seconds and then is supposed to draw the desktop again, but its only drawn once.
This is my code:
It is supposed to update every .5 seconds and then is supposed to draw the desktop again, but its only drawn once.
This is my code:
-- Desktop
w, h = term.getSize()
cWhite = 1
cOrange = 2
cMagenta = 4
cLightBlue = 8
cYellow = 16
cLime = 32
cPink = 64
cGray = 128
cLightGray = 256
cCyan = 512
cPurple = 1024
cBlue = 2048
cBrown = 4096
cGreen = 8192
cRed = 16384
cBlack = 32768
formattedTime = "0"
ostime = os.time()
function drawDesktop()
term.setBackgroundColor(cLightGray)
term.setTextColor(cRed)
term.clear()
term.setCursorPos(1,1)
term.setBackgroundColor(cGray)
term.clearLine()
term.setBackgroundColor(cRed)
print(" ")
term.setCursorPos(w-8, 1)
term.setBackgroundColor(cGray)
term.setTextColor(cBlue)
print(formattedTime)
end
function startClock()
while true do
formattedTime = textutils.formatTime(ostime, false)
drawDesktop()
sleep(1)
end
end
function drawSplash()
local frameone = paintutils.loadImage("/magnet/.magnetsplash1")
local frametwo = paintutils.loadImage("/magnet/.magnetsplash2")
paintutils.drawImage(frameone, 1, 1)
sleep(1)
paintutils.drawImage(frametwo, 1, 1)
sleep(1)
paintutils.drawImage(frameone, 1, 1)
sleep(1)
paintutils.drawImage(frametwo, 1, 1)
sleep(1)
end
drawSplash()
parallel.waitForAny(startClock)
The splash is drawn, then the desktop is drawn, but then the startClock function is supposed to keep drawing the desktop. But that is is not happening, can anyone help me?