Command Line Interface

Sc2gears has a command line interface. With this you can use Sc2gears to extract info from StarCraft II replays. This interface allows other programs and web sites of any technology/programming language to use Sc2gears as a replay parser and build on top of it.

Also check out the Parsing Service which might be more suitable for sites and it offers more features.

The command line interface supports extracting general info (that is displayed on the Game info tab in the Replay analyzer), the complete action list and the in-game chat.

Type the --help parameter to get help about using the command line interafce:

Displaying usage help

On Windows: "Sc2gears-win.cmd --help"

On OS-X: "./Sc2gears-os-x.command --help"

On Linux: "./Sc2gears-linux.sh --help"

Google Ads

Here is the help message on Windows:

Help message

Sc2gears 8.4 Command Line Interface

Usage:

Sc2gears-win.cmd ACTION [ACTION_ARGS1] [ACTION_ARGS2] [...] [replayFile]

Possible values of ACTION:

--print-game-info Prints general info about the specified replay

ACTION_ARGS:

--xml-output Uses XML output format instead of plain text

--print-action-list Prints the complete action list of the specified replay

ACTION_ARGS:

--no-inaction Excludes the Inaction action types

--use-frames Overrides the setting and uses frames to display time

--use-seconds Overrides the setting and uses seconds to display time

--print-in-game-chat Prints the in-game chat of the specified replay

ACTION_ARGS:

--print-blinks Overrides the setting and includes the minimap pings

--no-blinks Overrides the setting and excludes the minimap pings

--print-targets Overrides the setting and includes the message targets

--no-targets Overrides the setting and excludes the message targets

--help Displays this help

For more information please visit https://sites.google.com/site/sc2gears/features/command-line-interface

The output is written to the standard output using UTF-8 character encoding. If everything was OK, Sc2gears returns with a code of 0, else a non-zero error code will be returned.

If everything was OK, five minus signs are printed to the output which is followed by the ACTION parameter. The output of Sc2gears (the info that is requested) is printed after this.

Tip: You can redirect the standard output to a file with the '>' character, so you can process the file later. This works on all operating systems:

Output redirection to file:

On Windows: "Sc2gears-win.cmd --print-game-info a.SC2Replay >a.txt"

On OS-X: "./Sc2gears-os-x.cmd --print-game-info a.SC2Replay >a.txt"

On Linux: "./Sc2gears-linux.cmd --print-game-info a.SC2Replay >a.txt"

Note: On windows you have to use the batch file (Sc2gears-win.cmd) if you want to use the command line interface because the exe does not create a console.

Note #2: You have to specify replay parameters relative to the Sc2gears folder or as an absolute path. The reason for this is that the launcher scripts contain a command to set the folder of Sc2gears as the working folder. It is required for the referenced Java libraries to be linked properly regardless of which folder you start it from. Just use absolute file paths and no problem should occur.