Hello World
You need: one Programmable Computer. Nothing else.
Write it
Section titled “Write it”- Place the computer and right-click it with an empty hand.
- Select Open Editor. Select all the text with Ctrl+A and delete it.
- Type this program:
on startup { print("Hello, world!")}- Select Save & Apply. The computer’s screen turns green: the program is running.
- Select Debug ▸ in the editor. Under Output you see Hello, world!
on startup runs once, when the program starts. print writes a line to the program’s output.
Count something
Section titled “Count something”Programs can remember things in globals. A global keeps its value even when the program stops and starts again.
global ticks = 0
on startup { print("Starting the clock")}
on timer.every(20) { ticks++ print(str(ticks) + " seconds")}on timer.every(20) runs every 20 game ticks, about once a second. ticks++ adds one to ticks, and str(ticks)
turns the number into text so it can be joined with " seconds".
Select Stop, then Start / Restart: the count continues where it was, because ticks is a global.
What you learned
Section titled “What you learned”- Programs are made of event handlers that start with
on. printshows text in the debug panel’s Output.globalvalues are saved.
Next: build an intruder alarm, or learn more about the language in values and variables.