Portal 2/Scripting/Script Functions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Forgot to add category at the bottom)
(Reformatted with tables)
Line 1: Line 1:
Copied from the portal 2 console. Still need to get around to fomatting this for better wiki use.
{{sq}} This list contains all engine-related Squirrel functions available for [[VScript]] in [[Portal 2]].


<div>
== [[CBaseAnimating]] ==
<pre style="font-size:14px;">
{| class="standard-table" style="width: 100%;"
! Function
! Signature
! Description
|-
| <code>GetAttachmentAngles</code>
| <code>Vector CBaseAnimating::GetAttachmentAngles(int)</code>
| Get the attachement id's angles as a p,y,r vector
|-
| <code>GetAttachmentOrigin</code>
| <code>Vector CBaseAnimating::GetAttachmentOrigin(int)</code>
| Get the attachement id's origin vector
|-
| <code>GetObjectScaleLevel</code>
| <code>int CBaseAnimating::GetObjectScaleLevel()</code>
| The scale size of the entity
|-
| <code>IsSequenceFinished</code>
| <code>bool CBaseAnimating::IsSequenceFinished()</code>
| Ask whether the main sequence is done playing
|-
| <code>LookupAttachment</code>
| <code>int CBaseAnimating::LookupAttachment(string)</code>
| Get the named attachement id
|-
| <code>SetBodygroup</code>
| <code>void CBaseAnimating::SetBodygroup(int, int)</code>
| Sets a bodygroup
|}


Function:    AddBranchLevelName
Signature:  void AddBranchLevelName(int, string)
Description: Adds a level to the specified branche's list.


Function:   AddCoopCreditsName
== [[CBaseEntity]] ==
Signature:   void AddCoopCreditsName(string)
{| class="standard-table" style="width: 100%;"
Description: Adds a name to the coop credit's list.
! Function
! Signature
! Description
|-
| <code>ConnectOutput</code>
| <code>void CBaseEntity::ConnectOutput(string, string)</code>
| Adds an I/O connection that will call the named function when the specified output fires
|-
| <code>Destroy</code>
| <code>void CBaseEntity::Destroy()</code>
|-
| <code>DisconnectOutput</code>
| <code>void CBaseEntity::DisconnectOutput(string, string)</code>
| Removes a connected script function from an I/O event.
|-
| <code>EmitSound</code>
| <code>void CBaseEntity::EmitSound(string)</code>
| Plays a sound from this entity.
|-
| <code>EyePosition</code>
| <code>Vector CBaseEntity::EyePosition()</code>
| Get vector to eye position - absolute coords
|-
| <code>FirstMoveChild</code>
| <code>handle CBaseEntity::FirstMoveChild()</code>
|-
| <code>GetAngles</code>
| <code>Vector CBaseEntity::GetAngles()</code>
| Get entity pitch, yaw, roll as a vector
|-
| <code>GetAngularVelocity</code>
| <code>Vector CBaseEntity::GetAngularVelocity()</code>
| Get the local angular velocity - returns a vector of pitch,yaw,roll
|-
| <code>GetBoundingMaxs</code>
| <code>Vector CBaseEntity::GetBoundingMaxs()</code>
| Get a vector containing max bounds, centered on object
|-
| <code>GetBoundingMins</code>
| <code>Vector CBaseEntity::GetBoundingMins()</code>
| Get a vector containing min bounds, centered on object
|-
| <code>GetCenter</code>
| <code>Vector CBaseEntity::GetCenter()</code>
| Get vector to center of object - absolute coords
|-
| <code>GetClassname</code>
| <code>string CBaseEntity::GetClassname()</code>
|-
| <code>GetForwardVector</code>
| <code>Vector CBaseEntity::GetForwardVector()</code>
| Get the forward vector of the entity
|-
| <code>GetHealth</code>
| <code>int CBaseEntity::GetHealth()</code>
|-
| <code>GetLeftVector</code>
| <code>Vector CBaseEntity::GetLeftVector()</code>
| Get the left vector of the entity
|-
| <code>GetMaxHealth</code>
| <code>int CBaseEntity::GetMaxHealth()</code>
|-
| <code>GetModelKeyValues</code>
| <code>handle CBaseEntity::GetModelKeyValues()</code>
| Get a KeyValue class instance on this entity's model
|-
| <code>GetModelName</code>
| <code>string CBaseEntity::GetModelName()</code>
| Returns the name of the model
|-
| <code>GetMoveParent</code>
| <code>handle CBaseEntity::GetMoveParent()</code>
| If in hierarchy, retrieves the entity's parent
|-
| <code>GetName</code>
| <code>string CBaseEntity::GetName()</code>
|
|-
| <code>GetOrigin</code>
| <code>Vector CBaseEntity::GetOrigin()</code>
|
|-
| <code>GetOwner</code>
| <code>handle CBaseEntity::GetOwner()</code>
| Gets this entity's owner
|-
| <code>GetPreTemplateName</code>
| <code>string CBaseEntity::GetPreTemplateName()</code>
| Get the entity name stripped of template unique decoration
|-
| <code>GetRootMoveParent</code>
| <code>handle CBaseEntity::GetRootMoveParent()</code>
| If in hierarchy, walks up the hierarchy to find the root parent
|-
| <code>GetScriptId</code>
| <code>string CBaseEntity::GetScriptId()</code>
| Retrieve the unique identifier used to refer to the entity within the scripting system
|-
| <code>GetScriptScope</code>
| <code>handle CBaseEntity::GetScriptScope()</code>
| Retrieve the script-side data associated with an entity
|-
| <code>GetSoundDuration</code>
| <code>float CBaseEntity::GetSoundDuration(string, string)</code>
| Returns float duration of the sound. Takes soundname and optional actormodelname.
|-
| <code>GetTeam</code>
| <code>int CBaseEntity::GetTeam()</code>
|
|-
| <code>GetUpVector</code>
| <code>Vector CBaseEntity::GetUpVector()</code>
| Get the up vector of the entity
|-
| <code>GetVelocity</code>
| <code>Vector CBaseEntity::GetVelocity()</code>
|
|-
| <code>NextMovePeer</code>
| <code>handle CBaseEntity::NextMovePeer()</code>
|
|-
| <code>PrecacheSoundScript</code>
| <code>void CBaseEntity::PrecacheSoundScript(string)</code>
| Precache a sound for later playing.
|-
| <code>SetAbsOrigin</code>
| <code>void CBaseEntity::SetAbsOrigin(Vector)</code>
| SetAbsOrigin
|-
| <code>SetAngles</code>
| <code>void CBaseEntity::SetAngles(float, float, float)</code>
| Set entity pitch, yaw, roll
|-
| <code>SetAngularVelocity</code>
| <code>void CBaseEntity::SetAngularVelocity(float, float, float)</code>
| Set the local angular velocity - takes float pitch,yaw,roll velocities
|-
| <code>SetForwardVector</code>
| <code>void CBaseEntity::SetForwardVector(Vector)</code>
| Set the orientation of the entity to have this forward vector
|-
| <code>SetHealth</code>
| <code>void CBaseEntity::SetHealth(int)</code>
|
|-
| <code>SetMaxHealth</code>
| <code>void CBaseEntity::SetMaxHealth(int)</code>
|
|-
| <code>SetModel</code>
| <code>void CBaseEntity::SetModel(string)</code>
|
|-
| <code>SetOrigin</code>
| <code>void CBaseEntity::SetOrigin(Vector)</code>
|
|-
| <code>SetOwner</code>
| <code>void CBaseEntity::SetOwner(handle)</code>
| Sets this entity's owner
|-
| <code>SetSize</code>
| <code>void CBaseEntity::SetSize(Vector, Vector)</code>
|
|-
| <code>SetTeam</code>
| <code>void CBaseEntity::SetTeam(int)</code>
|
|-
| <code>SetVelocity</code>
| <code>void CBaseEntity::SetVelocity(Vector)</code>
|-
| <code>ValidateScriptScope</code>
| <code>bool CBaseEntity::ValidateScriptScope()</code>
| Ensure that an entity's script scope has been created
|-
| <code>entindex</code>
| <code>int CBaseEntity::entindex()</code>
|
|}


