Get Flag
The other side of setflag — and the only way to learn that something happened somewhere on the map
getflag alarm "alarm"jump 4 equal alarm 0The order of the fields is the reverse of what setflag accustoms you to: first where to put
it, then the name. As with read and sensor — the result always comes first.
| Field | What is in it |
|---|---|
| first | where to put the answer: 1 or 0 |
| second | the flag’s name as a string |
An unset flag answers with zero, not emptiness: asking about any name is safe, and there is no need for a separate “does such a flag exist” check.
What this is for on ordinary processors
Section titled “What this is for on ordinary processors”getflag and setflag are world-processor instructions, and an ordinary one will not run them.
But a flag still reaches the map: through objectives.
A script on a map usually looks like this:
- the world processor watches what happens and raises a flag;
- the map’s objective, set to that flag, is marked complete;
- the player sees a tick in their task list.
World processors also talk to one another with flags — that is cheaper and more reliable than a memory cell: no link is needed and no building can be destroyed.
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.