What you will end up with
A CC:Tweaked computer that, on every boot, automatically clears the screen, prints a welcome message, and displays the current time. You can then extend the script to do anything you like — run programs, check inventories, or start a monitor display.
What you need
- A Computer or Advanced Computer (from CC:Tweaked)
- Basic familiarity with the CC:Tweaked terminal (typing commands)
startup or startup.lua
from the root of the computer's filesystem on every boot. This is the standard way
to automate a computer without any extra configuration.
Step by step
- Place a Computer block and right-click it to open the terminal.
-
Create the startup file using the built-in editor:
edit startup.lua
-
Type the following program into the editor:
-- startup.lua -- Runs automatically on every boot term.clear() term.setCursorPos(1, 1) print("=== AIVONI MC ===") print("") print("Server: mc.aivoni.eu") print("Time: " .. textutils.formatTime(os.time(), true)) print("") print("Computer ready.")
- Save and exit: press Ctrl, select Save, then press Ctrl again and select Exit.
-
Reboot the computer to test:
rebootThe script should run immediately on startup.
How it works
When CC:Tweaked boots a computer it looks for a file named startup
or startup.lua in the root directory and executes it automatically.
No special registration is needed — just the file name.
The script above uses a few standard CC:Tweaked APIs:
term.clear()— clears the terminal screenterm.setCursorPos(1,1)— moves the cursor to the top-left corneros.time()— returns the current in-game timetextutils.formatTime()— formats the time as a readable string
Running another program from startup
If you want the startup script to launch another program (for example your monitor display),
use shell.run() at the end of startup.lua:
shell.run() runs the program and waits for it to finish before continuing.
If your program runs in an infinite loop, the startup script will stay in that loop —
which is usually exactly what you want for a permanent display or monitor program.
Editing startup after a reboot
If the startup script runs an infinite loop, you can interrupt it by holding Ctrl + T for about two seconds. This terminates the running program and returns you to the shell, where you can edit the file again.