Function:   CBaseAnimating::GetAttachmentAngles
== [[CBaseFlex]] ==
Signature:   Vector CBaseAnimating::GetAttachmentAngles(int)
{| class="standard-table" style="width: 100%;"
Description: Get the attachement id's angles as a p,y,r vector
! Function
! Signature
! Description
|-
| <code>GetCurrentScene</code>
| <code>handle CBaseFlex::GetCurrentScene()</code>
| Returns the instance of the oldest active scene entity (if any).
|-
| <code>GetSceneByIndex</code>
| <code>handle CBaseFlex::GetSceneByIndex(int)</code>
| Returns the instance of the scene entity at the specified index.
|}


Function:    CBaseAnimating::GetAttachmentOrigin
== [[CBasePlayer]] ==
Signature:   Vector CBaseAnimating::GetAttachmentOrigin(int)
{| class="standard-table" style="width: 100%;"
Description: Get the attachement id's origin vector
! Function
! Signature
! Description
|-
| <code>IsNoclipping</code>
| <code>bool CBasePlayer::IsNoclipping()</code>
| Returns true if the player is in noclip mode.
|}


Function:   CBaseAnimating::GetObjectScaleLevel
== [[CEntities]] ==
Signature:   int CBaseAnimating::GetObjectScaleLevel()
{| class="standard-table" style="width: 100%;"
Description: The scale size of the entity
! Function
! Signature
! Description
|-
| <code>CreateByClassname</code>
| <code>handle CEntities::CreateByClassname(string)</code>
| Creates an entity by classname
|-
| <code>FindByClassname</code>
| <code>handle CEntities::FindByClassname(handle, string)</code>
| Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindByClassnameNearest</code>
| <code>handle CEntities::FindByClassnameNearest(string, Vector, float)</code>
| Find entities by class name nearest to a point.
|-
| <code>FindByClassnameWithin</code>
| <code>handle CEntities::FindByClassnameWithin(handle, string, Vector, float)</code>
| Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindByModel</code>
| <code>handle CEntities::FindByModel(handle, string)</code>
| Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindByName</code>
| <code>handle CEntities::FindByName(handle, string)</code>
| Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindByNameNearest</code>
| <code>handle CEntities::FindByNameNearest(string, Vector, float)</code>
| Find entities by name nearest to a point.
|-
| <code>FindByNameWithin</code>
| <code>handle CEntities::FindByNameWithin(handle, string, Vector, float)</code>
| Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindByTarget</code>
| <code>handle CEntities::FindByTarget(handle, string)</code>
| Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>FindInSphere</code>
| <code>handle CEntities::FindInSphere(handle, Vector, float)</code>
| Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
| <code>First</code>
| <code>handle CEntities::First()</code>
| Begin an iteration over the list of entities
|-
| <code>Next</code>
| <code>handle CEntities::Next(handle)</code>
| Continue an iteration over the list of entities, providing reference to a previously found entity
|}


Function:   CBaseAnimating::IsSequenceFinished
== [[CEnvEntityMaker]] ==
Signature:   bool CBaseAnimating::IsSequenceFinished()
{| class="standard-table" style="width: 100%;"
Description: Ask whether the main sequence is done playing
! Function
! Signature
! Description
|-
| <code>SpawnEntity</code>
| <code>void CEnvEntityMaker::SpawnEntity()</code>
| Create an entity at the location of the maker
|-
| <code>SpawnEntityAtEntityOrigin</code>
| <code>void CEnvEntityMaker::SpawnEntityAtEntityOrigin(handle)</code>
| Create an entity at the location of a specified entity instance
|-
| <code>SpawnEntityAtLocation</code>
| <code>void CEnvEntityMaker::SpawnEntityAtLocation(Vector, Vector)</code>
| Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
|-
| <code>SpawnEntityAtNamedEntityOrigin</code>
| <code>void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string)</code>
| Create an entity at the location of a named entity
|}


Function:   CBaseAnimating::LookupAttachment
== [[CLinkedPortalDoor]] ==
Signature:  int CBaseAnimating::LookupAttachment(string)
{| class="standard-table" style="width: 100%;"
Description: Get the named attachement id
! Function
! Signature
! Description
|-
| <code>GetPartnerInstance</code>
| <code>handle CLinkedPortalDoor::GetPartnerInstance()</code>
| Get the instance handle of the door's linked partner
|-
| <code>GetPartnername</code>
| <code>string CLinkedPortalDoor::GetPartnername()</code>
| Returns the partnername of the door.
|}


Function:   CBaseAnimating::SetBodygroup
== [[CPlayerVoiceListener]] ==
Signature:   void CBaseAnimating::SetBodygroup(int, int)
{| class="standard-table" style="width: 100%;"
Description: Sets a bodygroup
! Function
! Signature
! Description
|-
| <code>GetPlayerSpeechDuration</code>
| <code>float CPlayerVoiceListener::GetPlayerSpeechDuration(int)</code>
| Returns the number of seconds the player has been continuously speaking.
|-
| <code>IsPlayerSpeaking</code>
| <code>bool CPlayerVoiceListener::IsPlayerSpeaking(int)</code>
| Returns whether the player specified is speaking.
|}


Function:   CBaseEntity::ConnectOutput
== [[CPortal_Player]] ==
Signature:  void CBaseEntity::ConnectOutput(string, string)
{| class="standard-table" style="width: 100%;"
Description: Adds an I/O connection that will call the named function when the specified output fires
! Function
! Signature
! Description
|-
| <code>GetWheatleyMonitorDestructionCount</code>
| <code>int CPortal_Player::GetWheatleyMonitorDestructionCount()</code>
| Get number of wheatley monitors destroyed by the player.
|-
| <code>IncWheatleyMonitorDestructionCount</code>
| <code>void CPortal_Player::IncWheatleyMonitorDestructionCount()</code>
| Set number of wheatley monitors destroyed by the player.
|-
| <code>TurnOffPotatos</code>
| <code>void CPortal_Player::TurnOffPotatos()</code>
| Turns Off the Potatos material light
|-
| <code>TurnOnPotatos</code>
| <code>void CPortal_Player::TurnOnPotatos()</code>
| Turns On the Potatos material light
|}


