Skip to content

Set Flag

Shared memory for the whole map: not a number and not an object, just a «yes» under a name

tick 0
Get Flag0
resultflag
Jump -> 41
if
Print2
Print Flush3
Operation4
=
End5
@counter0number
alarmnullnull
checksnullnull
setflag "alarm" true

After two seconds the lower processor raises a flag, the upper one sees it and prints a warning. There is no link between them — only a shared flag name.

Field What is in it
first the flag’s name: a string, not a variable
second the value: true or false

A flag’s value is one of two. A number, an item or a unit cannot be put into it: any value is reduced to truth by the same rules as in jump — zero and emptiness are false, everything else is true.

setflag "waveIncoming" 1 # true
setflag "waveIncoming" 0 # false
A flag A memory cell
what it holds “yes” or “no” any numbers and objects
how many as many names as you like 64 or 512 slots
who sees it any processor on the map only those linked to it
where it lives in the running game in a block on the map
who else reads it the map’s objectives nobody

The last row is the main one. Flags are the shared language of a world processor and the map’s objectives: the editor has a “such and such flag is raised” condition, and it is satisfied by exactly this set.

So a script is usually built like this: the processor watches what happens and raises a flag, and the map’s objective sees it and marks the task done.

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.