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

Make this progress thing not spam the screen?

Started by gknova61, 15 November 2012 - 08:56 PM
gknova61 #1
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
Sammich Lord #2
Posted 15 November 2012 - 09:59 PM
Just clear the line with
term.clearLine()
or the whole screen
term.clear()
D3matt #3
Posted 15 November 2012 - 10:47 PM
Or use term.write to write to a specific location and continously write over it.
remiX #4
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
gknova61 #5
Posted 16 November 2012 - 04:16 PM
Forgot to set the cursor pos! That's why it wasn't working for me, derp. Thanks!
remiX #6
Posted 17 November 2012 - 01:26 AM
Haha, happens to everyone!