Function:   CBaseEntity::Destroy
== [[CPropLinkedPortalDoor]] ==
Signature:  void CBaseEntity::Destroy()
{| class="standard-table" style="width: 100%;"
! Function
! Signature
! Description
|-
| <code>GetPartnerInstance</code>
| <code>handle CPropLinkedPortalDoor::GetPartnerInstance()</code>
| Get the instance handle of the door's linked partner
|-
| <code>GetPartnername</code>
| <code>string CPropLinkedPortalDoor::GetPartnername()</code>
| Returns the partnername of the door.
|}


Function:   CBaseEntity::DisconnectOutput
== [[CSceneEntity]] ==
Signature:   void CBaseEntity::DisconnectOutput(string, string)
{| class="standard-table" style="width: 100%;"
Description: Removes a connected script function from an I/O event.
! Function
! Signature
! Description
|-
| <code>AddBroadcastTeamTarget</code>
| <code>void CSceneEntity::AddBroadcastTeamTarget(int)</code>
| Adds a team (by index) to the broadcast list
|-
| <code>EstimateLength</code>
| <code>float CSceneEntity::EstimateLength()</code>
| Returns length of this scene in seconds.
|-
| <code>FindNamedEntity</code>
| <code>handle CSceneEntity::FindNamedEntity(string)</code>
| given an entity reference, such as !target, get actual entity from scene object
|-
| <code>IsPaused</code>
| <code>bool CSceneEntity::IsPaused()</code>
| If this scene is currently paused.
|-
| <code>IsPlayingBack</code>
| <code>bool CSceneEntity::IsPlayingBack()</code>
| If this scene is currently playing.
|-
| <code>LoadSceneFromString</code>
| <code>bool CSceneEntity::LoadSceneFromString(string, string)</code>
| given a dummy scene name and a vcd string, load the scene
|-
| <code>RemoveBroadcastTeamTarget</code>
| <code>void CSceneEntity::RemoveBroadcastTeamTarget(int)</code>
| Removes a team (by index) from the broadcast list
|}


Function:   CBaseEntity::EmitSound
== [[CScriptKeyValues]] ==
Signature:   void CBaseEntity::EmitSound(string)
{| class="standard-table" style="width: 100%;"
Description: Plays a sound from this entity.
! Function
! Signature
! Description
|-
| <code>FindKey</code>
| <code>handle CScriptKeyValues::FindKey(string)</code>
| Given a KeyValues object and a key name, find a KeyValues object associated with the key name
|-
| <code>GetFirstSubKey</code>
| <code>handle CScriptKeyValues::GetFirstSubKey()</code>
| Given a KeyValues object, return the first sub key object
|-
| <code>GetKeyBool</code>
| <code>bool CScriptKeyValues::GetKeyBool(string)</code>
| Given a KeyValues object and a key name, return associated bool value
|-
| <code>GetKeyFloat</code>
| <code>float CScriptKeyValues::GetKeyFloat(string)</code>
| Given a KeyValues object and a key name, return associated float value
|-
| <code>GetKeyInt</code>
| <code>int CScriptKeyValues::GetKeyInt(string)</code>
| Given a KeyValues object and a key name, return associated integer value
|-
| <code>GetKeyString</code>
| <code>string CScriptKeyValues::GetKeyString(string)</code>
| Given a KeyValues object and a key name, return associated string value
|-
| <code>GetNextKey</code>
| <code>handle CScriptKeyValues::GetNextKey()</code>
| Given a KeyValues object, return the next key object in a sub key group
|-
| <code>IsKeyEmpty</code>
| <code>bool CScriptKeyValues::IsKeyEmpty(string)</code>
| Given a KeyValues object and a key name, return true if key name has no value
|-
| <code>ReleaseKeyValues</code>
| <code>void CScriptKeyValues::ReleaseKeyValues()</code>
| Given a root KeyValues object, release its contents
|}


Function:   CBaseEntity::EyePosition
== [[CTriggerCamera]] ==
Signature:   Vector CBaseEntity::EyePosition()
{| class="standard-table" style="width: 100%;"
Description: Get vector to eye position - absolute coords
! Function
! Signature
! Description
|-
| <code>GetFov</code>
| <code>int CTriggerCamera::GetFov()</code>
| get camera's current fov setting as integer
|-
| <code>SetFov</code>
| <code>void CTriggerCamera::SetFov(int, float)</code>
| set camera's current fov in integer degrees and fov change rate as float
|}


