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

Input based answers

Started by Salaveneus, 10 October 2012 - 10:56 PM
Salaveneus #1
Posted 11 October 2012 - 12:56 AM
Okay, so first I will show part of the code I am working with, and then ask what can be done to fix my problem, and the problem I am having at the end.

if input == "0" or "1" – These are the usernames
then textutils.slowPrint("Working…")
sleep (1.0)
print ("Username Accepted")
shell.run ("HELPMEHERE") – Ill explain this at the end
error()
end

__

Okay, so what I want to do is, based off of whether they input "0" or "1" (Bad examples, I want real words ideally, so no math part please!)
that it goes shell.run("*Input*.Password")

Where the 1 (or 0).Password is a seperate program to check for passwords

I know that I can use an "elseif input == " statement to do it, the point is simple addition of users, and keep this program just a little cleaner.

Ideal Example:
I input 1
Computer prints Username Accepted
Computer starts program to do the password part
Computer ends this program
Lyqyd #2
Posted 11 October 2012 - 01:08 AM
input = read()
shell.run(input..".password")

The '..' in there is the concatenation operator, which smashes two strings together to make one string. That example would run the file George.password if you put your username in as George.
Salaveneus #3
Posted 11 October 2012 - 01:34 AM
Thank you so much!