3 posts
Posted 17 November 2012 - 08:59 AM
Hi i've been coding a program, but i have a problem.
My problem is that i want my pc to return if fase. Like return without using the shell.run("startup").
Like this:
term.clear()
term.setCursorPos(1,1)
password = "test"
debug = "testreset"
print("This door is protected by password!")
write("Please enterpassword: ")
A = read("X")
if A == password then
...blalalalal....
else return - Here i wan it to retur up to "if A == password then" if false! And only if false!
Any help?
1214 posts
Location
The Sammich Kingdom
Posted 17 November 2012 - 09:11 AM
Hi i've been coding a program, but i have a problem.
My problem is that i want my pc to return if fase. Like return without using the shell.run("startup").
Like this:
term.clear()
term.setCursorPos(1,1)
password = "test"
debug = "testreset"
print("This door is protected by password!")
write("Please enterpassword: ")
A = read("X")
if A == password then
...blalalalal....
else return - Here i wan it to retur up to "if A == password then" if false! And only if false!
Any help?
Just use a while loop:
os.pullEvent = os.pullEventRaw --Prevent CTRL+T
term.clear()
term.setCursorPos(1,1)
local password = "test"
local debug = "testreset"
print("This door is protected by password!")
while true do
write("Please enterpassword: ")
a = read("*")
if a == password then
print("Correct password. Door now opening.")
rs.setOutput("left", true)
sleep(5)
rs.setOutput("left", false)
else
print("Incorrect password! Please try again.")
end
1243 posts
Location
Indiana, United States
Posted 17 November 2012 - 02:20 PM
Would someone teach these people to read?!
This is the APIS AND UTILITIES SECTION OF THE PROGRAMS SUBFORUM. Where in that sentence is there anything saying, "Post problems here!"?
For f***'s sake. -.-
389 posts
Location
Norway
Posted 17 November 2012 - 10:42 PM
Moved to ask a pro
1214 posts
Location
The Sammich Kingdom
Posted 17 November 2012 - 10:44 PM
Would someone teach these people to read?!
This is the APIS AND UTILITIES SECTION OF THE PROGRAMS SUBFORUM. Where in that sentence is there anything saying, "Post problems here!"?
For f***'s sake. -.-
I actually didn't notice that :)/>/> I reply to most threads I see in the "New Content" section.
3 posts
Posted 18 November 2012 - 04:28 AM
Hi i've been coding a program, but i have a problem.
My problem is that i want my pc to return if fase. Like return without using the shell.run("startup").
Like this:
term.clear()
term.setCursorPos(1,1)
password = "test"
debug = "testreset"
print("This door is protected by password!")
write("Please enterpassword: ")
A = read("X")
if A == password then
...blalalalal....
else return - Here i wan it to retur up to "if A == password then" if false! And only if false!
Any help?
Just use a while loop:
os.pullEvent = os.pullEventRaw --Prevent CTRL+T
term.clear()
term.setCursorPos(1,1)
local password = "test"
local debug = "testreset"
print("This door is protected by password!")
while true do
write("Please enterpassword: ")
a = read("*")
if a == password then
print("Correct password. Door now opening.")
rs.setOutput("left", true)
sleep(5)
rs.setOutput("left", false)
else
print("Incorrect password! Please try again.")
end
Okay, but I get a error i guess the end doesnt support while loop.
3 posts
Posted 18 November 2012 - 04:29 AM
Hi i've been coding a program, but i have a problem.
My problem is that i want my pc to return if fase. Like return without using the shell.run("startup").
Like this:
term.clear()
term.setCursorPos(1,1)
password = "test"
debug = "testreset"
print("This door is protected by password!")
write("Please enterpassword: ")
A = read("X")
if A == password then
...blalalalal....
else return - Here i wan it to retur up to "if A == password then" if false! And only if false!
Any help?
Just use a while loop:
os.pullEvent = os.pullEventRaw --Prevent CTRL+T
term.clear()
term.setCursorPos(1,1)
local password = "test"
local debug = "testreset"
print("This door is protected by password!")
while true do
write("Please enterpassword: ")
a = read("*")
if a == password then
print("Correct password. Door now opening.")
rs.setOutput("left", true)
sleep(5)
rs.setOutput("left", false)
else
print("Incorrect password! Please try again.")
end
Okay, but I get a error i guess the end doesnt support while loop.
Oooh nvm, I found out. The while loop didn't end.
THANKKKSS!