Function:    CBaseEntity::FirstMoveChild
== Other functions ==
Signature:   handle CBaseEntity::FirstMoveChild()
{| class="standard-table" style="width: 100%;"
! Function
! Signature
! Description
|-
| <code>AddBranchLevelName</code>
| <code>void AddBranchLevelName(int, string)</code>
| Adds a level to the specified branche's list.
|-
| <code>AddCoopCreditsName</code>
| <code>void AddCoopCreditsName(string)</code>
| Adds a name to the coop credit's list.
|-
| <code>CreateProp</code>
| <code>handle CreateProp(string, Vector, string, int)</code>
| Create a physics prop
|-
| <code>CreateSceneEntity</code>
| <code>handle CreateSceneEntity(string)</code>
| Create a scene entity to play the specified scene.
|-
| <code>DebugDrawBox</code>
| <code>void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float)</code>
| Draw a debug overlay box
|-
| <code>DebugDrawLine</code>
| <code>void DebugDrawLine(Vector, Vector, int, int, int, bool, float)</code>
| Draw a debug overlay box
|-
| <code>DoIncludeScript</code>
| <code>bool DoIncludeScript(string, handle)</code>
| Execute a script (internal)
|-
| <code>EntFire</code>
| <code>function EntFire(target, action, value, delay, activator)</code>
| Generate and entity i/o event
|-
| <code>EntFireByHandle</code>
| <code>void EntFireByHandle(handle, string, string, float, handle, handle)</code>
| Generate and entity i/o event. First parameter is an entity instance.
|-
| <code>FrameTime</code>
| <code>float FrameTime()</code>
| Get the time spent on the server in the last frame
|-
| <code>GetBluePlayerIndex</code>
| <code>int GetBluePlayerIndex()</code>
| Player index of the blue player.
|-
| <code>GetCoopBranchLevelIndex</code>
| <code>int GetCoopBranchLevelIndex(int)</code>
| Given the 'branch' argument, returns the current chosen level.
|-
| <code>GetCoopSectionIndex</code>
| <code>int GetCoopSectionIndex()</code>
| Section that the coop players have selected to load.
|-
| <code>GetDeveloperLevel</code>
| <code>int GetDeveloperLevel()</code>
| Gets the level of 'develoer'
|-
| <code>GetHighestActiveBranch</code>
| <code>int GetHighestActiveBranch()</code>
| Returns which branches should be available in the hub.
|-
| <code>GetMapName</code>
| <code>string GetMapName()</code>
| Get the name of the map.
|-
| <code>GetOrangePlayerIndex</code>
| <code>int GetOrangePlayerIndex()</code>
| Player index of the orange player.
|-
| <code>GetPlayer</code>
| <code>handle GetPlayer()</code>
| Returns the player (SP Only).
|-
| <code>GetPlayerSilenceDuration</code>
| <code>float GetPlayerSilenceDuration(int)</code>
| Time that the specified player has been silent on the mic.
|-
| <code>IsLevelComplete</code>
| <code>bool IsLevelComplete(int, int)</code>
| Returns true if the level in the specified branch is completed by either player.
|-
| <code>IsMultiplayer</code>
| <code>bool IsMultiplayer()</code>
| Is this a multiplayer game?
|-
| <code>IsPlayerLevelComplete</code>
| <code>bool IsPlayerLevelComplete(int, int, int)</code>
| Returns true if the level in the specified branch is completed by a specific player.
|-
| <code>LoopSinglePlayerMaps</code>
| <code>bool LoopSinglePlayerMaps()</code>
| Run the single player maps in a continuous loop.
|-
| <code>MarkMapComplete</code>
| <code>void MarkMapComplete(string)</code>
| Marks a maps a complete for both players.
|-
| <code>PrecacheMovie</code>
| <code>void PrecacheMovie(string)</code>
| Precaches a named movie. Only valid to call within the entity's 'Precache' function called on mapspawn.
|-
| <code>RandomFloat</code>
| <code>float RandomFloat(float, float)</code>
| Generate a random floating point number within a range, inclusive
|-
| <code>RandomInt</code>
| <code>int RandomInt(int, int)</code>
| Generate a random integer within a range, inclusive
|-
| <code>RecordAchievementEvent</code>
| <code>void RecordAchievementEvent(string, int)</code>
| Records achievement event or progress
|-
| <code>ScriptShowHudMessageAll</code>
| <code>void ScriptShowHudMessageAll(string, float)</code>
| Show center print text message.
|-
| <code>ScriptSteamShowURL</code>
| <code>bool ScriptSteamShowURL(string)</code>
| Bring up the steam overlay and shows the specified URL.  (Full address with protocol type is required, e.g. http://www.steamgames.com/)
|-
| <code>SendToConsole</code>
| <code>void SendToConsole(string)</code>
| Send a string to the console as a command
|-
| <code>SetDucking</code>
| <code>void SetDucking(string, string, float)</code>
| Set the level of an audio ducking channel
|-
| <code>ShowMessage</code>
| <code>void ShowMessage(string)</code>
| Print a hud message on all clients
|-
| <code>Time</code>
| <code>float Time()</code>
| Get the current server time
|-
| <code>TraceLine</code>
| <code>float TraceLine(Vector, Vector, handle)</code>
| given 2 points & ent to ignore, return fraction along line that hits world or models
|-
| <code>UniqueString</code>
| <code>function UniqueString(string)</code>
| 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.
|}


Function:   CBaseEntity::GetAngles
[[Category:Portal 2]]
Signature:  Vector CBaseEntity::GetAngles()
[[Category:Scripting]]
Description: Get entity pitch, yaw, roll as a vector
 
Function:    CBaseEntity::GetAngularVelocity
Signature:  Vector CBaseEntity::GetAngularVelocity()
Description: Get the local angular velocity - returns a vector of pitch,yaw,roll
 
Function:    CBaseEntity::GetBoundingMaxs
Signature:  Vector CBaseEntity::GetBoundingMaxs()
Description: Get a vector containing max bounds, centered on object
 
Function:    CBaseEntity::GetBoundingMins
Signature:  Vector CBaseEntity::GetBoundingMins()
Description: Get a vector containing min bounds, centered on object
 
Function:    CBaseEntity::GetCenter
Signature:  Vector CBaseEntity::GetCenter()
Description: Get vector to center of object - absolute coords
 
Function:    CBaseEntity::GetClassname
Signature:  string CBaseEntity::GetClassname()
 
Function:    CBaseEntity::GetForwardVector
Signature:  Vector CBaseEntity::GetForwardVector()
Description: Get the forward vector of the entity
 
Function:    CBaseEntity::GetHealth
Signature:  int CBaseEntity::GetHealth()
 
Function:    CBaseEntity::GetLeftVector
Signature:  Vector CBaseEntity::GetLeftVector()
Description: Get the left vector of the entity
 
Function:    CBaseEntity::GetMaxHealth
Signature:  int CBaseEntity::GetMaxHealth()
 
Function:    CBaseEntity::GetModelKeyValues
Signature:  handle CBaseEntity::GetModelKeyValues()
Description: Get a KeyValue class instance on this entity's model
 
Function:    CBaseEntity::GetModelName
Signature:  string CBaseEntity::GetModelName()
Description: Returns the name of the model
 
Function:    CBaseEntity::GetMoveParent
Signature:  handle CBaseEntity::GetMoveParent()
Description: If in hierarchy, retrieves the entity's parent
 
Function:    CBaseEntity::GetName
Signature:  string CBaseEntity::GetName()
 
Function:    CBaseEntity::GetOrigin
Signature:  Vector CBaseEntity::GetOrigin()
 
Function:    CBaseEntity::GetOwner
Signature:  handle CBaseEntity::GetOwner()
Description: Gets this entity's owner
 
Function:    CBaseEntity::GetPreTemplateName
Signature:  string CBaseEntity::GetPreTemplateName()
Description: Get the entity name stripped of template unique decoration
 
Function:    CBaseEntity::GetRootMoveParent
Signature:  handle CBaseEntity::GetRootMoveParent()
Description: If in hierarchy, walks up the hierarchy to find the root parent
 
Function:    CBaseEntity::GetScriptId
Signature:  string CBaseEntity::GetScriptId()
Description: Retrieve the unique identifier used to refer to the entity within the scripting system
 
Function:    CBaseEntity::GetScriptScope
Signature:  handle CBaseEntity::GetScriptScope()
Description: Retrieve the script-side data associated with an entity
 
Function:    CBaseEntity::GetSoundDuration
Signature:  float CBaseEntity::GetSoundDuration(string, string)
Description: Returns float duration of the sound. Takes soundname and optional actormodelname.
 
Function:    CBaseEntity::GetTeam
Signature:  int CBaseEntity::GetTeam()
 
Function:    CBaseEntity::GetUpVector
Signature:  Vector CBaseEntity::GetUpVector()
Description: Get the up vector of the entity
 
Function:    CBaseEntity::GetVelocity
Signature:  Vector CBaseEntity::GetVelocity()
 
Function:    CBaseEntity::NextMovePeer
Signature:  handle CBaseEntity::NextMovePeer()
 
Function:    CBaseEntity::PrecacheSoundScript
Signature:  void CBaseEntity::PrecacheSoundScript(string)
Description: Precache a sound for later playing.
 
Function:    CBaseEntity::SetAbsOrigin
Signature:  void CBaseEntity::SetAbsOrigin(Vector)
Description: SetAbsOrigin
 
