5 posts
Location
-
Posted 16 June 2012 - 05: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
function pass()
textutils.slowPrint("Welcome… please enter the password:")
x = io.read()
if x == "the password" then
redstone.setOutput("back",true)
sleep(2)
redstone.setOutput("back",false)
pass()
else
pass()
end
end
pass()
445 posts
Posted 16 June 2012 - 05: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
5 posts
Location
-
Posted 16 June 2012 - 05:23 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
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 ?
474 posts
Posted 16 June 2012 - 05: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 posts
Location
-
Posted 17 June 2012 - 03:28 AM
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 ?
1604 posts
Posted 17 June 2012 - 03:39 AM
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 :(/>/>
5 posts
Location
-
Posted 17 June 2012 - 03:43 AM
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
19 posts
Posted 17 June 2012 - 08:20 AM
os.shutdown()
That will shut down the computer.
1604 posts
Posted 17 June 2012 - 05:31 PM
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.