srctools.run

Code which handles executing and interfacing with game binaries.

srctools.run.run_compiler(name: str, args: ~typing.List[str], logger: ~logging.Logger = <LoggerAdapter srctools.<compiler> (WARNING)>, change_name: bool = True) int

Execute the original vbsp, vvis or vrad.

The provided logger will be given the output from the compiler. The process exit code is returned.

srctools.run.get_compiler_name(program: str) str

Get the real executable name for VBSP or VRAD.

srctools.run.send_engine_command(
command: bytes,
*,
classname: str = 'Valve001',
) None

Send a command to a Source Engine game, using the mechanism -hijack uses.

If a Source Engine game is currently running, the string will be executed as if it was typed into the console. This is only functional on Windows, since it uses the WM_COPYDATA mechanism.

Parameters:
  • command – The command to execute. For multiple commands use ; as a separator.

  • classname – The classname of the window to look for. This should be Valve001, but it is possible other branches may have changed this.

Raises:
  • LookupError – If the game could not be found.

  • OSError – If this is not running on Windows.

  • ValueError – If the command failed to execute.