This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
nateracecar5's profile picture

[Question]Clear Line Flickering

Started by nateracecar5, 21 May 2013 - 08:40 PM
nateracecar5 #1
Posted 21 May 2013 - 10:40 PM
Yes it's me again. You can tell I'm a noob. :P/> 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?
Shnupbups #2
Posted 21 May 2013 - 11:12 PM
Can you give us more detail of what you mean? Also, post the program in which this happens.
ElvishJerricco #3
Posted 21 May 2013 - 11:42 PM
Unless you give code, we can't help. Gotta see the problem
nateracecar5 #4
Posted 22 May 2013 - 07:33 AM
Okay here you are.

--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."
nateracecar5 #5
Posted 22 May 2013 - 07:49 AM
Never mind, I just changed it from pastebin to http, so now it is all fine. Could someone lock this thread?