Jump to content




Clear the screen on program ?


8 replies to this topic

#1 A2Creativity

  • New Members
  • 5 posts
  • Location-

Posted 16 June 2012 - 04:12 PM

hi, i want to ask about my startup program... it just a regular door locking and the problem is after i enter the password it's open the door but it doesn't clear the screen

ex:
Please enter the password:

(after i enter the correct password)

Please enter the password:
****
Please enter the password:
_

any idea to clear previous text ? and where i should put them ?

here's my script
Spoiler


#2 Pinkishu

  • Members
  • 484 posts

Posted 16 June 2012 - 04:15 PM

term.clear()

will clear the terminal screen so put it before slowprint
you might also want to put a term.setCursorPos(1,1)
behind or before term.clear() as it sets the cursor back to the top left position

#3 A2Creativity

  • New Members
  • 5 posts
  • Location-

Posted 16 June 2012 - 04:23 PM

View PostPinkishu, on 16 June 2012 - 04:15 PM, said:

term.clear()

will clear the terminal screen so put it before slowprint
you might also want to put a term.setCursorPos(1,1)
behind or before term.clear() as it sets the cursor back to the top left position
oh thanks...

but it makes the else text gone
ex.
Pass:

(i typed the wrong pass)

You entered the wrong password.

but with term.clear it will be restarted to 'pass:' not to 'You entered the blablabla'
any idea to fix it ?

#4 cant_delete_account

  • Members
  • 484 posts

Posted 16 June 2012 - 04:45 PM

Do this:
while true do
term.clear()
term.setCursorPos(1,1)
term.setCursorBlink(true)
textutils.slowWrite("Welcome... nPassword: ")
local ePass = read("*")
term.clear()
term.setCursorPos(1,1)
if ePass == "the password" then
redstone.setOutput("back",true)
sleep(2)
redstone.setOutput("back",false)
end
end
P.S: 'n' is a new line, it won't show.

#5 A2Creativity

  • New Members
  • 5 posts
  • Location-

Posted 17 June 2012 - 02:28 AM

View Postthesbros, on 16 June 2012 - 04:45 PM, said:

Do this:
while true do
term.clear()
term.setCursorPos(1,1)
term.setCursorBlink(true)
textutils.slowWrite("Welcome... nPassword: ")
local ePass = read("*")
term.clear()
term.setCursorPos(1,1)
if ePass == "the password" then
redstone.setOutput("back",true)
sleep(2)
redstone.setOutput("back",false)
end
end
P.S: 'n' is a new line, it won't show.

awesome ! it's fix my problem... anyway do you know guide of command that only on computercraft ? like redstone.setOutput (that probably only on computercraft)
and the last question..
what command on program to make the computer shutdown ?

#6 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 17 June 2012 - 02:39 AM

View PostA2Creativity, on 17 June 2012 - 02:28 AM, said:

awesome ! it's fix my problem... anyway do you know guide of command that only on computercraft ? like redstone.setOutput (that probably only on computercraft)
and the last question..
what command on program to make the computer shutdown ?
That's what the wiki is for :(/>

#7 A2Creativity

  • New Members
  • 5 posts
  • Location-

Posted 17 June 2012 - 02:43 AM

View PostMysticT, on 17 June 2012 - 02:39 AM, said:

View PostA2Creativity, on 17 June 2012 - 02:28 AM, said:

awesome ! it's fix my problem... anyway do you know guide of command that only on computercraft ? like redstone.setOutput (that probably only on computercraft)
and the last question..
what command on program to make the computer shutdown ?
That's what the wiki is for :(/>

Which one ? i only see the turtle not for the computer

#8 deity12

  • New Members
  • 19 posts

Posted 17 June 2012 - 07:20 AM

os.shutdown()
That will shut down the computer.

#9 MysticT

    Lua Wizard

  • Members
  • 1,597 posts

Posted 17 June 2012 - 04:31 PM

View PostA2Creativity, on 17 June 2012 - 02:43 AM, said:

View PostMysticT, on 17 June 2012 - 02:39 AM, said:

View PostA2Creativity, on 17 June 2012 - 02:28 AM, said:

awesome ! it's fix my problem... anyway do you know guide of command that only on computercraft ? like redstone.setOutput (that probably only on computercraft)
and the last question..
what command on program to make the computer shutdown ?
That's what the wiki is for :(/>

Which one ? i only see the turtle not for the computer
There's an APIs section where you can see all the commands. Most of them are for computers and turtles, only the turtle api is for turtles only.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users