Function:    CBaseEntity::SetAngles
Signature:  void CBaseEntity::SetAngles(float, float, float)
Description: Set entity pitch, yaw, roll
 
Function:    CBaseEntity::SetAngularVelocity
Signature:  void CBaseEntity::SetAngularVelocity(float, float, float)
Description: Set the local angular velocity - takes float pitch,yaw,roll velocities
 
Function:    CBaseEntity::SetForwardVector
Signature:  void CBaseEntity::SetForwardVector(Vector)
Description: Set the orientation of the entity to have this forward vector
 
Function:    CBaseEntity::SetHealth
Signature:  void CBaseEntity::SetHealth(int)
 
Function:    CBaseEntity::SetMaxHealth
Signature:  void CBaseEntity::SetMaxHealth(int)
 
Function:    CBaseEntity::SetModel
Signature:  void CBaseEntity::SetModel(string)
 
Function:    CBaseEntity::SetOrigin
Signature:  void CBaseEntity::SetOrigin(Vector)
 
Function:    CBaseEntity::SetOwner
Signature:  void CBaseEntity::SetOwner(handle)
Description: Sets this entity's owner
 
Function:    CBaseEntity::SetSize
Signature:  void CBaseEntity::SetSize(Vector, Vector)
 
Function:    CBaseEntity::SetTeam
Signature:  void CBaseEntity::SetTeam(int)
 
Function:    CBaseEntity::SetVelocity
Signature:  void CBaseEntity::SetVelocity(Vector)
 
Function:    CBaseEntity::ValidateScriptScope
Signature:  bool CBaseEntity::ValidateScriptScope()
Description: Ensure that an entity's script scope has been created
 
Function:    CBaseEntity::entindex
Signature:  int CBaseEntity::entindex()
 
Function:    CBaseFlex::GetCurrentScene
Signature:  handle CBaseFlex::GetCurrentScene()
Description: Returns the instance of the oldest active scene entity (if any).
 
Function:    CBaseFlex::GetSceneByIndex
Signature:  handle CBaseFlex::GetSceneByIndex(int)
Description: Returns the instance of the scene entity at the specified index.
 
Function:    CBasePlayer::IsNoclipping
Signature:  bool CBasePlayer::IsNoclipping()
Description: Returns true if the player is in noclip mode.
 
Function:    CEntities::CreateByClassname
Signature:  handle CEntities::CreateByClassname(string)
Description: Creates an entity by classname
 
Function:    CEntities::FindByClassname
Signature:  handle CEntities::FindByClassname(handle, string)
Description: Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindByClassnameNearest
Signature:  handle CEntities::FindByClassnameNearest(string, Vector, float)
Description: Find entities by class name nearest to a point.
 
Function:    CEntities::FindByClassnameWithin
Signature:  handle CEntities::FindByClassnameWithin(handle, string, Vector, float)
Description: Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindByModel
Signature:  handle CEntities::FindByModel(handle, string)
Description: Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindByName
Signature:  handle CEntities::FindByName(handle, string)
Description: Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindByNameNearest
Signature:  handle CEntities::FindByNameNearest(string, Vector, float)
Description: Find entities by name nearest to a point.
 
Function:    CEntities::FindByNameWithin
Signature:  handle CEntities::FindByNameWithin(handle, string, Vector, float)
Description: Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindByTarget
Signature:  handle CEntities::FindByTarget(handle, string)
Description: Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::FindInSphere
Signature:  handle CEntities::FindInSphere(handle, Vector, float)
Description: Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
 
Function:    CEntities::First
Signature:  handle CEntities::First()
Description: Begin an iteration over the list of entities
 
Function:    CEntities::Next
Signature:  handle CEntities::Next(handle)
Description: Continue an iteration over the list of entities, providing reference to a previously found entity
 
Function:    CEnvEntityMaker::SpawnEntity
Signature:  void CEnvEntityMaker::SpawnEntity()
Description: Create an entity at the location of the maker
 
Function:    CEnvEntityMaker::SpawnEntityAtEntityOrigin
Signature:  void CEnvEntityMaker::SpawnEntityAtEntityOrigin(handle)
Description: Create an entity at the location of a specified entity instance
 
Function:    CEnvEntityMaker::SpawnEntityAtLocation
Signature:  void CEnvEntityMaker::SpawnEntityAtLocation(Vector, Vector)
Description: Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
 
Function:    CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin
Signature:  void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string)
Description: Create an entity at the location of a named entity
 
Function:    CLinkedPortalDoor::GetPartnerInstance
Signature:  handle CLinkedPortalDoor::GetPartnerInstance()
Description: Get the instance handle of the door's linked partner
 
Function:    CLinkedPortalDoor::GetPartnername
Signature:  string CLinkedPortalDoor::GetPartnername()
Description: Returns the partnername of the door.
 
Function:    CPlayerVoiceListener::GetPlayerSpeechDuration
Signature:  float CPlayerVoiceListener::GetPlayerSpeechDuration(int)
Description: Returns the number of seconds the player has been continuously speaking.
 
Function:    CPlayerVoiceListener::IsPlayerSpeaking
Signature:  bool CPlayerVoiceListener::IsPlayerSpeaking(int)
Description: Returns whether the player specified is speaking.
 
Function:    CPortal_Player::GetWheatleyMonitorDestructionCount
Signature:  int CPortal_Player::GetWheatleyMonitorDestructionCount()
Description: Get number of wheatley monitors destroyed by the player.
 
Function:    CPortal_Player::IncWheatleyMonitorDestructionCount
Signature:  void CPortal_Player::IncWheatleyMonitorDestructionCount()
Description: Set number of wheatley monitors destroyed by the player.
 
Function:    CPortal_Player::TurnOffPotatos
Signature:  void CPortal_Player::TurnOffPotatos()
Description: Turns Off the Potatos material light
 
Function:    CPortal_Player::TurnOnPotatos
Signature:  void CPortal_Player::TurnOnPotatos()
Description: Turns On the Potatos material light
 
Function:    CPropLinkedPortalDoor::GetPartnerInstance
Signature:  handle CPropLinkedPortalDoor::GetPartnerInstance()
Description: Get the instance handle of the door's linked partner
 
Function:    CPropLinkedPortalDoor::GetPartnername
Signature:  string CPropLinkedPortalDoor::GetPartnername()
Description: Returns the partnername of the door.
 
Function:    CSceneEntity::AddBroadcastTeamTarget
Signature:  void CSceneEntity::AddBroadcastTeamTarget(int)
Description: Adds a team (by index) to the broadcast list
 
Function:    CSceneEntity::EstimateLength
Signature:  float CSceneEntity::EstimateLength()
Description: Returns length of this scene in seconds.
 
Function:    CSceneEntity::FindNamedEntity
Signature:  handle CSceneEntity::FindNamedEntity(string)
Description: given an entity reference, such as !target, get actual entity from scene object
 
Function:    CSceneEntity::IsPaused
Signature:  bool CSceneEntity::IsPaused()
Description: If this scene is currently paused.
 
Function:    CSceneEntity::IsPlayingBack
Signature:  bool CSceneEntity::IsPlayingBack()
Description: If this scene is currently playing.
 
