Instructions
Every instruction of the language, named as in the game. Descriptions are official, from the Mindustry bundles (v160.4).
Input & Output
Modify contents of memory blocks and processor buffers.
- read ReadRead a number from a linked memory cell. Can also read from variables in other processors.
- write WriteWrite a number to a linked memory cell. Can also write to variables in other processors.
- draw DrawAdd an operation to the drawing buffer. Does not display anything until Draw Flush is used.
- print PrintAdd text to the print buffer. Does not display anything until Print Flush is used.
- printchar Print CharAdd a UTF-16 character or content icon to the print buffer. Does not display anything until Print Flush is used.
- format FormatReplace next placeholder in text buffer with a value. Does not do anything if placeholder pattern is invalid. Placeholder pattern: "{number 0-9}" Example: print "test {0}" format "example"
Block Control
Interact with blocks.
- drawflush Draw FlushFlush queued Draw operations to a display.
- printflush Print FlushFlush queued Print operations to a message block.
- getlink Get LinkGet a processor link by index. Starts at 0.
- control ControlControl a building.
- radar RadarLocate units around a building with range.
- sensor SensorGet data from a building or unit.
Operations
Logical operations.
- set SetSet a variable.
- op OperationArithmetic and logic: computes two values with the chosen operation and puts the result into a variable.
- select SelectConditionally set a variable to one of two values.
- lookup LookupLook up an item/liquid/unit/block type by ID. Total counts of each type can be accessed with: @unitCount / @itemCount / @liquidCount / @blockCount For the inverse operation, sense @id of the object.
- packcolor Pack ColorPack [0, 1] RGBA components into a single number for drawing or rule-setting.
- unpackcolor Unpack ColorUnpack RGBA components from a color that was packed using Pack Color.
Flow Control
Manage execution order.
Unit Control
Give units commands.
- ubind Unit BindTakes control of a unit of the given type. Units of your own team are cycled through: every call gives the next one, and each processor has a counter of its own. A unit object may be passed instead — then that exact unit is taken.
- ucontrol Unit ControlA command to the bound unit: move, shoot, mine, build, take and drop items.
- uradar Unit RadarLooks for a target around the bound unit — the same as
radar, only the unit is doing the looking, not a block. - ulocate Unit LocateFinds the nearest thing on the map: an ore deposit, a building of the right kind, a core or a drop point.
World
Control how the world behaves.
- query QueryQueries units/buildings in a specified area. Results are outputted into @queries. Results can be read from @queries using the Read instruction and an index. Length of @queries can be sensed using @size as a parameter.
- getblock Get BlockGet tile data at any location.
- setblock Set BlockSet tile data at any location.
- spawn Spawn UnitCreates a unit at the given point.
- bullet Spawn BulletFires a bullet from a point in the given direction.
- status Apply StatusApplies a status effect to a unit or clears it.
- weathersense Weather SenseCheck if a type of weather is active.
- weatherset Weather SetSet the current state of a type of weather.
- spawnwave Spawn WaveSpawn a wave.
- setrule Set RuleSet a game rule.
- message Flush MessageShows the player the accumulated text buffer: as a hint, an announcement or a window.
- cutscene CutsceneManipulate the player camera.
- effect EffectCreate a particle effect.
- explosion ExplosionCreate an explosion at a location.
- fetch FetchLookup units, cores, players or buildings by index. Indices start at 0 and end at their returned count.
- sync SyncSync a variable across the network. Limited to 20 times a second per variable.
- clientdata Client DataSends an arbitrary value on a channel to the game clients. It is not in the instruction menu: it is made for mods.
- getflag Get FlagCheck if a global flag is set.
- setflag Set FlagSet a global flag that can be read by all processors.
- setprop Set PropSets a property of a unit or building.
- playsound Play SoundPlays a sound. Volume and pan can be a global value, or calculated based on position.
- playmusic Play MusicPlays a music track by name, e.g. "game1". If interrupt is true, the previously playing music will be stopped. Playing with null music and interrupt set to true will stop the current track. Note that music from data patches must be prefixed with dp-.
- setmarker Set MarkerSet a property for a marker. The ID used must be the same as in the Make Marker instruction. null values are ignored.
- makemarker Make MarkerCreate a new logic marker in the world. An ID to identify this marker must be provided. Markers currently limited to 20,000 per world.
- localeprint Locale PrintAdd map locale property value to the text buffer. To set map locale bundles in map editor, check Map Info > Locale Bundles. If client is a mobile device, tries to print a property ending in ".mobile" first.
Unknown
Uncategorized instructions.
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.