MyNameIsGuzse Posted December 20, 2012 Share Posted December 20, 2012 So i was learning how to use the computercraft mod. I made this startupprogram that would let me enter a username and a password before opening a door. But for some reason i cant type in it. this is what the coding looks like: if true then .term.clear(doorcontrol) .term.setCursorPos(1,1) .print("username:") .if input ~= "guzse" then ..print("password:") ..read = ("*") ..if input ~= "Dooracces" then ...redstone.setOutput ("bottom", true) ...sleep (3) ...redstone.setOutput ("bottom", false) ..end .end end (points are space's) And now i cant type, but it does show username: and password: What did i do wrong? Thank you anyway Link to comment Share on other sites More sharing options...
nedned2k Posted December 20, 2012 Share Posted December 20, 2012 You never told the program to ask for an input. before you compare the input to a string, you need to put "input = io.read()" and instead of "read = ("*")", you want to ask for input again, with a * showing for each character, so you need to put "input = io.read("*")" Also, may I point out that "~=" mean "does not equal", if you want the door to open only if the username and password are corrent, you need to put "==" rather than "~=". Link to comment Share on other sites More sharing options...
MyNameIsGuzse Posted December 20, 2012 Author Share Posted December 20, 2012 You never told the program to ask for an input. before you compare the input to a string, you need to put "input = io.read()" and instead of "read = ("*")", you want to ask for input again, with a * showing for each character, so you need to put "input = io.read("*")" Also, may I point out that "~=" mean "does not equal", if you want the door to open only if the username and password are corrent, you need to put "==" rather than "~=". thank you SO much! i just started with computercraft and know absolutely nothing about it! i am interested do, and i will learn! thanks alot! Link to comment Share on other sites More sharing options...
Viktor_Berg Posted December 20, 2012 Share Posted December 20, 2012 You should try to find some lua tutorials online, plenty of interesting and important information. Then check computercraft wiki for the custom functions and APIs in computercraft (such as the particulars of the redstone API, or the colors API). Link to comment Share on other sites More sharing options...
MyNameIsGuzse Posted December 20, 2012 Author Share Posted December 20, 2012 You should try to find some lua tutorials online, plenty of interesting and important information. Then check computercraft wiki for the custom functions and APIs in computercraft (such as the particulars of the redstone API, or the colors API). i know. this was actually from a tutorial, but i think it got outdated. anyway thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now