Startup

From ComputerCraft Wiki
Revision as of 14:31, 12 March 2012 by SandroHc (Talk | contribs)

Jump to: navigation, search

Startup Scripts

If, upon booting, a computer terminal detects a script named "startup" in its root directory, this script will be run. Similarly, if a disk is present in an attached disk drive containing a script named "startup" that script will be run.

Very simple auto-install script to set up a single-use terminal (e.g. password-protected door):

Disk contents:

/disk/startup (installer script)
/disk/startup.file (program to be installed on terminal)

The script could look like:

 fs.copy("/disk/startup.file", "/startup")
 shell.run("startup")

When the disk is placed into a drive attached to a terminal, and the terminal is rebooted - the startup file on the disk will run. This startup file serves only to copy the program you've named "startup.file" to the root directory of the terminal with the new name "startup" - this will then run each time the terminal is booted, eliminating the need for the disk drive.