also would like it to pause between number updates like sleep(.5)
EDIT: Fixed the delay issue.
local i = 0
while i < 100 do
i = i + 1
print( i )
sleep(.1)
end
for i=0,100
print( i )
end
local i = 0
while i < 100 do
i = i + 1
print( i )
sleep(.1)
end
for i=0,100
print( i )
end
local function clear()
term.clear()
term.setCursorPos(1,3) -- position 1 on line 3
end
local i = 0
while i < 100 do
i = i + 1
clear() -- added the clear
print( i )
sleep(.1)
end
for i=0,100
print( i )
end
Where would I call that? after every print?just clear the screen each time and set the cursor position to where you want it to print. Just modify this clear function to the line that you want it on.local function clear() term.clear() term.setCursorPos(1,3) -- position 1 on line 3 end
Then do this..local i = 0 while i < 100 do i = i + 1 clear() -- added the clear print( i ) sleep(.1) end for i=0,100 print( i ) end
function dl()
local function clearDL()
term.clear()
term.setCursorPos(1,3)
end
local i = 0
while i < 100 do
cleadrDL()
sleep(.1)
print( i.."%")
end
for i = 0, 100 do
print( i.."%" )
end
end
dl()
local function clearDL()
term.clear()
term.setCursorPos(1,3)
end
function dl()
local i = 0
while i < 100 do
cleadrDL()
sleep(.1)
print( i.."%")
end
for i = 0, 100 do
print( i.."%" )
end
end
dl()
Everything is going black and then at the end everything prints out. in individual lines.remove the clear function from the dl functionlocal function clearDL() term.clear() term.setCursorPos(1,3) end function dl() local i = 0 while i < 100 do cleadrDL() sleep(.1) print( i.."%") end for i = 0, 100 do print( i.."%" ) end end dl()
local function clearDL()
term.clear()
term.setCursorPos(1,3)
end
function dl()
local i = 0
for i = 0, 100 do
clearDL()
print( i.."%" )
sleep(.5)
end
end
dl()
for i = 0,100 do
clearDL()
sleep(.1)
print( i, "%" )
end
Ahh he beat me..Tested and this should do what you're wanting.local function clearDL() term.clear() term.setCursorPos(1,3) end function dl() local i = 0 for i = 0, 100 do clearDL() print( i.."%" ) sleep(.5) end end dl()
To make an actual counter you could doAhh he beat me..for i = 0,100 do clearDL() sleep(.1) print( i, "%" ) end
local function clear()
term.setCursorPos(1, 3)
term.clearLine()
end
Just in case there's something on the screen you don't want cleared :ph34r:/>/>Sweet! thanks.If you don't want to clear the whole screen, you can remove the term.clear() and put a term.clearLine() after term.setCursorPos():Just in case there's something on the screen you don't want cleared :ph34r:/>/>local function clear() term.setCursorPos(1, 3) term.clearLine() end
for i=1,100 do
term.clear()
term.setCursorPos(1,1)
print(i.."%")
write("<")
for a=1,i/5 do
write("=")
end
for b=1,(100-i)/5
write(" ")
end
write(">")
sleep(0.5)
end