Posted 26 April 2012 - 12:23 PM
Hi, this is my first post on this plus am a noob at lua.
EDIT: change the code in the first spoiler to the correct code that now correctly and properly works
this is my code for the computer to send the signal out to the other computer after the user has logged in. Feel free on this one to all so optimism some of the code for me it would be useful to me
print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rs.setBundledOutput("back", rs.getBundledOutput("back") + colors.white) print(" Signal Sent On ")
sleep(sleepTime3)
rs.setBundledOutput("back", rs.getBundledOutput("back") - colors.white) print(" Signal Sent Off ")
print(" Code finishes here for now ")
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserDebug()
if inputUser == debug then
print(" Debugging.. Shutting Down. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
sleepTime1 = 5
sleepTime2 = 2
sleepTime3 = 3
user = "jamesscape2"
pass = "basketball"
debug = "debug"
term.clear()
term.setCursorPos(1,1)
print(" —————————– ")
print(" Welcome to the Control Centre ")
print(" —————————– ")
sleep(sleepTime1)
write(" Enter username: ")
inputUser = read("*")
if inputUser == user then
UserCorrect()
elseif
inputUser == debug then
UserDebug()
else
UserIncorrect()
end
and this is the code i have so far to start the program on the other computer.
at the moment i am just mucking around with it trying to see if it works, the program is in now way finished
term.clear
term.setCursorPos(1,1)
print("Working")
end
thanks i have been try at this for a hour or so now so it would be great if i could get a straight answer how to fix it
THANKS
EDIT: change the code in the first spoiler to the correct code that now correctly and properly works
this is my code for the computer to send the signal out to the other computer after the user has logged in. Feel free on this one to all so optimism some of the code for me it would be useful to me
Spoiler
function UserCorrect()print(" Username correct ")
sleep(sleepTime2)
write(" Enter password: ")
inputPass = read("*")
if inputPass == pass then
print(" Password Correct ")
sleep(sleepTime2)
rs.setBundledOutput("back", rs.getBundledOutput("back") + colors.white) print(" Signal Sent On ")
sleep(sleepTime3)
rs.setBundledOutput("back", rs.getBundledOutput("back") - colors.white) print(" Signal Sent Off ")
print(" Code finishes here for now ")
elseif inputPass ~= pass then
print(" Password incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserIncorrect()
if inputUser ~= user then
print(" Username incorrect.. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
function UserDebug()
if inputUser == debug then
print(" Debugging.. Shutting Down. ")
sleep(sleepTime3)
term.clear()
term.setCursorPos(1,1)
print(" Computer Shutting down.. ")
sleep(sleepTime2)
os.shutdown()
end
end
sleepTime1 = 5
sleepTime2 = 2
sleepTime3 = 3
user = "jamesscape2"
pass = "basketball"
debug = "debug"
term.clear()
term.setCursorPos(1,1)
print(" —————————– ")
print(" Welcome to the Control Centre ")
print(" —————————– ")
sleep(sleepTime1)
write(" Enter username: ")
inputUser = read("*")
if inputUser == user then
UserCorrect()
elseif
inputUser == debug then
UserDebug()
else
UserIncorrect()
end
and this is the code i have so far to start the program on the other computer.
at the moment i am just mucking around with it trying to see if it works, the program is in now way finished
Spoiler
while rs.getBundledInput("back") = true thenterm.clear
term.setCursorPos(1,1)
print("Working")
end
thanks i have been try at this for a hour or so now so it would be great if i could get a straight answer how to fix it
THANKS
Edited on 26 April 2012 - 01:18 PM