Difference between revisions of "Clear"

From ComputerCraft Wiki
Jump to: navigation, search
(Created page with " == Clear == Clear is a program in computercraft. You may want to use it in a script like: shell.run('clear') print 'Your screen is emtpy new!' This clears the screen so ...")
 
Line 10: Line 10:
 
Clear is usefull becaus you don't have to enter a code like:
 
Clear is usefull becaus you don't have to enter a code like:
 
   if turtle then
 
   if turtle then
   print 'Your screen is emtpy new!'
+
   a = 11
  i = 0
+
  repeat
+
    print ' '
+
    i = i + 1
+
  until i == 11
+
 
   else
 
   else
   print 'Your screen is emtpy new!'
+
   a = 17
  i = 0
+
  repeat
+
    print ' '
+
    i = i + 1
+
  until i == 17
+
 
   end
 
   end
 +
  print 'Your screen is emtpy new!'
 +
  i = 0
 +
  repeat
 +
  print ' '
 +
  i = i + 1
 +
  until i == a
 
You see, a huge code!
 
You see, a huge code!
 
New lets use a api that generate like clear:
 
New lets use a api that generate like clear:

Revision as of 16:45, 2 September 2012

Clear

Clear is a program in computercraft. You may want to use it in a script like:

 shell.run('clear')
 print 'Your screen is emtpy new!'

This clears the screen so you can write a text

Clear is usefull becaus you don't have to enter a code like:

 if turtle then
  a = 11
 else
  a = 17
 end
 print 'Your screen is emtpy new!'
 i = 0
 repeat
  print ' '
  i = i + 1
 until i == a

You see, a huge code! New lets use a api that generate like clear:

 term.setCursorPos(term.getCursorPos)
 term.clear()
 term.setCursorPos(1,1)

a smaller code and it works for Turtle AND CraftOS