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

How to make a command?

Started by raxteeze, 04 August 2015 - 06:54 AM
raxteeze #1
Posted 04 August 2015 - 08:54 AM
For example, when a user writes Login and her name, then authorization would occur. And if he says just the name, it would not have happened. Please, help.
Edited on 04 August 2015 - 06:58 AM
MKlegoman357 #2
Posted 04 August 2015 - 09:27 AM
Do you mean a shell command? Like 'cd' and 'ls'? If yes, then you simply have to create a program with the name of the command you want. Commands in the shell are simply programs, which you run by entering the program's name.
raxteeze #3
Posted 04 August 2015 - 09:33 AM
Do you mean a shell command? Like 'cd' and 'ls'? If yes, then you simply have to create a program with the name of the command you want. Commands in the shell are simply programs, which you run by entering the program's name.

Yes, I meant it, but not quite. I was referring to the argument. That is, I introduced the command Login and then the name, then authentication must occur.
Astrophylite #4
Posted 04 August 2015 - 10:19 AM
So, from what I can gather, you want to create a authentication program, that once entered both the Username and Password fields, it will proceed to authenticate against two strings (the username and password), and if it returns correct, allow them into the shell. Is that correct?
raxteeze #5
Posted 04 August 2015 - 10:55 AM
So, from what I can gather, you want to create a authentication program, that once entered both the Username and Password fields, it will proceed to authenticate against two strings (the username and password), and if it returns correct, allow them into the shell. Is that correct?

Not really. In general, it should be the same as here:

Instead ADMIN to write the specified name

Edited on 04 August 2015 - 08:59 AM
Lupus590 #6
Posted 04 August 2015 - 11:22 AM
You want to learn how to do the argument part then. He's a small demo program which prints it's arguments to the screen:

--#this program prints it's arguments to the screen
local args = {...} --#... is everything passed to our program from the shell, this is where the arguments are stored
  --# on the above line is where I put it in a local table for convience
for i = 1 to #args do
  print(args[i])
end
Edited on 04 August 2015 - 09:24 AM
LuckyLuke #7
Posted 04 August 2015 - 11:25 AM
So, from what I can gather, you want to create a authentication program, that once entered both the Username and Password fields, it will proceed to authenticate against two strings (the username and password), and if it returns correct, allow them into the shell. Is that correct?

Not really. In general, it should be the same as here:

Instead ADMIN to write the specified name


Is this a ressource pack?
Astrophylite #8
Posted 04 August 2015 - 11:51 AM
-snip-

edit: ninja'd :ph34r:/>
Edited on 04 August 2015 - 10:04 AM
raxteeze #9
Posted 04 August 2015 - 11:54 AM
So, from what I can gather, you want to create a authentication program, that once entered both the Username and Password fields, it will proceed to authenticate against two strings (the username and password), and if it returns correct, allow them into the shell. Is that correct?

Not really. In general, it should be the same as here:

Instead ADMIN to write the specified name


Is this a ressource pack?

No, it's Fallout 3 :D/>
Astrophylite #10
Posted 04 August 2015 - 12:03 PM
EvilGamer, I am currently working on something, that should, answer what you want ;)/>
raxteeze #11
Posted 04 August 2015 - 12:04 PM
EvilGamer, I am currently working on something, that should, answer what you want ;)/>

I will wait ^_^/>
Astrophylite #12
Posted 04 August 2015 - 12:52 PM
Okay… Finally… It took longer than expected.
It might be a little bit ugly, and I have bug tested it… You will have to download two files, startup and LOGON.
Run the following commands:
pastebin get z0qxhNg6 startup
pastebin get avMXnK0H LOGON

Once you download it, you can change the color if you wish. You can change the password, which is defined in the LOGON program. You can change the username, which you MUST change in both the startup program, and the LOGON program.

If you are confused about something, just ask me and I'll explain it :)/>
LuckyLuke #13
Posted 04 August 2015 - 01:37 PM
But why did you create to programs for that?
And i need to get Fallout 3 :D/>
Edited on 04 August 2015 - 11:38 AM
Astrophylite #14
Posted 04 August 2015 - 02:51 PM
I made it into two programs so it would be easier to understand what it was doing…
I could've made it into a 10-15 line code by compiling it, but eh….
raxteeze #15
Posted 06 August 2015 - 10:59 AM
Okay… Finally… It took longer than expected.
It might be a little bit ugly, and I have bug tested it… You will have to download two files, startup and LOGON.
Run the following commands:
pastebin get z0qxhNg6 startup
pastebin get avMXnK0H LOGON

Once you download it, you can change the color if you wish. You can change the password, which is defined in the LOGON program. You can change the username, which you MUST change in both the startup program, and the LOGON program.

If you are confused about something, just ask me and I'll explain it :)/>

THANK YOU! :lol:/>