PyMS
v1.2.1

By: poiuy_qwert
  1. Introduction
  2. PyGRP v3.8
  3. PyPAL v1.5
  4. PyLO v1.6
  5. PyTBL v1.7
  6. PyTRG v2.6
  7. PyDAT v1.11
  8. PyGOT v1.2
  9. PyAI v2.4
  10. PyICE v1.8
  11. PyFNT v1.2
  12. PyTILE v1.3
  13. PyPCX v1.0
  14. PyMPQ v1.0
PyAI v2.4

PyAI is used to convert AI scripts to and from TXT files.
  1. Changes
  2. Old Readme
  3. Commandline Options


Changes^

PyAI v2.4 PyAI v2.3 PyAI v2.2 PyAI v2.1 PyAI v2.0 PyAI v1.9 PyAI v1.8 PyAI v1.7 PyAI v1.6 PyAI v1.5 PyAI v1.4 PyAI v1.3 PyAI v1.2 PyAI v1.1 PyAI v1.0 PyAI v0.8 PyAI v0.7 PyAI v0.6 PyAI v0.5 PyAI v0.4 PyAI v0.3 PyAI v0.2 PyAI v0.1

Old Readme^

Temporary Information
 PyAI uses basically the same format as all other programs in
PyMS. The only difference is that when decompiling you need 2
input files, and when compiling you need 2 output files. So
for decompiling it is:
   python PyAI.py [options] -d <aiscript.bin> <bwscript.bin> [out]
Like the other programs, if you leave [out] blank it will
make up the filename, so it will take the aiscript.bin's
filename but with the .txt extension. To compile its:
   python PyAI.py [options] -c <inp> [aiscript.bin [bwscript.bin]]
If you dont supply the files for [aiscript.bin] and/or
[bwscript.bin], it will take the filename of <inp> and use
the .bin extension ([bwscript.bin] will get 'bw' added to the
front in this situation).

The coding in PyMS is not too much different then SCAIEdit
III's .asc3 format. The differences (:
 - For comments, instead of using semi-colons (';'), PyAI uses 
    hash's ('#')
 - Commands use perenthesis ('(' and ')')  to encapsulate the
    parameters, and commas (',') to seperate them
 - Strings (used in the debug command, which works with PyMS,
    BUT NOT SCAIEdit!!!!) use TBL formatting (so use <40> for
    an open parenthesis '(', <41> for a close parenthesis
    ')', and <44> for a comma ',')
 - Block labels are in the format '--Name--' instead of ':Name'
 - Jumping now supports external script jumps. To use them, the
    format is 'AIID:Label', where AIID is the ID of the script,
    and Label is the name of the block in that AI (used like a
    normal label in any jumping command)
 - PyMS has the option to use "Descriptive" command names when
    decompiling. You can also interchange the origional commands
    with the descriptive ones anywhere in your code.
 - Instead of using script_name and script_id, there is one
    header used to start an AI Script
 - Variables can now be defined. They have overflowing types, so
    if you define a 'building' variable, it will also work for a
    'unit' variable because... buildings are units. But if you
    define a 'military' variable, it will not work as a 'building'
    because it isn't a building.
 - Information Comments can be used to save descriptions of things
    in your AI in its compiled form. They are any text within a
    pair of braces ('{' and '}')
 - External Definition files can be supplied either with the -f
    (--deffile) option, or with the 'extdef' keyword

External Definition files are files that list common variables which
can be included in any aiscript. To use them in code all you do is
place an 'extdef' line anywhere in your code like so:
   extdef <file>
You can either supply the name of a file in the same folder as the
aiscript, or a full path to a file.
Information Comments come on the same line, or directly after a
variable declaration, block label, or AI Script header. They are
completely optionally. If its on the same line it must be at the
end (but still before normal comments), and can only my a single
line information comment. Single line information comments are in
the form {<comment>}, and multi-line information comments are in
the form (The braces must be on their own lines):
   {
   <comment>
   }
Note: Variables are saved to aiscript.bin, so if you dont keep
 your aiscript.bin with your bwscript.bin when you try to
 decompile the bwscript.bin, you will not get your variables.
You can set variables anywhere in your file, inside or outside
of your ai's, it doesn't matter. The syntax for a variable is:
   <type> <name> = <value>
Type is a paramater type like 'byte', 'building', etc. You can
view the different types in the reference (Note: Labels can NOT
but set to variables).
Every AI Script in your file must start with the declaration
header, formatted like so:
   <ID>(<String>, <Flags>, <Script>):
<ID> is the 4 letter ID for your script, or one of the keywords
Protoss, BWProtoss, Terran, BWTerran, Zerg, and BWZerg, which
represents PMCu, PMCx, TMCu, TMCx, ZMCu, and ZMCx respectivly.
<String> is the id number of the string in your stat_tbl.txt.
<Flags> is 3 ones or zeros (for example 000, 111, 101, 001, etc),
a 0 means a flag is unset, a 1 means a flag is set.
If the first flag is set, the AI script requires a location.
If the second flag is set, the AI script will not show up in
StarEdit. If the third flag is set, its a BW AI Script (DOES
NOT MEAN GOES IN bwscript.bin!). <Script> is either the keyword
aiscript, or the keyword bwscript and defines which bin file
it is compiled to. Under that you have your commands and blocks.
Here is an example of Terran 5 - Harvest Town (Te5H):
    # stat_txt.tbl entry 1054: Terran 5 - Terran Harvest Town<0>
    Te5H(1054, 011, aiscript):
        start_campaign()
        start_areatown()
        defaultbuild_off()
        default_min(0)
        wait(1)
        build(1, Terran Command Center, 150)
        build(4, Terran SCV, 130)
            --Te5H 0000--
        wait(1500)
        goto(Te5H 0000)


Commandline Options^

Option Long Option Description
-d --decompile Decompile AI's from aiscript.bin and/or bwscript.bin Default
-c --compile Compile AI's to an aiscript.bin and/or bwscript.bin
-e --extrainfo Save extra info from your script (variables, label names, and information comments) Default: Off
-u --units Specify your own units.dat file for unit data lookups Default: Default\units.dat
-g --upgrades Specify your own upgrades.dat file for upgrade data lookups Default: Default\upgrades.dat
-t --techdata Specify your own techdata.dat file for technology data lookups Default: Default\techdata.dat
-s --scripts A list of AI Script ID's to decompile, separated by commas Default: All
-a --aiscript Used to signify the base aiscript.bin file to compile on top of
-b --bwscript Used to signify the base bwscript.bin file to compile on top of
-l --longlabels Used to signify that you want decompiled scripts to use desriptive command names Default: Off
-x --stattxt Used to signify the stat_txt.tbl file to use Default: Default\stat_txt.tbl
-r --reference When decompiling, put a reference for commands and parameters Default: Off
-w --hidewarns Hides any warning produced by compiling your code Default: Off
-w --deffile Specify an External Definition file containing variables to be used when interpreting/decompiling Default: None
--gui Opens a file with the GUI




« PyGOT PyAI PyICE »