this is basically my first try at programming and the program is based off another i found heres the code i cant seem to get it to work
local color = colors.red
while true do
oldPull = os.pullEventRaw
term.clear()
term.setCursorPos(1,1)
term.setTextColor(color)
print("Zphone")
write("Username: ")
if read = "username" then
write(Password: ")
read("*") = "password" then
sleep(1)
term.clear()
term.setCursorPos(1,1)
else
print("Incorrect Login Details")
sleep()
print("Rebooting...")
sleep(1)
end
end
os.pullEvent = oldPull
know me this is probably horrible
Need help with login program
Started by Krul__Tepes, Jul 20 2017 05:59 AM
9 replies to this topic
#1
Posted 20 July 2017 - 05:59 AM
#2
Posted 20 July 2017 - 09:45 AM
What does it do and what do you want it to do?
also [code] tags
close with [/code]
also [code] tags
close with [/code]
Edited by Bomb Bloke, 20 July 2017 - 10:27 AM.
#3
Posted 20 July 2017 - 10:57 AM
its suppost to be a computer lock like
username:
Password:
username:
Password:
#4
Posted 20 July 2017 - 11:01 AM
You need () after read, or you're literally comparing a function to a string.
#5
Posted 20 July 2017 - 11:04 AM
i added () after read but it says
bios:14: [string " .temp"]: 10: 'then' expected
bios:14: [string " .temp"]: 10: 'then' expected
#6
Posted 20 July 2017 - 12:22 PM
any suggestion on how to fix that?
#7
Posted 20 July 2017 - 01:29 PM
To compare things, you need to use ==, not just =.
#8
Posted 20 July 2017 - 02:08 PM
i fixed it now i have another problem
im getting <eof> expected at line 34 i changed the code heres the new code for the ending
if read("*") == "password" then
print("Welcome")
sleep(1)
term.clear()
term.setCursorPos(1,1)
end
else
print("Incorrect Loging Details")
sleep()
print("Rebooting...")
sleep(1)
end
os.pullEvent = oldPull
nvm fixed that NOW i have a different problem xD
im trying to get it you type where i have write("Password: ")
but its typing at the bottom of the screen
im getting <eof> expected at line 34 i changed the code heres the new code for the ending
if read("*") == "password" then
print("Welcome")
sleep(1)
term.clear()
term.setCursorPos(1,1)
end
else
print("Incorrect Loging Details")
sleep()
print("Rebooting...")
sleep(1)
end
os.pullEvent = oldPull
nvm fixed that NOW i have a different problem xD
im trying to get it you type where i have write("Password: ")
but its typing at the bottom of the screen
#9
Posted 20 July 2017 - 02:37 PM
figured that out too NOW i have another problem
when i get the password wrong i have it reboot but when it reboots where i type the password goes to where i have the user at
when i get the password wrong i have it reboot but when it reboots where i type the password goes to where i have the user at
#10
Posted 20 July 2017 - 03:24 PM
again i fixed it xD
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











