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

Better Password Tutorial

Started by Alice, 18 November 2013 - 09:16 AM
Alice #1
Posted 18 November 2013 - 10:16 AM
After viewing a few posts about passwords, I felt the need to do this.
I will be explaining every line of code.

local os.pullEvent = os.pullEventRaw --Localize to make sure pullEvent in other programs works.
local password --This declares the password variable in a local environment so no one can steal it using other programs.
print("Please enter your password:") --writes a line asking the user to print their password
while read("*")~=password then --Repeat this until the user types in the password
print("Incorrect password") --Writes a line telling the user the password is incorrect
sleep(2) --Give the user time to read the text
term.clear() term.setCursorPos(1,1) --Clears the screen, sets the cursor to the default position, like the clear program
print("PLease enter your password:") --Same as above
end --Stops the script
--Now you should be able to be done.
theoriginalbit #2
Posted 18 November 2013 - 06:46 PM
This is definitely not a "better password tutorial", its not even a tutorial. You need way more content and you need to explain how a lot of things better. Heavily commented code is difficult to read, so split those up and have paragraphs before and/or after the code snippets, then provide a "final" together solution.

You also have a bug on the very first line of your code! That is not very tutorial like! local os.pullEvent = os.pullEventRaw you can't localise a variable that you're putting into a non-local table. The rule that applies the most when writing tutorials as well as submitting any program is to test your code!
Symmetryc #3
Posted 18 November 2013 - 07:32 PM
This is definitely not a "better password tutorial", its not even a tutorial. You need way more content and you need to explain how a lot of things better. Heavily commented code is difficult to read, so split those up and have paragraphs before and/or after the code snippets, then provide a "final" together solution.

You also have a bug on the very first line of your code! That is not very tutorial like! local os.pullEvent = os.pullEventRaw you can't localise a variable that you're putting into a non-local table. The rule that applies the most when writing tutorials as well as submitting any program is to test your code!
We need a Tutorial Tutorial ._.
Edited on 18 November 2013 - 06:32 PM
theoriginalbit #4
Posted 18 November 2013 - 11:08 PM
We need a Tutorial Tutorial ._.
We really do, it is starting to become ridiculous with the amount of bad tutorials.
Lyqyd #5
Posted 18 November 2013 - 11:32 PM
Moved to Ask a Pro.