SCRMaps
/
Sign in

Writing your own AI script

Attacking with the composition you want, when you want it, means replacing aiscript.bin itself.

6 min read

Choosing from the stock list runs out quickly. If you want a Zerg computer to come with Zerglings and Mutalisks, or to attack at exactly seven minutes with a particular composition, nothing on the list does it.

AI scripts live in aiscript.bin and bwscript.bin inside StarCraft. Replace aiscript.bin with a file containing your own and they appear in the Run AI Script list - the same principle as FileManager substituting a tbl.

  1. 1Open aiscript.bin in PyAI, part of PyMS. It needs Python 2.7 and PIL.
  2. 2Open Default Scripts to read the stock ones - not to edit them, but to see how they are written.
  3. 3Write your script, save, and put that bin into the map.

The folder you unpack PyMS into must not have a Korean name. And workers count as buildings in these opcodes - miss that and any command that counts units is off.

The opcodes fall into seven groups: header, build and attack and defend, flow control, multi-thread, miscellaneous, StarEdit, and the unused ones. All 113 are on the reference page.

Some descriptions on the reference page carry a ⚠. Those are where a reader corrected the original article - most notably wait_train, which despite its name and description does not train a unit.

All 113 AI opcodes
Sign in to track your progress