ValveExe¶
- class valveexe.ValveExe(gameExe, gameDir, steamExe=None, appid=None, console='exec', lan=True)[source]¶
- __init__(gameExe, gameDir, steamExe=None, appid=None, console='exec', lan=True)[source]¶
Defines a launchable source engine game to be interacted with.
Note
Some games cannot be launched by their .exe alone (ex:csgo, probably for anti-cheat related reasons). Those games need to include the optional parameters
steamExeandappid. Those parameters are only to be used if absolutely needed, they are a fallback and will downgrade ValveEXE functionnality if present.- Parameters:
gameExe (path, str) – the path for the game executable.
gameDir (path, str) – The mod directory.
steamExe (optional, path, str) – The path for the Steam executable.
appid (optional, int) – The Steam AppID.
console (optional, str) – Which console backend drives the game:
EXEC(default),RCON, orAUTOto pick by capability. Stated rather than detected, so a run behaves the same every time.lan (optional, bool) – Launches with
sv_lan 1, so a listen server never asks Steam to validate the client’s own auth ticket. A Steam client left holding a stale ticket (from a game that was killed or crashed) otherwise kicks every later session with “Invalid STEAM UserID Ticket” until Steam is restarted. Turn off only when the game has to host or join a real, Steam-authenticated server.
- launch(*params)[source]¶
Launches the game as specified in
__init__with the launch parameters supplied as arguments.- Parameters:
*params (str) – The launch parameters to be supplied to the executable.
- run(command, *params)[source]¶
Forwards a command with its parameters to the active
VConsole- Parameters:
command (str) – A Source Engine console command.
*params (str) – The values to be included with the command.
- quit()[source]¶
Closes the game client.
Asks it to
quitfirst, and only kills it if it is still up afterQUIT_TIMEOUT. A killed game never ends its Steam session: the Steam client keeps the dead game’s auth ticket, and every game started after that is kicked with “Invalid STEAM UserID Ticket” until Steam itself is restarted.
- cleanup(quitGame=None)[source]¶
Undoes everything this instance did, and leaves nothing running.
Resets
con_logfilewhile the game can still hear it, closes the console, removes the config and log files this instance created, and closes a game it launched.Safe to call more than once, from a failure path, or after the game has already gone: it never waits on a process that is not there, and never touches a game this instance did not launch.
- Parameters:
quitGame (optional, bool) – Whether to close the game. Defaults to closing it only when this instance launched it, never when it hijacked one that was already running.