Function:    CSceneEntity::LoadSceneFromString
Signature:  bool CSceneEntity::LoadSceneFromString(string, string)
Description: given a dummy scene name and a vcd string, load the scene
 
Function:    CSceneEntity::RemoveBroadcastTeamTarget
Signature:  void CSceneEntity::RemoveBroadcastTeamTarget(int)
Description: Removes a team (by index) from the broadcast list
 
Function:    CScriptKeyValues::FindKey
Signature:  handle CScriptKeyValues::FindKey(string)
Description: Given a KeyValues object and a key name, find a KeyValues object associated with the key name
 
Function:    CScriptKeyValues::GetFirstSubKey
Signature:  handle CScriptKeyValues::GetFirstSubKey()
Description: Given a KeyValues object, return the first sub key object
 
Function:    CScriptKeyValues::GetKeyBool
Signature:  bool CScriptKeyValues::GetKeyBool(string)
Description: Given a KeyValues object and a key name, return associated bool value
 
Function:    CScriptKeyValues::GetKeyFloat
Signature:  float CScriptKeyValues::GetKeyFloat(string)
Description: Given a KeyValues object and a key name, return associated float value
 
Function:    CScriptKeyValues::GetKeyInt
Signature:  int CScriptKeyValues::GetKeyInt(string)
Description: Given a KeyValues object and a key name, return associated integer value
 
Function:    CScriptKeyValues::GetKeyString
Signature:  string CScriptKeyValues::GetKeyString(string)
Description: Given a KeyValues object and a key name, return associated string value
 
Function:    CScriptKeyValues::GetNextKey
Signature:  handle CScriptKeyValues::GetNextKey()
Description: Given a KeyValues object, return the next key object in a sub key group
 
Function:    CScriptKeyValues::IsKeyEmpty
Signature:  bool CScriptKeyValues::IsKeyEmpty(string)
Description: Given a KeyValues object and a key name, return true if key name has no value
 
Function:    CScriptKeyValues::ReleaseKeyValues
Signature:  void CScriptKeyValues::ReleaseKeyValues()
Description: Given a root KeyValues object, release its contents
 
Function:    CTriggerCamera::GetFov
Signature:  int CTriggerCamera::GetFov()
Description: get camera's current fov setting as integer
 
Function:    CTriggerCamera::SetFov
Signature:  void CTriggerCamera::SetFov(int, float)
Description: set camera's current fov in integer degrees and fov change rate as float
 
Function:    CreateProp
Signature:  handle CreateProp(string, Vector, string, int)
Description: Create a physics prop
 
Function:    CreateSceneEntity
Signature:  handle CreateSceneEntity(string)
Description: Create a scene entity to play the specified scene.
 
Function:    DebugDrawBox
Signature:  void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float)
Description: Draw a debug overlay box
 
Function:    DebugDrawLine
Signature:  void DebugDrawLine(Vector, Vector, int, int, int, bool, float)
Description: Draw a debug overlay box
 
Function:    DoIncludeScript
Signature:  bool DoIncludeScript(string, handle)
Description: Execute a script (internal)
 
Function:    EntFire
Signature:  function EntFire(target, action, value, delay, activator)
Description: Generate and entity i/o event
 
Function:    EntFireByHandle
Signature:  void EntFireByHandle(handle, string, string, float, handle, handle)
Description: Generate and entity i/o event. First parameter is an entity instance.
 
Function:    FrameTime
Signature:  float FrameTime()
Description: Get the time spent on the server in the last frame
 
Function:    GetBluePlayerIndex
Signature:  int GetBluePlayerIndex()
Description: Player index of the blue player.
 
Function:    GetCoopBranchLevelIndex
Signature:  int GetCoopBranchLevelIndex(int)
Description: Given the 'branch' argument, returns the current chosen level.
 
Function:    GetCoopSectionIndex
Signature:  int GetCoopSectionIndex()
Description: Section that the coop players have selected to load.
 
Function:    GetDeveloperLevel
Signature:  int GetDeveloperLevel()
Description: Gets the level of 'develoer'
 
Function:    GetHighestActiveBranch
Signature:  int GetHighestActiveBranch()
Description: Returns which branches should be available in the hub.
 
Function:    GetMapName
Signature:  string GetMapName()
Description: Get the name of the map.
 
Function:    GetOrangePlayerIndex
Signature:  int GetOrangePlayerIndex()
Description: Player index of the orange player.
 
Function:    GetPlayer
Signature:  handle GetPlayer()
Description: Returns the player (SP Only).
 
Function:    GetPlayerSilenceDuration
Signature:  float GetPlayerSilenceDuration(int)
Description: Time that the specified player has been silent on the mic.
 
Function:    IsLevelComplete
Signature:  bool IsLevelComplete(int, int)
Description: Returns true if the level in the specified branch is completed by either player.
 
Function:    IsMultiplayer
Signature:  bool IsMultiplayer()
Description: Is this a multiplayer game?
 
Function:    IsPlayerLevelComplete
Signature:  bool IsPlayerLevelComplete(int, int, int)
Description: Returns true if the level in the specified branch is completed by a specific player.
 
Function:    LoopSinglePlayerMaps
Signature:  bool LoopSinglePlayerMaps()
Description: Run the single player maps in a continuous loop.
 
Function:    MarkMapComplete
Signature:  void MarkMapComplete(string)
Description: Marks a maps a complete for both players.
 
Function:    PrecacheMovie
Signature:  void PrecacheMovie(string)
Description: Precaches a named movie. Only valid to call within the entity's 'Precache' function called on mapspawn.
 
Function:    RandomFloat
Signature:  float RandomFloat(float, float)
Description: Generate a random floating point number within a range, inclusive
 
Function:    RandomInt
Signature:  int RandomInt(int, int)
Description: Generate a random integer within a range, inclusive
 
Function:    RecordAchievementEvent
Signature:  void RecordAchievementEvent(string, int)
Description: Records achievement event or progress
 
Function:    ScriptShowHudMessageAll
Signature:  void ScriptShowHudMessageAll(string, float)
Description: Show center print text message.
 
