[Question]Clear Line Flickering
Started by nateracecar5, May 21 2013 09:40 PM
4 replies to this topic
#1
Posted 21 May 2013 - 09:40 PM
Yes it's me again. You can tell I'm a noob.
Anyway, the term.clearLine() function is "flickering" meaning it is only visible long enough for you to see it flicker. Would someone have a better way of clearing a line without the flicker?
#2
Posted 21 May 2013 - 10:12 PM
Can you give us more detail of what you mean? Also, post the program in which this happens.
#3
Posted 21 May 2013 - 10:42 PM
Unless you give code, we can't help. Gotta see the problem
#4
Posted 22 May 2013 - 06:33 AM
Okay here you are.
It's the downloadFiles() function that is "flickering."
--Setting the colors
term.setBackgroundColor(colors.white)
term.setTextColor(colors.cyan)
term.clear()
term.setCursorPos(1,1)
loading = "yes"
local installing = true
--Functions
local function centerPrint(text)
local x, y = term.getSize()
local x2, y2 = term.getCursorPos()
term.setCursorPos(math.ceil((x/2) -(text:len()/2)), y2)
write(text)
term.setCursorPos(1,1)
end
local function load(yLoc)
w, h = term.getSize()
local x2, y2 = term.getCursorPos()
loc = math.ceil(w/2)
loc2 = yLoc
while loading == "yes" do
term.setCursorPos(loc-3, loc2)
print("|----|")
sleep(0.5)
term.setCursorPos(loc-3, loc2)
print("|O---|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|-O--|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|--O-|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|---O|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|--O-|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|-O--|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
print("|O---|")
term.setCursorPos(loc-3, loc2)
sleep(0.5)
return
end
end
function downloadFiles()
w, h = term.getSize()
term.setCursorPos(1, h-1)
if fs.exists("/RedOS") then
fs.delete("/RedOS")
end
shell.run("pastebin", "get", "5U3kbqWp", "RedOS")
term.clearLine()
term.setCursorPos(1, 10)
term.clearLine()
term.setCursorPos(1, 11)
term.clearLine()
term.setCursorPos(1, h-1)
term.clearLine()
sleep(5)
installing = false
loading = "no"
end
--Main Code
centerPrint("RedOS Installer")
term.setCursorPos(1, 4)
centerPrint("Installing Files....")
parallel.waitForAny(downloadFiles, function() load(9) end)
term.clear()
centerPrint("Installed!")
sleep(2)
term.setCursorPos(1,1)
term.setBackgroundColor(colors.black)
term.clear()
It's the downloadFiles() function that is "flickering."
#5
Posted 22 May 2013 - 06:49 AM
Never mind, I just changed it from pastebin to http, so now it is all fine. Could someone lock this thread?
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











