Jump to content




[Question]Clear Line Flickering


  • You cannot reply to this topic
4 replies to this topic

#1 nateracecar5

  • Members
  • 94 posts

Posted 21 May 2013 - 09: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?

#2 Shnupbups

  • Members
  • 596 posts
  • LocationThat place over there. Y'know. The one where I am.

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 ElvishJerricco

  • Members
  • 803 posts

Posted 21 May 2013 - 10:42 PM

Unless you give code, we can't help. Gotta see the problem

#4 nateracecar5

  • Members
  • 94 posts

Posted 22 May 2013 - 06: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."

#5 nateracecar5

  • Members
  • 94 posts

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?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users