Function:    ScriptSteamShowURL
Signature:  bool ScriptSteamShowURL(string)
Description: Bring up the steam overlay and shows the specified URL.  (Full address with protocol type is required, e.g. http://www.steamgames.com/)
 
Function:    SendToConsole
Signature:  void SendToConsole(string)
Description: Send a string to the console as a command
 
Function:    SetDucking
Signature:  void SetDucking(string, string, float)
Description: Set the level of an audio ducking channel
 
Function:    ShowMessage
Signature:  void ShowMessage(string)
Description: Print a hud message on all clients
 
Function:    Time
Signature:  float Time()
Description: Get the current server time
 
Function:    TraceLine
Signature:  float TraceLine(Vector, Vector, handle)
Description: given 2 points & ent to ignore, return fraction along line that hits world or models
 
Function:    UniqueString
Signature:  function UniqueString(string)
Description: 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.
 
</pre>
</div>
 
[[Category:Portal 2 Level Design]]

Revision as of 15:39, 20 May 2011

Squirrel This list contains all engine-related Squirrel functions available for VScript in Portal 2.

CBaseAnimating

Function Signature Description
GetAttachmentAngles Vector CBaseAnimating::GetAttachmentAngles(int) Get the attachement id's angles as a p,y,r vector
GetAttachmentOrigin Vector CBaseAnimating::GetAttachmentOrigin(int) Get the attachement id's origin vector
GetObjectScaleLevel int CBaseAnimating::GetObjectScaleLevel() The scale size of the entity
IsSequenceFinished bool CBaseAnimating::IsSequenceFinished() Ask whether the main sequence is done playing
LookupAttachment int CBaseAnimating::LookupAttachment(string) Get the named attachement id
SetBodygroup void CBaseAnimating::SetBodygroup(int, int) Sets a bodygroup


CBaseEntity

Function Signature Description
ConnectOutput void CBaseEntity::ConnectOutput(string, string) Adds an I/O connection that will call the named function when the specified output fires
Destroy void CBaseEntity::Destroy()
DisconnectOutput void CBaseEntity::DisconnectOutput(string, string) Removes a connected script function from an I/O event.
EmitSound void CBaseEntity::EmitSound(string) Plays a sound from this entity.
EyePosition Vector CBaseEntity::EyePosition() Get vector to eye position - absolute coords
FirstMoveChild handle CBaseEntity::FirstMoveChild()
GetAngles Vector CBaseEntity::GetAngles() Get entity pitch, yaw, roll as a vector
GetAngularVelocity Vector CBaseEntity::GetAngularVelocity() Get the local angular velocity - returns a vector of pitch,yaw,roll
GetBoundingMaxs Vector CBaseEntity::GetBoundingMaxs() Get a vector containing max bounds, centered on object
GetBoundingMins Vector CBaseEntity::GetBoundingMins() Get a vector containing min bounds, centered on object
GetCenter Vector CBaseEntity::GetCenter() Get vector to center of object - absolute coords
GetClassname string CBaseEntity::GetClassname()
GetForwardVector Vector CBaseEntity::GetForwardVector() Get the forward vector of the entity
GetHealth int CBaseEntity::GetHealth()
GetLeftVector Vector CBaseEntity::GetLeftVector() Get the left vector of the entity
GetMaxHealth int CBaseEntity::GetMaxHealth()
GetModelKeyValues handle CBaseEntity::GetModelKeyValues() Get a KeyValue class instance on this entity's model
GetModelName string CBaseEntity::GetModelName() Returns the name of the model
GetMoveParent handle CBaseEntity::GetMoveParent() If in hierarchy, retrieves the entity's parent
GetName string CBaseEntity::GetName()
GetOrigin Vector CBaseEntity::GetOrigin()
GetOwner handle CBaseEntity::GetOwner() Gets this entity's owner
GetPreTemplateName string CBaseEntity::GetPreTemplateName() Get the entity name stripped of template unique decoration
GetRootMoveParent handle CBaseEntity::GetRootMoveParent() If in hierarchy, walks up the hierarchy to find the root parent
GetScriptId string CBaseEntity::GetScriptId() Retrieve the unique identifier used to refer to the entity within the scripting system
GetScriptScope handle CBaseEntity::GetScriptScope() Retrieve the script-side data associated with an entity
GetSoundDuration float CBaseEntity::GetSoundDuration(string, string) Returns float duration of the sound. Takes soundname and optional actormodelname.
GetTeam int CBaseEntity::GetTeam()
GetUpVector Vector CBaseEntity::GetUpVector() Get the up vector of the entity
GetVelocity Vector CBaseEntity::GetVelocity()
NextMovePeer handle CBaseEntity::NextMovePeer()
PrecacheSoundScript void CBaseEntity::PrecacheSoundScript(string) Precache a sound for later playing.
SetAbsOrigin void CBaseEntity::SetAbsOrigin(Vector) SetAbsOrigin
SetAngles void CBaseEntity::SetAngles(float, float, float) Set entity pitch, yaw, roll
SetAngularVelocity void CBaseEntity::SetAngularVelocity(float, float, float) Set the local angular velocity - takes float pitch,yaw,roll velocities
SetForwardVector void CBaseEntity::SetForwardVector(Vector) Set the orientation of the entity to have this forward vector
SetHealth void CBaseEntity::SetHealth(int)
SetMaxHealth void CBaseEntity::SetMaxHealth(int)
SetModel void CBaseEntity::SetModel(string)
SetOrigin void CBaseEntity::SetOrigin(Vector)
SetOwner void CBaseEntity::SetOwner(handle) Sets this entity's owner
SetSize void CBaseEntity::SetSize(Vector, Vector)
SetTeam void CBaseEntity::SetTeam(int)
SetVelocity void CBaseEntity::SetVelocity(Vector)
ValidateScriptScope bool CBaseEntity::ValidateScriptScope() Ensure that an entity's script scope has been created
entindex int CBaseEntity::entindex()

CBaseFlex

Function Signature Description
GetCurrentScene handle CBaseFlex::GetCurrentScene() Returns the instance of the oldest active scene entity (if any).
GetSceneByIndex handle CBaseFlex::GetSceneByIndex(int) Returns the instance of the scene entity at the specified index.

CBasePlayer

Function Signature Description
IsNoclipping bool CBasePlayer::IsNoclipping() Returns true if the player is in noclip mode.

CEntities

Function Signature Description
CreateByClassname handle CEntities::CreateByClassname(string) Creates an entity by classname
FindByClassname handle CEntities::FindByClassname(handle, string) Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByClassnameNearest handle CEntities::FindByClassnameNearest(string, Vector, float) Find entities by class name nearest to a point.
FindByClassnameWithin handle CEntities::FindByClassnameWithin(handle, string, Vector, float) Find entities by class name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByModel handle CEntities::FindByModel(handle, string) Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByName handle CEntities::FindByName(handle, string) Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByNameNearest handle CEntities::FindByNameNearest(string, Vector, float) Find entities by name nearest to a point.
FindByNameWithin handle CEntities::FindByNameWithin(handle, string, Vector, float) Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByTarget handle CEntities::FindByTarget(handle, string) Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindInSphere handle CEntities::FindInSphere(handle, Vector, float) Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
First handle CEntities::First() Begin an iteration over the list of entities
Next handle CEntities::Next(handle) Continue an iteration over the list of entities, providing reference to a previously found entity

CEnvEntityMaker

Function Signature Description
SpawnEntity void CEnvEntityMaker::SpawnEntity() Create an entity at the location of the maker
SpawnEntityAtEntityOrigin void CEnvEntityMaker::SpawnEntityAtEntityOrigin(handle) Create an entity at the location of a specified entity instance
SpawnEntityAtLocation void CEnvEntityMaker::SpawnEntityAtLocation(Vector, Vector) Create an entity at a specified location and orientaton, orientation is Euler angle in degrees (pitch, yaw, roll)
SpawnEntityAtNamedEntityOrigin void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string) Create an entity at the location of a named entity

CLinkedPortalDoor

