Skip to content

A program is text

Assembled from blocks, stored as lines — and that is worth using

Under the program window there is an “Edit…” button. It opens a small window with four lines:

  • “Clear” — delete the whole program, with a confirmation;
  • “Copy to clipboard” — put the program into the clipboard as text;
  • “Paste from clipboard” — replace the program with whatever is in the clipboard;
  • “Restart” — start running from the first line.

The middle two are the most useful thing in the window, and the least noticed.

Here is the example from the previous lesson:

tick 0
Set0
=
Operation1
=
Operation2
=
@counter0number
stocknullnull
doublednullnull
totalnullnull

And here is the same thing copied to the clipboard — exactly what lands in a chat if you press “Copy to clipboard” and paste:

set stock 10
op mul doubled stock 2
op add total doubled 5

One block line, one text line: the instruction’s name, then its fields in order. There is no second language here; it is the same program, just written down.

The most common beginner’s mistake in a help chat is sending a schematic (.msch). To read ten lines the other person has to download a file, launch the game, find an empty spot, paste the schematic, click the processor and open the program window.

Text reads right there in the message: from a phone, from a browser, in ten seconds. Copy, paste into the chat. The answer comes sooner simply because helping got cheaper.

Someone else’s text from a chat goes in with “Paste from clipboard” and is parsed back into blocks. Nothing has to be retyped — neither theirs into yours, nor yours out of your notes.

It is just as handy for keeping drafts: a program in a note on your phone outlives a processor on a map that will one day be demolished.

What to do when the program is pasted and works wrong is in the lesson “The variables window”.

Unofficial fan project, not affiliated with Anuke. Mindustry sprites, fonts and translations © Anuke, used under GPL-3.0; Fira Code under OFL-1.1. Site code is GPL-3.0.