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

[Question] Login, Register computercraft

Started by Neils, 10 April 2013 - 07:41 AM
Neils #1
Posted 10 April 2013 - 09:41 AM
Hey

I'd like to create an OS for some friends on a server, but I can't manage to create two programs.

Program 1:
The program asks to enter an username, a password and the side of the wireless modem.
This is information is saved

Program 2:
The program reads the username and the password saved before and opens rednet on the choosen side.

I found some tutorials, but they weren't what I was looking for…

PS: Not for Advanced Computers
Engineer #2
Posted 10 April 2013 - 10:02 AM
We are here to fix your code, not to give the code. I sometime do honestly, bit this is the 'higher' step.

I know this is ask a pro, but most of us will say this.
Smiley43210 #3
Posted 10 April 2013 - 10:09 AM
This is simply the bare-bone basics. Incorporating the ideas can create much more advanced systems.

Use input() for asking for information. This allows the user to type text in, and the text is returned when he/she presses enter. Example:
write("Enter a username. Press enter to continue.")
local username = read()
write("Your username is "..username)

For saving to files, use the fs API. http://computercraft.info/wiki/Fs_(API)
Pay particular attention to fs.open(). You use that to read and write to files. Since I'm in my iPod I'm too lazy to post an example, but there are some on the wiki.

Good luck.

We are here to fix your code, not to give the code. I sometime do honestly, bit this is the 'higher' step.

I know this is ask a pro, but most of us will say this.
Explained without spoon feeding. :P/>
Engineer #4
Posted 10 April 2013 - 10:41 AM
This is simply the bare-bone basics. Incorporating the ideas can create much more advanced systems.

Use input() for asking for information. This allows the user to type text in, and the text is returned when he/she presses enter. Example:
write("Enter a username. Press enter to continue.")
local username = read()
write("Your username is "..username)

For saving to files, use the fs API. http://computercraft.info/wiki/Fs_(API)
Pay particular attention to fs.open(). You use that to read and write to files. Since I'm in my iPod I'm too lazy to post an example, but there are some on the wiki.

Good luck.

We are here to fix your code, not to give the code. I sometime do honestly, bit this is the 'higher' step.

I know this is ask a pro, but most of us will say this.
Explained without spoon feeding. :P/>/>
The thing is, they should attempt learning programming in CCLua, I mean by spoonfeeding them they usually dont learn to much.
I mean really, they should attempt it first in my opinion.
Note: if you are offensed, I dont mean it like that. It is just an argument
Smiley43210 #5
Posted 10 April 2013 - 10:47 AM
-snip-
Note: if you are offended, I dont mean it like that. It is just an argument
Not at all ;)/>. I (in my opinion) just gave a concept of how to do it, a pointer in the right direction.
remiX #6
Posted 10 April 2013 - 11:01 AM
Use input() for asking for information. This allows the user to type text in, and the text is returned when he/she presses enter. Example:
write("Enter a username. Press enter to continue.")
local username = read()
write("Your username is "..username)
Explained without spoon feeding. :P/>

Hmmm… :P/>
Smiley43210 #7
Posted 10 April 2013 - 05:40 PM
Well, I think of spoon feeding as writing code for someone to use. Yeah, I did say use input(), but… it's just a function. Besides, I just posted how to use the function, not wrote out a full example code that functions as the OP wants it to. The OP still has to use the info to make it. My basis of spoon feeding comes from Team Avolition's forums (no, I was never part of them, I just looked at their hacking code to try and prevent griefing with my own plugin).