Function Signature Description
GetPartnerInstance handle CLinkedPortalDoor::GetPartnerInstance() Get the instance handle of the door's linked partner
GetPartnername string CLinkedPortalDoor::GetPartnername() Returns the partnername of the door.

CPlayerVoiceListener

Function Signature Description
GetPlayerSpeechDuration float CPlayerVoiceListener::GetPlayerSpeechDuration(int) Returns the number of seconds the player has been continuously speaking.
IsPlayerSpeaking bool CPlayerVoiceListener::IsPlayerSpeaking(int) Returns whether the player specified is speaking.

CPortal_Player

Function Signature Description
GetWheatleyMonitorDestructionCount int CPortal_Player::GetWheatleyMonitorDestructionCount() Get number of wheatley monitors destroyed by the player.
IncWheatleyMonitorDestructionCount void CPortal_Player::IncWheatleyMonitorDestructionCount() Set number of wheatley monitors destroyed by the player.
TurnOffPotatos void CPortal_Player::TurnOffPotatos() Turns Off the Potatos material light
TurnOnPotatos void CPortal_Player::TurnOnPotatos() Turns On the Potatos material light

CPropLinkedPortalDoor

Function Signature Description
GetPartnerInstance handle CPropLinkedPortalDoor::GetPartnerInstance() Get the instance handle of the door's linked partner
GetPartnername string CPropLinkedPortalDoor::GetPartnername() Returns the partnername of the door.

CSceneEntity

Function Signature Description
AddBroadcastTeamTarget void CSceneEntity::AddBroadcastTeamTarget(int) Adds a team (by index) to the broadcast list
EstimateLength float CSceneEntity::EstimateLength() Returns length of this scene in seconds.
FindNamedEntity handle CSceneEntity::FindNamedEntity(string) given an entity reference, such as !target, get actual entity from scene object
IsPaused bool CSceneEntity::IsPaused() If this scene is currently paused.
IsPlayingBack bool CSceneEntity::IsPlayingBack() If this scene is currently playing.
LoadSceneFromString bool CSceneEntity::LoadSceneFromString(string, string) given a dummy scene name and a vcd string, load the scene
RemoveBroadcastTeamTarget void CSceneEntity::RemoveBroadcastTeamTarget(int) Removes a team (by index) from the broadcast list

CScriptKeyValues

Function Signature Description
FindKey handle CScriptKeyValues::FindKey(string) Given a KeyValues object and a key name, find a KeyValues object associated with the key name
GetFirstSubKey handle CScriptKeyValues::GetFirstSubKey() Given a KeyValues object, return the first sub key object
GetKeyBool bool CScriptKeyValues::GetKeyBool(string) Given a KeyValues object and a key name, return associated bool value
GetKeyFloat float CScriptKeyValues::GetKeyFloat(string) Given a KeyValues object and a key name, return associated float value
GetKeyInt int CScriptKeyValues::GetKeyInt(string) Given a KeyValues object and a key name, return associated integer value
GetKeyString string CScriptKeyValues::GetKeyString(string) Given a KeyValues object and a key name, return associated string value
GetNextKey handle CScriptKeyValues::GetNextKey() Given a KeyValues object, return the next key object in a sub key group
IsKeyEmpty bool CScriptKeyValues::IsKeyEmpty(string) Given a KeyValues object and a key name, return true if key name has no value
ReleaseKeyValues void CScriptKeyValues::ReleaseKeyValues() Given a root KeyValues object, release its contents

CTriggerCamera

Function Signature Description
GetFov int CTriggerCamera::GetFov() get camera's current fov setting as integer
SetFov void CTriggerCamera::SetFov(int, float) set camera's current fov in integer degrees and fov change rate as float

Other functions

Function Signature Description
AddBranchLevelName void AddBranchLevelName(int, string) Adds a level to the specified branche's list.
AddCoopCreditsName void AddCoopCreditsName(string) Adds a name to the coop credit's list.
CreateProp handle CreateProp(string, Vector, string, int) Create a physics prop
CreateSceneEntity handle CreateSceneEntity(string) Create a scene entity to play the specified scene.
DebugDrawBox void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float) Draw a debug overlay box
DebugDrawLine void DebugDrawLine(Vector, Vector, int, int, int, bool, float) Draw a debug overlay box
DoIncludeScript bool DoIncludeScript(string, handle) Execute a script (internal)
EntFire function EntFire(target, action, value, delay, activator) Generate and entity i/o event
EntFireByHandle void EntFireByHandle(handle, string, string, float, handle, handle) Generate and entity i/o event. First parameter is an entity instance.
FrameTime float FrameTime() Get the time spent on the server in the last frame
GetBluePlayerIndex int GetBluePlayerIndex() Player index of the blue player.
GetCoopBranchLevelIndex int GetCoopBranchLevelIndex(int) Given the 'branch' argument, returns the current chosen level.
GetCoopSectionIndex int GetCoopSectionIndex() Section that the coop players have selected to load.
GetDeveloperLevel int GetDeveloperLevel() Gets the level of 'develoer'
GetHighestActiveBranch int GetHighestActiveBranch() Returns which branches should be available in the hub.
GetMapName string GetMapName() Get the name of the map.
GetOrangePlayerIndex int GetOrangePlayerIndex() Player index of the orange player.
GetPlayer handle GetPlayer() Returns the player (SP Only).
GetPlayerSilenceDuration float GetPlayerSilenceDuration(int) Time that the specified player has been silent on the mic.
IsLevelComplete bool IsLevelComplete(int, int) Returns true if the level in the specified branch is completed by either player.
IsMultiplayer bool IsMultiplayer() Is this a multiplayer game?
IsPlayerLevelComplete bool IsPlayerLevelComplete(int, int, int) Returns true if the level in the specified branch is completed by a specific player.
LoopSinglePlayerMaps bool LoopSinglePlayerMaps() Run the single player maps in a continuous loop.
MarkMapComplete void MarkMapComplete(string) Marks a maps a complete for both players.
PrecacheMovie void PrecacheMovie(string) Precaches a named movie. Only valid to call within the entity's 'Precache' function called on mapspawn.
RandomFloat float RandomFloat(float, float) Generate a random floating point number within a range, inclusive
RandomInt int RandomInt(int, int) Generate a random integer within a range, inclusive
RecordAchievementEvent void RecordAchievementEvent(string, int) Records achievement event or progress
ScriptShowHudMessageAll void ScriptShowHudMessageAll(string, float) Show center print text message.
ScriptSteamShowURL bool ScriptSteamShowURL(string) Bring up the steam overlay and shows the specified URL. (Full address with protocol type is required, e.g. http://www.steamgames.com/)
SendToConsole void SendToConsole(string) Send a string to the console as a command
SetDucking void SetDucking(string, string, float) Set the level of an audio ducking channel
ShowMessage void ShowMessage(string) Print a hud message on all clients
Time float Time() Get the current server time
TraceLine float TraceLine(Vector, Vector, handle) given 2 points & ent to ignore, return fraction along line that hits world or models
UniqueString function UniqueString(string) 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.