This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Sparrow_On_MC's profile picture

Please Help Me Fix My Computer Lock!

Started by Sparrow_On_MC, 12 April 2013 - 09:41 PM
Sparrow_On_MC #1
Posted 12 April 2013 - 11:41 PM
THIS HAS BEEN SOLVED BY superaxander!
I have coded a computer lock (a lock that locks the computer with a password) and when I launch it it says bios:337: [string "startup"}:5" unfinished string. I have finished it. Can someone check my coding and see if there is an error? Thank you!


print("Starting Up CraftOS…")
sleep(5)
print("Login Program Coded By FunkyBass Productions")
print("Please Type In The Password")
print(")
password = read()
if password == "Pineapple100" then
print("Password Correct!")
sleep(3)
print("Logging In…")
sleep(5)
print("Loading Files…")
sleep(5)
print("Loading Programs…")
sleep(5)
print("Loading Personal Settings…")
sleep(5)
print("Loading…")
sleep(1)
print("Logging In")
sleep(10)
os.clear()
else
print("Logging In…")
sleep(5)
print("Error! Password Incorrect!")
sleep(2)
print("Shutting Down Computer!")
sleep(5)
os.shutdown()
end
superaxander #2
Posted 12 April 2013 - 11:47 PM
Line four:

print(")
Should be

print("")
And

os.clear()
Should be

term.clear()
term.setCursorPos(1,1)

Cheers!
EDIT:
Maybe put

local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
At the beginning and

os.pullEvent = oldPull
At the end to prevent people from terminating your program with ctrl+t
Sparrow_On_MC #3
Posted 13 April 2013 - 12:08 AM
Line four:

print(")
Should be

print("")
And

os.clear()
Should be

term.clear()
term.setCursorPos(1,1)

Cheers!
EDIT:
Maybe put

local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
At the beginning and

os.pullEvent = oldPull
At the end to prevent people from terminating your program with ctrl+t

THANK YOU! THAT HELPED ME SOOOO MUCH!
Sparrow_On_MC #4
Posted 13 April 2013 - 12:16 AM
Ok. I have fixed the coding and change some of it. BIG THANKS TO superaxander! Hope you don't mind me crediting you?
If you want to use the coding here it is!



local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
print("Starting Up CraftOS…")
sleep(5)
print("Login Program Coded By FunkyBass Productions and superaxander")
print("Please Type In The Password")
print("")
password = read()
if password == "Pineapple100" then
print("Password Correct!")
sleep(3)
print("Logging In…")
sleep(2)
print("Loading Files…")
sleep(2)
print("Loading Programs…")
sleep(2)
print("Loading Personal Settings…")
sleep(2)
print("Loading…")
sleep(1)
print("Logging In")
sleep(2)
term.clear()
term.setCursorPos(1,1)
else
print("Logging In…")
sleep(2)
print("Error! Password Incorrect!")
sleep(2)
print("Shutting Down Computer!")
sleep(2)
os.shutdown()
end
os.pullEvent = oldPull
Sparrow_On_MC #5
Posted 13 April 2013 - 12:19 AM
Ok. I have fixed the coding and change some of it. BIG THANKS TO superaxander! Hope you don't mind me crediting you?
If you want to use the coding here it is!



local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
print("Starting Up CraftOS…")
sleep(5)
print("Login Program Coded By FunkyBass Productions and superaxander")
print("Please Type In The Password")
print("")
password = read()
if password == "Pineapple100" then
print("Password Correct!")
sleep(3)
print("Logging In…")
sleep(2)
print("Loading Files…")
sleep(2)
print("Loading Programs…")
sleep(2)
print("Loading Personal Settings…")
sleep(2)
print("Loading…")
sleep(1)
print("Logging In")
sleep(2)
term.clear()
term.setCursorPos(1,1)
else
print("Logging In…")
sleep(2)
print("Error! Password Incorrect!")
sleep(2)
print("Shutting Down Computer!")
sleep(2)
os.shutdown()
end
os.pullEvent = oldPull

To change the password go to line 9 and change it from Pineapple100 to whatever you want
superaxander #6
Posted 13 April 2013 - 12:37 AM
Ok. I have fixed the coding and change some of it. BIG THANKS TO superaxander! Hope you don't mind me crediting you?
If you want to use the coding here it is!



local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
print("Starting Up CraftOS…")
sleep(5)
print("Login Program Coded By FunkyBass Productions and superaxander")
print("Please Type In The Password")
print("")
password = read()
if password == "Pineapple100" then
print("Password Correct!")
sleep(3)
print("Logging In…")
sleep(2)
print("Loading Files…")
sleep(2)
print("Loading Programs…")
sleep(2)
print("Loading Personal Settings…")
sleep(2)
print("Loading…")
sleep(1)
print("Logging In")
sleep(2)
term.clear()
term.setCursorPos(1,1)
else
print("Logging In…")
sleep(2)
print("Error! Password Incorrect!")
sleep(2)
print("Shutting Down Computer!")
sleep(2)
os.shutdown()
end
os.pullEvent = oldPull

To change the password go to line 9 and change it from Pineapple100 to whatever you want
You might wanna remove some sleeps cause they are not needed. Also with more than 128 characters the program will crash when you type it in
EDIT: even if it's not the correct password
superaxander #7
Posted 13 April 2013 - 12:38 AM
Also use read("*") to make it display as *'s
superaxander #8
Posted 13 April 2013 - 12:43 AM
Add this at the top after os.pullEvent = os.pullEventRaw

function cread()
     password = read("*")
end
And replace line 8 with

pcall(cread)
And the issue I mentioned above is fixed
Sparrow_On_MC #9
Posted 13 April 2013 - 01:17 AM
Add this at the top after os.pullEvent = os.pullEventRaw

function cread()
	 password = read("*")
end
And replace line 8 with

pcall(cread)
And the issue I mentioned above is fixed

Thank you for all your help. I will fix up the stuff you told me to and it will be perfect! Once again thank you!
superaxander #10
Posted 13 April 2013 - 01:20 AM
Thank you for all your help. I will fix up the stuff you told me to and it will be perfect! Once again thank you!
No problem
Imque #11
Posted 13 April 2013 - 04:08 AM
*cough fake loading screen -.-
superaxander #12
Posted 13 April 2013 - 04:13 AM
*cough fake loading screen -.-
I said That a fee Posts up
Sparrow_On_MC #13
Posted 20 April 2013 - 03:22 AM
*cough fake loading screen -.-

It's meant to be. The loading screen is for fun! DAAAAH!