Jump to content




Make this progress thing not spam the screen?


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

#1 gknova61

  • Members
  • 74 posts

Posted 15 November 2012 - 09:56 PM

Here is my code
while true do
sleep(0)
  Progress = math.floor( writer.getProgress()*100)
  print("Writing... "..Progress.."%")
  if Progress == -100 then
	break
  end
end
Currently, it spams the screen printing the progress over n over again... can someone make it so it just updates the progress on the same line n such, thanks!
I just want it to clear the line (term.clearLine()) so i can have other stuff on-screen as well

#2 Sammich Lord

    IRC Addict

  • Members
  • 1,212 posts
  • LocationThe Sammich Kingdom

Posted 15 November 2012 - 09:59 PM

Just clear the line with
term.clearLine()
or the whole screen
term.clear()


#3 D3matt

  • Members
  • 830 posts

Posted 15 November 2012 - 10:47 PM

Or use term.write to write to a specific location and continously write over it.

#4 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 16 November 2012 - 12:09 AM

while true do
  sleep(0)
  term.setCursorPos(1,1) term.clearLine()
  Progress = math.floor( writer.getProgress()*100)
  print("Writing... "..Progress.."%")
  if Progress == -100 then
        break
  end
end


#5 gknova61

  • Members
  • 74 posts

Posted 16 November 2012 - 04:16 PM

Forgot to set the cursor pos! That's why it wasn't working for me, derp. Thanks!

#6 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 17 November 2012 - 01:26 AM

Haha, happens to everyone!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users