Posted 06 June 2013 - 06:58 AM
Hello just started trying out how this mod works ( no lua experience)
and after a few hours i wrote this login.
my question is how woud you guys have done this ( what would you change/ optimize)
So dat i know what i can focus on when make my next script.
( i might have a few typo's but it did work :)/> )
it is a startup file
os.pullEvent = os.pullEventRaw
function clear()
term.clear()
term.setCursorPos(1,1)
end
function red()
redstone.setOutput("right", true)
sleep(3)
redstone.setOutput("right", false)
end
print "welcome"
write "login: "
login = read()
if login == ("login1") then
write "pasword: "
if pasword == ("pas1") then
clear()
print "hello login1"
red()
clear()
else
clear()
print "wrong pasword"
sleep(2)
os.reboot()
end
elseif login == ("login2") then
write "pasword: "
if pasword == ("pas2") then
clear()
print "hello login2"
red()
clear()
else
clear()
print "wrong pasword"
sleep(2)
os.reboot()
end
else
clear()
print "unkown login"
sleep(2)
os.reboot()
end
Thanks for helping me
Roy
and after a few hours i wrote this login.
my question is how woud you guys have done this ( what would you change/ optimize)
So dat i know what i can focus on when make my next script.
( i might have a few typo's but it did work :)/> )
it is a startup file
os.pullEvent = os.pullEventRaw
function clear()
term.clear()
term.setCursorPos(1,1)
end
function red()
redstone.setOutput("right", true)
sleep(3)
redstone.setOutput("right", false)
end
print "welcome"
write "login: "
login = read()
if login == ("login1") then
write "pasword: "
if pasword == ("pas1") then
clear()
print "hello login1"
red()
clear()
else
clear()
print "wrong pasword"
sleep(2)
os.reboot()
end
elseif login == ("login2") then
write "pasword: "
if pasword == ("pas2") then
clear()
print "hello login2"
red()
clear()
else
clear()
print "wrong pasword"
sleep(2)
os.reboot()
end
else
clear()
print "unkown login"
sleep(2)
os.reboot()
end
Thanks for helping me
Roy