Another processor's variables
A cell for exchanging values isn't always needed: a neighbour's variable can be taken straight from it, by name
A processor is a block like a cell, and it is read the same way. Only the address is not a slot number but a variable’s name in quotes:
read theirLoops processor1 "loops"There are two processors on the map. The upper one simply counts its iterations; the lower one — the one whose program is shown — fetches that counter by name and prints it. There is no memory cell between them at all.
What can stand as the address
Section titled “What can stand as the address”| Address | What you get |
|---|---|
"loops" — the neighbour has such a variable |
its value, a number or an object |
"container1" — no such variable, but there is a link with that name |
the building connected to the neighbour |
"nonsense" — neither one nor the other |
emptiness |
0, 1, … as a number |
the neighbour’s link by index — the same as its getlink |
The second line of the example is exactly that: read enemyStore processor1 "container1".
The lower processor has no link to the store of its own, yet it can still ask it how much
copper it holds — the building is taken from the neighbour.
And on yourself too
Section titled “And on yourself too”@this is the processor itself, and it can be read the same way:
read copy @this "count"read block @this 0The first is a copy of your own variable, the second your own link by index — that is,
getlink in other words. There is no particular use in the first; the second is occasionally
handier.
Who a processor answers
Section titled “Who a processor answers”The check sits in the block itself, and it is short: it answers its own team and only non-world processors.
- another team’s processor — emptiness, even if it stands right there with a link;
- a world processor answering an ordinary one — emptiness: a privileged block answers only a privileged one;
- a world processor is answered by everybody, other teams included.
Writing obeys the same rules: what cannot be read cannot be overwritten either.
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.