Globals
ActivatePaint
Activates the specified paint power on all players.
AddBranchLevelName
Adds a level to the specified branch's list.
AddCoopCreditsName
Adds a name to the coop credits list.
CreateEntityByName
Create entity by classname, setting the specified key values before spawn.
CreateProp
Create a physics prop, setting the specified model name and activity index. Prefer CreateEntityByName() for more flexibility.
CreateSceneEntity
Create a scene entity to play the specified scene.
DeactivateAllPaints
Deactivates all the paints on all players.
DeactivatePaint
Deactivates the specified paint power on all players.
DebugDrawBox
Draw a debug overlay box.
DebugDrawBoxAngles
Draw a debug overlay box with angles/
DebugDrawEntityText
Draw debug overlay entity text.
DebugDrawEntityTextAtPosition
Draw a debug overlay entity text at position.
DebugDrawGrid
Draw debug overlay grid.
DebugDrawLine
Draw a debug overlay line.
DebugDrawScreenText
Draw debug overlay screen text.
DebugDrawText
Draw debug overlay text.
DebugDrawTri
Draw a debug overlay triangle.
DispatchParticleEffect
Dispatches a one-off particle system, automatically cleaned up once finished.
DoIncludeScript
Implementation of IncludeScript(), use that instead.
EntFire
Generate an entity i/o event, searching by entity name.
EntFireByHandle
Generate an entity i/o event, directly targeting an entity by reference.
FindPortalByID
Finds a portal by linkage ID and portal number. Portal number 1 is the primary portal, 2 is the secondary. Linkage ID should be <255
FrameTime
Get the time spent on the server in the last frame
GetBluePlayerIndex
Return the player index of the blue player.
GetCoopBranchLevelIndex
Returns the current chosen level in the hub.
GetCoopSectionIndex
Section that the coop players have selected to load in the hub.
GetDeveloperLevel
Gets the level of the 'developer' console variable.
GetHighestActiveBranch
Returns which branches should be available in the hub.
GetMapIndexInPlayOrder
Determines which index (by order played) this map is. Returns -1 if entry is not found. -2 if this is not a known community map.
GetMapName
Get the name of the map.
GetNumMapsPlayed
Returns how many maps the player has played through.
GetOrangePlayerIndex
Return the player index of the orange player.
GetPlayer
Returns the player (SP Only).
GetPlayerByIndex
Gets the player by their index. This is a one-based index and must be in the range (1 <= index <= GetPlayerCount())
GetPlayerCount
Returns the number of connected clients, this will always be 1 for listen servers
GetPlayerSilenceDuration
Time that the specified player has been silent on the mic.
GivePlayerPaintgun
Gives all portal players the paint gun with no active paints.
GivePlayerPortalgun
Give player a monoportal portal gun.
IsCoOp
Is this a co-op game?
IsLevelComplete
Returns true if the level in the specified branch is completed by either player.
IsMultiplayer
Is this a multiplayer game?
IsPlayerLevelComplete
Returns true if the level in the specified branch is completed by a specific player.
LoopSinglePlayerMaps
Run the single player maps in a continuous loop.
MarkMapComplete
Marks a map as complete for both players.
PrecacheMovie
Precaches a named movie. Only valid to call within the entity's 'Precache' function called on mapspawn.
RandomFloat
Generate a random floating point number within a range, inclusive
RandomInt
Generate a random integer within a range, inclusive
RecordAchievementEvent
Records achievement event or progress.
RequestMapRating
Pops up the map rating dialog for user input
ScriptIsLocalPlayerUsingController
Is the local player using a controller?
ScriptPrintMessageCenterAll
Prints an alert message in the center print method to all players.
ScriptPrintMessageCenterAllWithParams
Prints an alert message in the center print method to all players, substituting parameters. Can pass null for parameters if you need less than 3.
ScriptPrintMessageCenterTeam
Prints an alert message in the center print method to the specified team.
ScriptPrintMessageChatAll
Prints a message in chat to all players.
ScriptPrintMessageChatTeam
Prints a message in chat to the specified team.
ScriptShowHudMessageAll
Show center print text message.
ScriptSteamShowURL
Bring up the steam overlay and shows the specified URL. (Full address with protocol type is required, e.g. http://www.steamgames.com/ )
SendToConsole
Execute the specified console command, as if run by the local player or server host.
SendToConsoleServer
Send a string that gets executed on the server as a ServerCommand.
SendToPanorama
Send an event to Panorama.
SetDucking
Set the level of an audio ducking channel
SetMapAsPlayed
Adds the current map to the play order and returns the new index therein. Returns -2 if this is not a known community map.
ShowMessage
Print a hud message on all clients.
Time
Get the current server time
TraceHull
Sweeps a hull along the specified line. Returns a CGameTrace with the trace result.
TraceLine
Trace a line, then return the fraction along line that hits world or models.
TraceLineEx
Given 2 points, ent to ignore (or array of ents to ignore), collision group and trace mask, returns a CGameTrace with the result.
TraceLinePlayersIncluded
Trace a line, then return the fraction along line that hits world, models, players or npcs.
TracePortalLine
Same as TraceLineEx, but will transform the trace based on any portals it passes through. If the last bool is true, it will transform based on the first portal it went though.
TryDLC1InstalledOrCatch
Always returns true. Used in Portal 2 to test if DLC1 was installed.
UniqueString
Generate a string guaranteed to be unique across the life of the script VM, with an optional root string. Useful for adding data to tables when not sure what keys are already in use in that table.
UpgradePlayerPaintgun
Upgrades the paint gun of all players, if they are not holding one it will give them one.
UpgradePlayerPortalgun
Upgrade the player's held gun to shoot both portals.
UpgradePlayerPotatogun
Add Potatos to the player's held portal gun, and force it to be a dual device.