Flag Operators Library

Flags are lists of properties you can check-mark, like the "flags" entry of a units in the data editor. The bit flag operators are missing from the editor, and are necessary to use your own flag presets, so I created a library of basic operations:

  • Variable - Modify Flags (set, clear, shift)
  • General - For Each Flag
  • General - For Each Flag by Index
  • General - For Each Flag Matching Conditions
  • General - For Each Flag Matching Conditions by Index
  • Conversions - Convert Preset to Integer
  • Index - Index of Single Flag
  • Logic - Flags Match Filters (any, all)
  • Logic - Flags And/Or
  • Logic - Flags Exclusive Or
  • Logic - Flags Not

All these but "index of bit flag" internally use a concept called macros, so there's no overhead compared to scripting it directly (the function calls are replaced with the actual operations when compiled, and the functions disappear completely). The map has an example bit flag preset variable, and functions useful to work around the editor bug with setting flag values.

Note: The import/export library functions of the editor are broken (hint and grammar text erase when you use import), so follow the method detailed in this post: Library Import/Export Bug

If you have any questions or problems, just ask in a private message.

Example map using library