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

Does any body know how to make this work?

Started by DaJelloKing, 12 March 2013 - 05:11 AM
DaJelloKing #1
Posted 12 March 2013 - 06:11 AM
So im working on making an OS, and I have a config program that runs when you first startup the OS that sets a few values (so far there is only jOSnick, JOSu, and JOSp.)
the user types an input on the computer and it makes that input the value of the variable.
after the config program is done it replaces the startup file with a startup file that uses passwords you set in the config, and then restarts the computer.

the problem is that when the computer restarts, the value for the variables is wiped, so if you try to type in your username it will always tell you that the username you typed in is wrong, and then restarts the start function in the startup file.

So i need someone to show me how to permanently store the variables, and then be able to call them and get their values from another program.

All help is greatly appreciated!

the config file: http://pastebin.com/YMCSP9qS

the startup file: http://pastebin.com/vbj50YLy

BTW all the print(JOSblahblahblah) stuff on the top of the OSstartup file was just me testing if the values where still stored (thats how i found out how they where getting wiped after reboot)
Lyqyd #2
Posted 12 March 2013 - 06:30 AM
Split into new topic.
DaJelloKing #3
Posted 12 March 2013 - 06:36 AM
Split into new topic.
thanks!
remiX #4
Posted 12 March 2013 - 06:50 AM
Because of the os.reboot() within the OSconfig file, the variables that you have jOSnick, JOSu, and JOSp are reset and now nil.
Remove os.restart in the OSconfig file and it should be fine.

I Would suggest rather to have it asked within the main program and then save the different variables into a file in which you read later on.
Check this thread and this thread about writing and reading variables to a file.
DaJelloKing #5
Posted 12 March 2013 - 06:53 AM
Because of the os.reboot() the variables that you have jOSnick, JOSu, and JOSp are reset and now nil.
Remove the fact that it restarts the pc and it should be fine.
thanks, but i already figured this.
the problem is that the computer will eventualy have to be restarted, thus clearing the variable's values.
so i need a way to store the variables (possibly something that's not actually a variable, but could work like one.)

[edit] missed the bottom part completely, ill check that out.
remiX #6
Posted 12 March 2013 - 06:56 AM
Because of the os.reboot() the variables that you have jOSnick, JOSu, and JOSp are reset and now nil.
Remove the fact that it restarts the pc and it should be fine.
thanks, but i already figured this.
the problem is that the computer will eventualy have to be restarted, thus clearing the variable's values.
so i need a way to store the variables (possibly something that's not actually a variable, but could work like one.)

[edit] missed the bottom part completely, ill check that out.

The bottom part I edited, sorry :P/>
But yeah, that is what you're looking for