UserInterfaceLocal

From Mod Wiki
Revision as of 12:09, 21 November 2007 by JRAD (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Class Tree

Overview

This is the GUI itself, all window defs must be inside it. You may set properties, flags, cache materials, cache sounds, set atmospheres and add events directly on the GUI. GUI script functions may be called from any event or timeline by using a "gui." prefix to the function name.

Example:

gui guis/vehicles/edf_titan {
	// Properties for the GUI.
	properties {
		float flags = immediate( flags ) | GUI_FULLSCREEN;
	}
	_class_icons

	// Cache the titan icon material.
	materials {
		"icon"		"guis/assets/hud/gdf/vehicles/titan"
	}

	_base_icon // Template: setup background material, player list, etc.
	_hud_materials // Template: Cache all materials used in the HUD.
	_position( 0, 2, 10 ) // Template: Setup icon for player position 0
	_position( 1, 2, 24 ) // Template: Setup icon for player position 1

	// Template: Draw a generic GDF missile sight.
	_gdf_generic_missile_sight( "dontshowlines", "0,0,0,1", "0,0,0,1" )
}

Properties

UserInterfaceLocal Properties

Flags

UserInterfaceLocal Flags

Functions

Evaluator Functions

compare                            String comparison.
icompare                           Case insensitive string comparison.
wcompare                           Wide string comparison.
iwcompare                          Case insensitive string comparison. Ignores color codes.
hcompare                           Compare handles.
toString                           Float to string conversion.
toWString                          Float to wide string conversion.
toFloat                            String value converted to a float.
localizeArgs                       Localize text with additional string arguments.
localizeHandle                     Localize text given a text declaration handle.
localize                           Localize text.
square                             Squares the input value.
vec2Length                         Length of a 2D vector.
vec2Normalize                      Normalize a 2D vector.
abs                                Absolute value of a float.
min                                Returns the minimum of two values.
max                                Returns the maximum of two values.
clamp                              Clamp value between min and max.
msToHMS                            Converts from milliseconds to hours, minutes, seconds.
sToHMS                             Converts from seconds to hours, minutes, seconds.
toggle                             Returns the opposite boolean value of the input value.
floor                              The floor of the input value.
ceil                               The ceiling of the input value.
toUpper                            Convert a string to upper case.
toLower                            Convert a string to lower case.
toWStr                             Convert a string to a wide string.
toStr                              Convert a wide string to a string.
isValidHandle                      Check if handle is valid.
floatToHandle                      Convert a float to a handle.
color                              Convert a string to a color.
strLen                             Length of the string.
wstrLen                            Length of the wide string.
sin                                Sine of the input value.
cos                                Cosine of the input value.
colorForIndex                      Color for the index where the index is between 0 and 31.
stringToVec4                       Convert a string to a 4D vector.

Utility Functions

consoleCommand                     Exectue a console command, append to the command buffer.
consoleCommandImmediate            Exectue a console command, immediate execution of the command.
playSound                          Play a sound in the current sound world.
playGameSound                      Play a sound in the game sound world.
playMusic                          Play a sound on the music channel.
stopMusic                          Stop any sound on the music channel.
querySpeakers                      Desired number of speakers.
fadeSoundClass                     Fade a sound class to a volume in X milliseconds.
cacheMaterial                      Store a material to the material cache.
activate                           Activate the GUI if it is not active. Calls onActivate events for windows.
deactivate                         Deactivate the GUI. Calls onDeactivate events for windows.
sendCommand                        Send a script command, The GUI must be attached to an entity. Script event OnNetworkMessage for the player will be called with the command data.
sendNetworkCommand                 Send a script command. Script event OnNetworkMessage for the player will be called with the command data.
postNamedEvent                     Call a named event.
postNamedEventOn                   Call a named event on a window.
scriptCall                         Call a script event on the entity this GUI is bound to. The script parameters should be pushed.on the stack using scriptPush<type>() script calls.
setCookieString                    Set a key/val which will be saved in the user profile.
getCookieString                    Return value for the key.
setCookieInt                       Set an integer key/val which will be saved in the user profile.
getCookieInt                       Return integer value for the key.
setShaderParm                      Sets a shader parameter value. This is for example used while drawing the command map so different material stages can be used depending on if the command map is drawn in a circle or a rectangle
getKeyBind                         Get the key for a binding.
print                              Print a string to the console. _newline or _quote should be used instead of the escape characters \n and \" respectively.
getStringForProperty               Get string for a window property.
setPropertyFromString              Set a property from a string.
broadcastEvent                     Broadcast a named event to a window. If no window is specified post the event on the GUI.
broadcastEventToChildren           Broadcast an event only to immediate children.
broadcastEventToDescendants        Broadcast an event recursively to all children.
getParentName                      Get parent name.
copyHandle                         Copy a handle. Should be used instead of immediate for integers.
activateMenuSoundWorld             Activates the menu sound world and pauses the game sound world or deactivates the menu sound world and unpauses the game sound world.
getStringMapValue                  Get value for a key for the give string map def. Used to cache crosshair material used by the player.
isBackgroundLoadComplete           Check if loading of menu models (earth/stars/strogg fleet etc.) has been loaded.
copyText                           Copy the text to the clipboard.
pasteText                          Copy the clipboard data.
uploadLevelShot                    Upload an image to a target image. Used for map screenshots.
getGameTag                         Game build name.
getLoadTip                         Get a load tooltip intended for the map loading screen.
cancelToolTip                      Set float property active to false for the toolTip window.
checkCVarsAgainstCFG               Used in game options to check the machine spec the user has chosen.
collapseColors                     Collapse all color codes.

Game Functions

getSpectatorList                   List of spectators separated with commas. Used with the marquee window type for scrolling.
getTeamPlayerCount                 Get the number of players on a team.
getWeaponData                      Get weapon value given a key. Mainly used for getting model and model/joint names for player in the limbo menu.
getNumWeaponPackages               Get number of weapon packages for a class.
getWeaponBankForName               Get bank number for slot name.
updateLimboProficiency             Set new player class and update the proficiency related limbo properties. Used for updating limbo properties when selecting a class.
getRoleCountForTeam                Number of players with a specific role on a team.
getEquivalentClass                 Get the equivalent class on the target team to the class on the current team.
getClassSkin                       Get skin name for class.
toggleReady                        Toggle the local player to be ready during warmup.
execVote                           Execute a vote on client or listen server. The vote index then the vote key should have been pushed on the GUI stack before calling this function.
getCommandMapTitle                 Get the command map title for a playzone on the current map.
getPersistentRankInfo              Get the current rank or rank material name for the local player.
setSpawnPoint                      Set the current spawn point for the local player. Send the name to the server if a client.
highlightSpawnPoint                Call script event OnHighlight on the spawnpoint for the team.
mutePlayer                         Toggle mute for a player.
spectateClient                     Spectate a specific client, works on client and listen server.
chatCommand                        Send a chat command.

CVar Functions

setCVar                            Set a cvar.
getCVar                            Get a cvar value.
resetCVar                          Reset a CVar, gives it the default value.
setCVarFloat                       Set a cvar.
getCVarFloat                       Get a cvar value.
setCVarInt                         Set a cvar.
getCVarInt                         Get a cvar value.
setCVarBool                        Set a cvar.
getCVarBool                        Get a cvar value.
getCVarColor                       Get a cvar value.
isCVarLocked                       Check if a CVar has the CVAR_GUILOCKED flag set.

Stack Functions

scriptPushString                   Push a string on the stack.
scriptPushFloat                    Push a float on the stack.
scriptPushVec2                     Push a vec2 on the stack.
scriptPushVec3                     Push a vec3 on the stack.
scriptPushVec4                     Push a vec4 on the stack.
scriptGetWStringResult             Pop a wide string from the stack.
scriptGetStringResult              Pop a string from the stack.
scriptGetFloatResult               Pop a float from the stack.
scriptGetVec2Result                Pop a vec2 from the stack.
scriptGetVec4Result                Pop a vec4 from the stack.
pushGeneralString                  Push a string on the stack with the given name. Any literal stack name is valid.
popGeneralString                   Pop a string on the stack with the given name. Any literal stack name is valid.
getGeneralString                   Get the string on the top of the stack with the given name, does not pop the stack. Any literal stack name is valid.
generalStringAvailable             Check if a stack with the given name is available.
clearGeneralStrings                Clear the stack with the given name.

Events

onCreate                           Called on window creation
onActivate                         This happens when the GUI is activated.
onDeactivate                       This happens when the GUI is activated.
onNamedEvent                       Called when one of the events specified occurs
onPropertyChanged                  Called when one of the properties specified occurs
onCVarChanged                      Called when one of the CVars' value changes
onCancel                           Called when any key bound to the _menuCancel is pressed