Posted 26 February 2012 - 07:40 AM
I wanted to make a clock, but how can I make my computer count, and can reset?
:)/>/>
Bennievv
:)/>/>
Bennievv
local counter = 1 --Starting value
while true do
term.setCursorPos( 1, 1 ) -- (Re-)set cursor position
term.clear() -- (Re-)clear screen
print( "Counter = "..counter )
print( "Press ENTER to continue..." )
read()
counter = counter + 1 -- Increment counter
if counter > 10 then break end -- Ends the loop when the counter surpasses 10.
end
Basically, you just create a numerical variable with a starting value and then increment it by your desired amount every time you want to count up, or decrement it if you'd like to go the other direction.^^