Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/twhl-community/halflife-unified-sdk/llms.txt

Use this file to discover all available pages before exploring further.

The Half-Life Unified SDK integrates AngelScript as its embedded scripting language. In the current SDK, AngelScript is primarily used for conditional evaluation inside configuration files, allowing settings to be included or excluded based on the current game state at runtime.
AngelScript scripting support uses the logger named angelscript. Direct this logger to the appropriate output channel when debugging conditional expression failures.

Conditional Evaluation

Some configuration files support conditional evaluation to selectively include settings. This mechanism uses AngelScript to evaluate a boolean expression at runtime. When a conditionally evaluated string is encountered, the SDK wraps it in a function body and compiles it as a complete AngelScript script:
bool Evaluate()
{
	return condition;
}
The string you write in the configuration file becomes the condition expression inside this function. The function is compiled, executed, and its bool return value determines whether the associated configuration block is applied.
Conditional evaluation will time out after 1 second if the script takes too long to execute. Make sure expressions remain simple and do not perform expensive operations.

Conditional Evaluation API

The following constants and values are available inside any conditionally evaluated expression.

Constants

ConstantTypeDescription
Singleplayerbooltrue if the game is running in singleplayer mode
Multiplayerbooltrue if the game is running in multiplayer mode
ListenServerbooltrue if the server is hosted by a player (listen server)
DedicatedServerbooltrue if the server is running as a dedicated server
GameModestringThe name of the currently active game mode
The GameMode constant contains the string name of the active game mode. See the Game Modes page for a full list of available game mode names.

Build docs developers (and LLMs) love