GUIs: Properties

From Mod Wiki

Overview

Global properties can be accessed from anywhere in the GUI and is used for communicating with the gamecode and game scripts.

The global properties have been grouped together into a few groups:

  • Player properties - Anything relating to the player.
  • Limbo properties - Limbo menu properties should only used in the limbo menu.
  • Admin properties - Used in the admin system tab in the limbo menu for enabling/disabling lists/buttons for the local player.
  • Global properties - Communicating with the game scripts.
  • SDNet properties - Used for session and account management.

Player Properties

These properties are always read only and are always related to the local player or the local view player (the one you're spectating), see the reference for the specifics and a description for each of the properties

The type of properties found in this category are:

  • Player - Health, view direction, XP, spectating, is dead, etc.
  • Vehicle - in a vehicle, in siege mode, in third person, vehicle has been EMPed, etc.
  • Weapon/Damage - ammo in clip, total ammo, last kill message,
  • Fireteam/Missons - Last task received, task status, in a fireteam, is fireteam leader, etc.
  • Match/Team - Team name, winning time, in warmup, current match time, etc.
  • Voting properties
  • Tooltip properties

Example:

The health bar is set like this (in guis/game/hud/hud.gui), the position property will continually be updated whenever the player health updates.

windowDef healthFill {
	type progress;
	properties {
		float 	position = player.health / player.maxHealth;
		...
	}
	...
}

Limbo Properties

These properties are always read only. See the limbo propereties reference for a reference of all the limbo properties.

Example: Whenever the limbo menu (in guis/game/limbo/limbo.gui) is activated it saves the current team and class selection among other things:

gui limbo {
	...
	events {
		onActivate {
			...
			// Read the immediate value of limbo.teamName.
			teamSelection 		= immediate( limbo.teamName );
			if( icompare( teamSelection, "spec" ) == false ) {
				lastTeamSelection	= immediate( teamSelection );
			}

			// Save the current class selection for the player.
			classSelection 		= limbo.role;
			...
		}
		...
	}
	...
}

Admin Properties

These properties are always read only. See the admin propereties reference for a reference of all the admin properties.

Example:

The visibility of the bot options in the admin menu (in guis/game/limbo/tabpages/admin.include) depends on if the admin.canAdjustBots property is true.

windowDef lytPlayComp {
	type layoutVertical;
	properties {
		// Draw windows from bottom to top instead of top to bottom.
		float flags = VLF_DRAW_REVERSED;
		// Only visible if the player can adjust bot settings.
		float visible = admin.canAdjustBots;
		vec4 margins = 0, 0, 0, 0;
		rect rect = 0, 0, gui.lytBotCommands.rect.w - $evalfloat( 2 * PADDING ), 100;
	}
	// Include all the bot settings.
	#include <guis/common/bots.include>
}

Global Properties

Found in guis/globals.gui these are mainly used for communicating between GUIs and to the game scripts. They may be set/modified from either the GUIs, gamecode or the game scripts.

There are a few categories of global properties:

  • game - game is running or not
  • gameHud - Many properties related to updating the HUD, updated from the game scripts.
  • mcpObjective - MCP objective properties, updated from the game scripts.
  • constructObjective - Constructible objective properties, updated from the game scripts.
  • hackObjective - Hack objective properties, updated from the game scripts.
  • docObjective - Carryable item objective properties, updated from the game scripts.
  • goalObjective - Carryable item goal objective properties, updated from the game scripts.
  • flyerhiveObjective - Flyer drone objective properties, updated from the game scripts.
  • destroyObjective - Destructible objective properties, updated from the game scripts.
  • weapons - Some weapon related properties like charge, is cooling, etc. Updated from the game scripts.
  • armTool - arming tool. Updated from the game scripts.
  • charge - Charge timer, updated from the game scripts.
  • deployables - Deployable information, updated from the game scripts.
  • vehicles - Vehicle information, updated from the game scripts.
  • mapinfo - map/objective information updated by the game scripts.
  • progressBar - Progress bar when liberating/arming/hacking, etc. Updated by the game scripts.
  • messageBox - Used for messages boxes (connecting to a game, disconnected, etc.).
  • introMovies - Intro movie properties.
  • campaignInfo - Information about the campaign, updated from the gamecode.

These properties may be accessed like this:

globals.<category>.<property>

Like this used for checking if the data brain/briefcase is at home or not:

if ( globals.docObjective.state == CARRYABLE_ITEM_HOME ) {

globals.gameHud.spawnHostActive is updated by the game scripts similar to this, where the GUI then makes sure to create/delete a notify icon on the HUD whenever the property changes:

void spawn_host::OnSpawnPointSelected( float isDefault ) {
	SetupCommandmapIcon();

	sys.setGUIFloat( GUI_GLOBALS_HANDLE, "gameHud.spawnHostActive", 1 );
}

SDNet Properties

SDNet properties are related to the current user.