Nuclear Dawn/Scripting/Script Functions: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added more functions)
(Add CBaseAnimating, CCallChainer and CSimpleCallChainer)
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{sq}} This list contains all engine-related Squirrel variables, functions, and constants currently available for [[VScript]] in {{game link|Nuclear Dawn}}. Some are not available yet but guaranteed to be in the next update. More not yet listed are also being added to the game and not yet listed.
Automatically generated Squirrel functions list for {{nd|4}}.
 
== Variables ==


== Classes ==
== Classes ==
=== CEntities ===
=== :: (Global functions) ===
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 10: Line 9:
! Description
! Description
|-
|-
| <code>CreateByClassname</code>
| <code>DebugDrawBox</code>
| <code>handle CEntities::CreateByClassname(string)</code>
| <code>void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float)</code>
| Creates entity by class name.
| 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>GetConVarFloat</code>
| <code>float GetConVarFloat(string)</code>
| Retrieves a ConVar's value as a float
|-
| <code>GetConVarInt</code>
| <code>int GetConVarInt(string)</code>
| Retrieves a ConVar's value as an integer
|-
|-
| <code>FindByClassname</code>
| <code>GetConVarString</code>
| <code>handle CEntities::FindByClassname(handle, string)</code>
| <code>string GetConVarString(string)</code>
| Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
| Retrieves a ConVar's value as a string
|-
|-
| <code>FindByClassnameNearest</code>
| <code>GetMapName</code>
| <code>handle CEntities::FindByClassnameNearest(string, Vector, float)</code>
| <code>string GetMapName()</code>
| Find entities by class name nearest to a point.
| Get the name of the map.
|-
|-
| <code>FindByClassnameWithin</code>
| <code>GetTeam</code>
| <code>handle CEntities::FindByClassnameWithin(handle, string, Vector, float)</code>
| <code>handle GetTeam(int)</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
| Returns a team's handle.
|-
|-
| <code>FindByModel</code>
| <code>RandomFloat</code>
| <code>handle CEntities::FindByModel(handle, string)</code>
| <code>float RandomFloat(float, float)</code>
| Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
| Generate a random floating point number within a range, inclusive
|-
|-
| <code>FindByName</code>
| <code>RandomInt</code>
| <code>handle CEntities::FindByName(handle, string)</code>
| <code>int RandomInt(int, int)</code>
| Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
| Generate a random integer within a range, inclusive
|-
|-
| <code>FindByNameNearest</code>
| <code>SendToConsole</code>
| <code>handle CEntities::FindByNameNearest(string, Vector, float)</code>
| <code>void SendToConsole(string)</code>
| Find entities by name nearest to a point.
| Send a string to the console as a command
|-
|-
| <code>FindByNameWithin</code>
| <code>SetConVarFloat</code>
| <code>handle CEntities::FindByNameWithin(handle, string, Vector, float)</code>
| <code>void SetConVarFloat(string, float)</code>
| Find entities by name within a radius. Pass 'null' to start an iteration, or reference to a previously found continue a search
| Sets a ConVar's value from a float
|-
|-
| <code>FindByTarget</code>
| <code>SetConVarInt</code>
| <code>handle CEntities::FindByTarget(handle, string)</code>
| <code>void SetConVarInt(string, int)</code>
| Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
| Sets a ConVar's value from an integer
|-
|-
| <code>FindInSphere</code>
| <code>SetConVarString</code>
| <code>handle CEntities::FindInSphere(handle, Vector, float)</code>
| <code>void SetConVarString(string, string)</code>
| Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
| Sets a ConVar's value from a string
|-
|-
| <code>First</code>
| <code>ShowMessage</code>
| <code>handle CEntities::First()</code>
| <code>void ShowMessage(string)</code>
| Begin an iteration over the list of entities
| Print a hud message on all clients
|-
|-
| <code>Next</code>
| <code>Time</code>
| <code>handle CEntities::Next(handle)</code>
| <code>float Time()</code>
| Continue an iteration over the list of entities, providing reference to a previously found entity
| Get the current server time
|}
|}
=== CBaseEntity ===
=== CBaseEntity ===
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 65: Line 80:
! Description
! Description
|-
|-
| <code>ConnectOutput</code>
| <code>CBaseEntity::__KeyValueFromInt</code>
| <code>void ConnectOutput(string, string)</code>
| <code>void CBaseEntity::__KeyValueFromInt(string, int)</code>
| Sets int value for key name on the entity.
|-
| <code>CBaseEntity::__KeyValueFromString</code>
| <code>void CBaseEntity::__KeyValueFromString(string, string)</code>
| Sets string value for key name on the entity.
|-
| <code>CBaseEntity::__KeyValueFromVector</code>
| <code>void CBaseEntity::__KeyValueFromVector(string, vector)</code>
| Sets vector value for key name on the entity.
|-
| <code>CBaseEntity::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
| Adds an I/O connection that will call the named function when the specified output fires
|-
|-
| <code>DisconnectOutput</code>
| <code>CBaseEntity::DisconnectOutput</code>
| <code>void DisconnectOutput(string, string)</code>
| <code>void CBaseEntity::DisconnectOutput(string, string)</code>
| Removes a connected script function from an I/O event.
| Removes a connected script function from an I/O event.
|-
|-
| <code>GetHealth</code>
| <code>CBaseEntity::FirstMoveChild</code>
| <code>int GetHealth()</code>
| <code>handle CBaseEntity::FirstMoveChild()</code>
| Returns health of the entity.
|
|-
| <code>CBaseEntity::GetClassname</code>
| <code>string CBaseEntity::GetClassname()</code>
|
|-
| <code>CBaseEntity::GetForwardVector</code>
| <code>Vector CBaseEntity::GetForwardVector()</code>
| Get the forward vector of the entity
|-
| <code>CBaseEntity::GetHealth</code>
| <code>int CBaseEntity::GetHealth()</code>
|  
|-
| <code>CBaseEntity::GetLifeState</code>
| <code>int CBaseEntity::GetLifeState()</code>
|
|-
| <code>CBaseEntity::GetMaxHealth</code>
| <code>int CBaseEntity::GetMaxHealth()</code>
|
|-
| <code>CBaseEntity::GetMoveParent</code>
| <code>handle CBaseEntity::GetMoveParent()</code>
| If in hierarchy, retrieves the entity's parent
|-
| <code>CBaseEntity::GetName</code>
| <code>string CBaseEntity::GetName()</code>
|
|-
|-
| <code>SetHealth</code>
| <code>CBaseEntity::GetOrigin</code>
| <code>void SetHealth(int)</code>
| <code>Vector CBaseEntity::GetOrigin()</code>
| Sets health of the entity.
|  
|-
|-
| <code>GetMaxHealth</code>
| <code>CBaseEntity::GetPreTemplateName</code>
| <code>int GetMaxHealth()</code>
| <code>string CBaseEntity::GetPreTemplateName()</code>
| Returns maximum health amount of the entity.
| Get the entity name stripped of template unique decoration
|-
|-
| <code>GetTeam</code>
| <code>CBaseEntity::GetRootMoveParent</code>
| <code>handle GetTeam()</code>
| <code>handle CBaseEntity::GetRootMoveParent()</code>
| Returns handle to the entity's team.
| If in hierarchy, walks up the hierarchy to find the root parent
|-
| <code>CBaseEntity::GetScriptId</code>
| <code>string CBaseEntity::GetScriptId()</code>
| Retrieve the unique identifier used to refer to the entity within the scripting system
|-
| <code>CBaseEntity::GetScriptScope</code>
| <code>handle CBaseEntity::GetScriptScope()</code>
| Retrieve the script-side data associated with an entity
|-
| <code>CBaseEntity::GetTeam</code>
| <code>handle CBaseEntity::GetTeam()</code>
|
|-
|-
| <code>GetTeamNumber</code>
| <code>CBaseEntity::GetTeamNumber</code>
| <code>int GetTeamNumber()</code>
| <code>int CBaseEntity::GetTeamNumber()</code>
| Returns team index of the entity (0 - Unassigned, 1 - Spectator, 2 - Consortium, 3 - Empire).
|  
|-
|-
| <code>GetLifeState</code>
| <code>CBaseEntity::GetVelocity</code>
| <code>int GetLifeState()</code>
| <code>Vector CBaseEntity::GetVelocity()</code>
| Returns life state of the entity (0 - alive, 1 - dying, 2 - dead).
|  
|-
|-
| <code>GetClassname</code>
| <code>CBaseEntity::NextMovePeer</code>
| <code>string GetClassname()</code>
| <code>handle CBaseEntity::NextMovePeer()</code>
| Returns classname of the entity.
|  
|-
|-
| <code>GetName</code>
| <code>CBaseEntity::SetAbsOrigin</code>
| <code>string GetName()</code>
| <code>void CBaseEntity::SetAbsOrigin(Vector)</code>
| Returns target name of the entity.
| SetAbsOrigin
|-
|-
| <code>GetPreTemplateName</code>
| <code>CBaseEntity::SetForwardVector</code>
| <code>string GetPreTemplateName()</code>
| <code>void CBaseEntity::SetForwardVector(Vector)</code>
| Get the entity name stripped of template unique decoration.
| Set the orientation of the entity to have this forward vector
|-
|-
| <code>GetOrigin</code>
| <code>CBaseEntity::SetHealth</code>
| <code>vector GetOrigin()</code>
| <code>void CBaseEntity::SetHealth(int)</code>
| Returns absolute origin of the entity.
|  
|-
|-
| <code>SetOrigin</code>
| <code>CBaseEntity::SetOrigin</code>
| <code>void SetOrigin(vector)</code>
| <code>void CBaseEntity::SetOrigin(Vector)</code>
| Sets absolute origin of the entity.
|  
|-
|-
| <code>GetForwardVector</code>
| <code>CBaseEntity::SetVelocity</code>
| <code>vector GetForwardVector()</code>
| <code>void CBaseEntity::SetVelocity(Vector)</code>
| Get the forward vector of the entity.
|  
|-
|-
| <code>SetForwardVector</code>
| <code>CBaseEntity::ValidateScriptScope</code>
| <code>void SetForwardVector(vector)</code>
| <code>bool CBaseEntity::ValidateScriptScope()</code>
| Set the orientation of the entity to have this forward vector.
| Ensure that an entity's script scope has been created
|}
=== CBaseAnimating ===
Extends <code>CBaseEntity</code>.
 
There is no new methods for this class
<!-- i probably shouldn't have added this but it's funny doe, i've verified this does exist --~~~~ -->
 
=== CEntities ===
==== Methods ====
{| class="standard-table" style="width: 100%;"
! Function
! Signature
! Description
|-
|-
| <code>GetVelocity</code>
| <code>CEntities::CreateByClassname</code>
| <code>vector GetVelocity()</code>
| <code>handle CEntities::CreateByClassname(string)</code>
| Get the velocity of the entity.
| Creates an entity by classname
|-
|-
| <code>SetVelocity</code>
| <code>CEntities::FindByClassname</code>
| <code>void SetVelocity(vector)</code>
| <code>handle CEntities::FindByClassname(handle, string)</code>
| Set the velocity of the entity.
| Find entities by class name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
|-
| <code>GetMoveParent</code>
| <code>CEntities::FindByClassnameNearest</code>
| <code>handle GetMoveParent()</code>
| <code>handle CEntities::FindByClassnameNearest(string, Vector, float)</code>
| Get handle to the move parent of the entity.
| Find entities by class name nearest to a point.
|-
|-
| <code>GetRootMoveParent</code>
| <code>CEntities::FindByClassnameWithin</code>
| <code>handle GetRootMoveParent()</code>
| <code>handle CEntities::FindByClassnameWithin(handle, string, Vector, float)</code>
| Get handle to the root move parent of the entity.
| 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>FirstMoveChild</code>
| <code>CEntities::FindByModel</code>
| <code>handle FirstMoveChild()</code>
| <code>handle CEntities::FindByModel(handle, string)</code>
| Get handle to the first move child of the entity.
| Find entities by model name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
|-
| <code>NextMovePeer</code>
| <code>CEntities::FindByName</code>
| <code>handle NextMovePeer()</code>
| <code>handle CEntities::FindByName(handle, string)</code>
| Get handle to the next move peer of the entity.
| Find entities by name. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
|-
| <code>__KeyValueFromString</code>
| <code>CEntities::FindByNameNearest</code>
| <code>void __KeyValueFromString(string, string)</code>
| <code>handle CEntities::FindByNameNearest(string, Vector, float)</code>
| Sets string value for key name on the entity.
| Find entities by name nearest to a point.
|-
|-
| <code>__KeyValueFromInt</code>
| <code>CEntities::FindByNameWithin</code>
| <code>void __KeyValueFromInt(string, int)</code>
| <code>handle CEntities::FindByNameWithin(handle, string, Vector, float)</code>
| Sets int value for key name on the entity.
| 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>__KeyValueFromVector</code>
| <code>CEntities::FindByTarget</code>
| <code>void __KeyValueFromVector(string, vector)</code>
| <code>handle CEntities::FindByTarget(handle, string)</code>
| Sets vector value for key name on the entity.
| Find entities by targetname. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
|-
| <code>ValidateScriptScope</code>
| <code>CEntities::FindInSphere</code>
| <code>bool ValidateScriptScope()</code>
| <code>handle CEntities::FindInSphere(handle, Vector, float)</code>
| Ensure that an entity's script scope has been created.
| Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
|-
|-
| <code>GetScriptScope</code>
| <code>CEntities::First</code>
| <code>handle GetScriptScope()</code>
| <code>handle CEntities::First()</code>
| Retrieve the script-side data associated with an entity.
| Begin an iteration over the list of entities
|-
|-
| <code>GetScriptId</code>
| <code>CEntities::Next</code>
| <code>int GetScriptId()</code>
| <code>handle CEntities::Next(handle)</code>
| Retrieve the unique identifier used to refer to the entity within the scripting system.
| Continue an iteration over the list of entities, providing reference to a previously found entity
|}
|}
=== CNDPlayer ===
=== CNDPlayer ===
Extends <code>CBaseEntity</code>.
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 180: Line 261:
! Description
! Description
|-
|-
| <code>IsCommander</code>
| <code>CNDPlayer::IsCommander</code>
| <code>bool IsCommander()</code>
| <code>bool CNDPlayer::IsCommander()</code>
| Get whether or not the player is the commander for their team.
| Get whether or not the player is the commander for their team.
|-
|-
| <code>IsCommanding</code>
| <code>CNDPlayer::IsCommanding</code>
| <code>bool IsCommanding()</code>
| <code>bool CNDPlayer::IsCommanding()</code>
| Get whether or not the player is currently in RTS mode.
| Get whether or not the player is currently in RTS mode.
|-
|-
| <code>GetSquad</code>
| <code>CNDPlayer::GetSquad</code>
| <code>handle GetSquad()</code>
| <code>handle CNDPlayer::GetSquad()</code>
| Returns handle to the player's squad.
| Returns handle to the player's squad.
|-
|-
| <code>GetSquadNumber</code>
| <code>CNDPlayer::GetSquadNumber</code>
| <code>int GetSquadNumber()</code>
| <code>int CNDPlayer::GetSquadNumber()</code>
| Returns squad index of the player (0 - Alpha, 1 - Bravo, 2 - Charlie, 3 - Delta).
| Returns squad index of the player (0 - Alpha, 1 - Bravo, 2 - Charlie, 3 - Delta).
|-
|-
| <code>GetClass</code>
| <code>CNDPlayer::GetClass</code>
| <code>int GetClass()</code>
| <code>int CNDPlayer::GetClass()</code>
| Returns class index of the player.
| Returns class index of the player.
|-
|-
| <code>GetKit</code>
| <code>CNDPlayer::GetKit</code>
| <code>int GetKit()</code>
| <code>int CNDPlayer::GetKit()</code>
| Returns kit index of the player.
| Returns kit index of the player.
|-
|-
| <code>GetActiveGizmo</code>
| <code>CNDPlayer::GetActiveGizmo</code>
| <code>int GetActiveGizmo()</code>
| <code>int CNDPlayer::GetActiveGizmo()</code>
| Returns index of the player's currently selected gizmo.
| Returns index of the player's currently selected gizmo.
|-
|-
| <code>IsGizmoActive</code>
| <code>CNDPlayer::IsGizmoActive</code>
| <code>bool IsGizmoActive(int)</code>
| <code>bool CNDPlayer::IsGizmoActive(int)</code>
| Returns whether effect of gizmo is active, either from equipped on player or active gizmo for player's squad.
| Returns whether effect of gizmo is active, either from equipped on player or active gizmo for player's squad.
|-
|-
| <code>IsInCondition</code>
| <code>CNDPlayer::IsInCondition</code>
| <code>bool IsInCondition(int)</code>
| <code>bool CNDPlayer::IsInCondition(int)</code>
| Returns whether given condition is currently applied to the player.
| Returns whether given condition is currently applied to the player.
|-
|-
| <code>GetWeaponByName</code>
| <code>CNDPlayer::GetWeaponByName</code>
| <code>handle GetWeaponByName(string)</code>
| <code>handle CNDPlayer::GetWeaponByName(string)</code>
| Returns handle to weapon owned by player of specified classname or null if unowned.
| Returns handle to weapon owned by player of specified classname or null if unowned.
|-
|-
| <code>GetAmmoCount</code>
| <code>CNDPlayer::GetAmmoCount</code>
| <code>int GetAmmoCount(int)</code>
| <code>int CNDPlayer::GetAmmoCount(int)</code>
| Returns reserve ammo count of the player of specificed ammo type.
| Returns reserve ammo count of the player of specificed ammo type.
|-
|-
| <code>GiveAmmo</code>
| <code>CNDPlayer::GiveAmmo</code>
| <code>void GiveAmmo(int, int)</code>
| <code>void CNDPlayer::GiveAmmo(int, int)</code>
| Gives the player ammo of specified type.
| Gives the player ammo of specified type.
|}
|}


=== CNDTeam ===
=== CNDTeam ===
Extends <code>CBaseEntity</code>.
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 235: Line 318:
! Description
! Description
|-
|-
| <code>GetTeamName</code>
| <code>CNDTeam::GetTeamName</code>
| <code>string GetTeamName()</code>
| <code>string CNDTeam::GetTeamName()</code>
| Returns name of the team.
| Returns name of the team.
|-
|-
| <code>GetResources</code>
| <code>CNDTeam::GetResources</code>
| <code>int GetResources()</code>
| <code>int CNDTeam::GetResources()</code>
| Returns resource count of the team.
| Returns resource count of the team.
|-
|-
| <code>SetResources</code>
| <code>CNDTeam::SetResources</code>
| <code>void SetResources(int)</code>
| <code>void CNDTeam::SetResources(int)</code>
| Sets resource count of the team.
| Sets resource count of the team.
|-
|-
| <code>GetCommander</code>
| <code>CNDTeam::GetCommander</code>
| <code>handle GetCommander()</code>
| <code>handle CNDTeam::GetCommander()</code>
| Returns handle to team's commander player.
| Returns handle to team's commander player.
|-
|-
| <code>GetSquad</code>
| <code>CNDTeam::GetSquad</code>
| <code>handle GetSquad(int)</code>
| <code>handle CNDTeam::GetSquad(int)</code>
| Returns handle to indexed squad for the team.
| Returns handle to indexed squad for the team.
|-
|-
| <code>GetPlayerCount</code>
| <code>CNDTeam::GetPlayerCount</code>
| <code>int GetPlayerCount()</code>
| <code>int CNDTeam::GetPlayerCount()</code>
| Returns the number of players in the team.
| Returns the number of players in the team.
|-
|-
| <code>GetPlayer</code>
| <code>CNDTeam::GetPlayer</code>
| <code>handle GetPlayer(int)</code>
| <code>handle CNDTeam::GetPlayer(int)</code>
| Returns handle to player at specified index of team players (0-based).
| Returns handle to player at specified index of team players (0-based).
|}
|}


=== CNDSquad ===
=== CNDSquad ===
Extends <code>CBaseEntity</code>.
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 270: Line 355:
! Description
! Description
|-
|-
| <code>GetActiveGizmo</code>
| <code>CNDSquad::GetActiveGizmo</code>
| <code>int GetActiveGizmo</code>
| <code>int CNDSquad::GetActiveGizmo</code>
| Returns the active gizmo for the squad.
| Returns the active gizmo for the squad.
|-
|-
| <code>AddPlayer</code>
| <code>CNDSquad::AddPlayer</code>
| <code>void AddPlayer(handle)</code>
| <code>void CNDSquad::AddPlayer(handle)</code>
| Adds player to the squad.
| Adds player to the squad.
|-
|-
| <code>RemovePlayer</code>
| <code>CNDSquad::RemovePlayer</code>
| <code>void RemovePlayer(handle)</code>
| <code>void CNDSquad::RemovePlayer(handle)</code>
| Removes player from the squad.
| Removes player from the squad.
|-
|-
| <code>HasPlayer</code>
| <code>CNDSquad::HasPlayer</code>
| <code>bool HasPlayer(handle)</code>
| <code>bool CNDSquad::HasPlayer(handle)</code>
| Returns whether or not the player is in the squad.
| Returns whether or not the player is in the squad.
|}
|}


=== CNDBaseWeapon ===
=== CNDBaseWeapon ===
Extends <code>CBaseEntity</code>.
==== Methods ====
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 293: Line 380:
! Description
! Description
|-
|-
| <code>GetClipAmmoCount</code>
| <code>CNDBaseWeapon::GetClipAmmoCount</code>
| <code>int GetClipAmmoCount()</code>
| <code>int CNDBaseWeapon::GetClipAmmoCount()</code>
| Returns the current ammo count inside the clip of the weapon.
| Returns the current ammo count inside the clip of the weapon.
|-
|-
| <code>SetClipAmmoCount</code>
| <code>CNDBaseWeapon::SetClipAmmoCount</code>
| <code>void SetClipAmmoCount(int)</code>
| <code>void CNDBaseWeapon::SetClipAmmoCount(int)</code>
| Sets the current ammo count inside the clip of the weapon.
| Sets the current ammo count inside the clip of the weapon.
|-
|-
| <code>GetAmmoType</code>
| <code>CNDBaseWeapon::GetAmmoType</code>
| <code>int GetAmmoType()</code>
| <code>int CNDBaseWeapon::GetAmmoType()</code>
| Returns the ammo type used by the weapon.
| Returns the ammo type used by the weapon.
|-
|-
| <code>GetMaxClipAmmoCount</code>
| <code>CNDBaseWeapon::GetMaxClipAmmoCount</code>
| <code>int GetMaxClipAmmoCount()</code>
| <code>int CNDBaseWeapon::GetMaxClipAmmoCount()</code>
| Returns the maximum amount of ammo that the clip of the weapon can hold.
| Returns the maximum amount of ammo that the clip of the weapon can hold.
|-
|-
| <code>GetDefaultClipAmmoCount</code>
| <code>CNDBaseWeapon::GetDefaultClipAmmoCount</code>
| <code>int GetDefaultClipAmmoCount()</code>
| <code>int CNDBaseWeapon::GetDefaultClipAmmoCount()</code>
| Returns the default amount of ammo that the clip of the weapon holds.
| Returns the default amount of ammo that the clip of the weapon holds.
}
|}
=== CEnvEntityMaker ===
Extends <code>CBaseEntity</code>.


=== CEnvEntityMaker ===
Script handle class for [[env_entity_maker]].
==== Methods ====
{| class="standard-table" style="width: 100%;"
! Function !! Signature !! Description
|-
| <code>CEnvEntityMaker::SpawnEntity</code>
| <code>void CEnvEntityMaker::SpawnEntity()</code>
| Create an entity at the location of the maker.
|-
| <code>CEnvEntityMaker::SpawnEntityAtEntityOrigin</code>
| <code>void CEnvEntityMaker::SpawnEntityAtEntityOrigin(CBaseEntity entity)</code>
| Create an entity at the location of a specified entity instance.
|-
| <code>CEnvEntityMaker::SpawnEntityAtLocation</code>
| <code>void CEnvEntityMaker::SpawnEntityAtLocation(Vector origin, QAngle orientation)</code>
| Create an entity at a specified location and orientation.
|-
| <code>CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin</code>
| <code>void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string name)</code>
| Create an entity at the location of a named entity.
|}


=== CCallChainer ===
=== CCallChainer ===
'''CCallChainer''' objects collect all functions with a matching prefix in a given scope, then inserts it all into the chains table with the prefix removed. All collected unprefixed functions can then be called in a chain using the class's Call() method, given the method's ''event'' argument matches the functions' name.


=== CSimpleCallChainer ===
Whenever a '''CCallChainer''' object is created, a function named Dispatch followed by its given prefix will also be created, which the class binds the environment of its Call() method to.
 
=== regxp ===
 
=== Vector ===


== Other functions ==
==== Methods ====
=== Engine specific ===
{| class="standard-table" style="width: 100%;"
{| class="standard-table" style="width: 100%;"
! Function
! Function
Line 331: Line 436:
! Description
! Description
|-
|-
| <code>DebugDrawBox</code>
| <code>constructor</code>
| <code>void DebugDrawBox(Vector, Vector, Vector, int, int, int, int, float)</code>
| <code>CCallChainer(string ''functionPrefix'', table ''scope'' = null)</code>
| Draw a debug overlay box
| Creates a CCallChainer object that'll collect functions that have a matching prefix in the given scope.
|-
| <code>CCallChainer::PostScriptExecute</code>
| <code>void CCallChainer::PostScriptExecute()</code>
| Search for all non-native functions with matching prefixes, then push them into the chains table.
|-
| <code>CCallChainer::Call</code>
| <code>bool CCallChainer::Call(string ''event'', any ...)</code>
| Find an unprefixed function name in the chains table and call it with the given arguments.
|}
 
==== Members ====
{| class="standard-table" style="width: 100%;"
! Instance
! Type
! Description
|-
|-
| <code>DebugDrawLine</code>
| <code>chains</code>
| <code>void DebugDrawLine(Vector, Vector, int, int, int, bool, float)</code>
| <code>table</code>
| Draw a debug overlay box
| Contains names of unprefixed functions, each with an array of functions to call.
|-
|-
| <code>DoIncludeScript</code>
| <code>prefix</code>
| <code>bool DoIncludeScript(string, handle)</code>
| <code>string</code>
| Execute a script (internal)
| Prefix that functions should have to be added into the chains table. Set by the constructor.
|-
|-
| <code>EntFire</code>
| <code>scope</code>
| <code>function EntFire(target, action, value, delay, activator)</code>
| <code>table</code>
| Generate and entity i/o event
| If set, seek functions in this scope instead. Set by the constructor.
|}
 
=== CSimpleCallChainer ===
Intended to be simpler to use than CCallChainer, the class '''CSimpleCallChainer''' holds only a single chain of functions inside an array instead of multiple inside a table. As such, its Call() method does not need a function's name.
 
==== Methods ====
{| class="standard-table" style="width: 100%;"
! Function
! Signature
! Description
|-
|-
| <code>GetTeam</code>
| <code>constructor</code>
| <code>function GetTeam( int )</code>
| <code>CSimpleCallChainer(string ''functionPrefix'', table ''scope'' = null, exactMatch = false)</code>
| Returns handle to a team by index. (0 - Unassigned, 1 - Spectators, 2 - Consortium, 3 - Empire)
| Creates a CSimpleCallChainer object that'll collect functions that have a matching prefix in the given scope, unless it seek for an exact name match.
|-
|-
| <code>RandomFloat</code>
| <code>CSimpleCallChainer::PostScriptExecute</code>
| <code>float RandomFloat(float, float)</code>
| <code>void CSimpleCallChainer::PostScriptExecute()</code>
| Generate a random floating point number within a range, inclusive
| Begin searching for all non-native functions with matching prefixes, then push them into the chain array.
|-
|-
| <code>RandomInt</code>
| <code>CSimpleCallChainer::Call</code>
| <code>int RandomInt(int, int)</code>
| <code>bool CSimpleCallChainer::Call(any ...)</code>
| Generate a random integer within a range, inclusive
| Call all functions inside the chain array with the given arguments.
|}
 
==== Members ====
{| class="standard-table" style="width: 100%;"
! Instance
! Type
! Description
|-
|-
| <code>SendToConsole</code>
| <code>chain</code>
| <code>void SendToConsole(string)</code>
| <code>array</code>
| Send a string to the console as a command
| All functions to be called by the Call() method.
|-
|-
| <code>ShowMessage</code>
| <code>exactMatch</code>
| <code>void ShowMessage(string)</code>
| <code>bool</code>
| Print a hud message on all clients
| If set, names of non-native functions and prefix must be an exact match.  Set by the constructor.
|-
|-
| <code>Time</code>
| <code>prefix</code>
| <code>float Time()</code>
| <code>string</code>
| Get the current server time
| Prefix that functions should have to be added into the chain array. Set by the constructor.
|-
|-
| <code>UniqueString</code>
| <code>scope</code>
| <code>function UniqueString(string)</code>
| <code>table</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.
| If set, seek functions in this scope instead. Set by the constructor.
|}
|}


=== Standard Squirrel libary ===
== Constants ==


== See also ==
== See also ==
* [[L4D2 Vscripts]]
* [[VScript]]
* [[L4D2 Vscript Examples]]
* [[VScript Fundamentals]]
* {{portal2}} [[List of Portal 2 Script Functions]]
* {{sq}} [[Squirrel]]
 
[[Category:Nuclear Dawn]]
[[Category:Scripting]]

Latest revision as of 07:58, 19 November 2025

Automatically generated Squirrel functions list for Nuclear Dawn Nuclear Dawn.

Classes

:: (Global functions)

Methods

Function Signature Description
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)
GetConVarFloat float GetConVarFloat(string) Retrieves a ConVar's value as a float
GetConVarInt int GetConVarInt(string) Retrieves a ConVar's value as an integer
GetConVarString string GetConVarString(string) Retrieves a ConVar's value as a string
GetMapName string GetMapName() Get the name of the map.
GetTeam handle GetTeam(int) Returns a team's handle.
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
SendToConsole void SendToConsole(string) Send a string to the console as a command
SetConVarFloat void SetConVarFloat(string, float) Sets a ConVar's value from a float
SetConVarInt void SetConVarInt(string, int) Sets a ConVar's value from an integer
SetConVarString void SetConVarString(string, string) Sets a ConVar's value from a string
ShowMessage void ShowMessage(string) Print a hud message on all clients
Time float Time() Get the current server time

CBaseEntity

Methods

Function Signature Description
CBaseEntity::__KeyValueFromInt void CBaseEntity::__KeyValueFromInt(string, int) Sets int value for key name on the entity.
CBaseEntity::__KeyValueFromString void CBaseEntity::__KeyValueFromString(string, string) Sets string value for key name on the entity.
CBaseEntity::__KeyValueFromVector void CBaseEntity::__KeyValueFromVector(string, vector) Sets vector value for key name on the entity.
CBaseEntity::ConnectOutput void CBaseEntity::ConnectOutput(string, string) Adds an I/O connection that will call the named function when the specified output fires
CBaseEntity::DisconnectOutput void CBaseEntity::DisconnectOutput(string, string) Removes a connected script function from an I/O event.
CBaseEntity::FirstMoveChild handle CBaseEntity::FirstMoveChild()
CBaseEntity::GetClassname string CBaseEntity::GetClassname()
CBaseEntity::GetForwardVector Vector CBaseEntity::GetForwardVector() Get the forward vector of the entity
CBaseEntity::GetHealth int CBaseEntity::GetHealth()
CBaseEntity::GetLifeState int CBaseEntity::GetLifeState()
CBaseEntity::GetMaxHealth int CBaseEntity::GetMaxHealth()
CBaseEntity::GetMoveParent handle CBaseEntity::GetMoveParent() If in hierarchy, retrieves the entity's parent
CBaseEntity::GetName string CBaseEntity::GetName()
CBaseEntity::GetOrigin Vector CBaseEntity::GetOrigin()
CBaseEntity::GetPreTemplateName string CBaseEntity::GetPreTemplateName() Get the entity name stripped of template unique decoration
CBaseEntity::GetRootMoveParent handle CBaseEntity::GetRootMoveParent() If in hierarchy, walks up the hierarchy to find the root parent
CBaseEntity::GetScriptId string CBaseEntity::GetScriptId() Retrieve the unique identifier used to refer to the entity within the scripting system
CBaseEntity::GetScriptScope handle CBaseEntity::GetScriptScope() Retrieve the script-side data associated with an entity
CBaseEntity::GetTeam handle CBaseEntity::GetTeam()
CBaseEntity::GetTeamNumber int CBaseEntity::GetTeamNumber()
CBaseEntity::GetVelocity Vector CBaseEntity::GetVelocity()
CBaseEntity::NextMovePeer handle CBaseEntity::NextMovePeer()
CBaseEntity::SetAbsOrigin void CBaseEntity::SetAbsOrigin(Vector) SetAbsOrigin
CBaseEntity::SetForwardVector void CBaseEntity::SetForwardVector(Vector) Set the orientation of the entity to have this forward vector
CBaseEntity::SetHealth void CBaseEntity::SetHealth(int)
CBaseEntity::SetOrigin void CBaseEntity::SetOrigin(Vector)
CBaseEntity::SetVelocity void CBaseEntity::SetVelocity(Vector)
CBaseEntity::ValidateScriptScope bool CBaseEntity::ValidateScriptScope() Ensure that an entity's script scope has been created

CBaseAnimating

Extends CBaseEntity.

There is no new methods for this class

CEntities

Methods

Function Signature Description
CEntities::CreateByClassname handle CEntities::CreateByClassname(string) Creates an entity by classname
CEntities::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
CEntities::FindByClassnameNearest handle CEntities::FindByClassnameNearest(string, Vector, float) Find entities by class name nearest to a point.
CEntities::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
CEntities::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
CEntities::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
CEntities::FindByNameNearest handle CEntities::FindByNameNearest(string, Vector, float) Find entities by name nearest to a point.
CEntities::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
CEntities::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
CEntities::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
CEntities::First handle CEntities::First() Begin an iteration over the list of entities
CEntities::Next handle CEntities::Next(handle) Continue an iteration over the list of entities, providing reference to a previously found entity

CNDPlayer

Extends CBaseEntity.

Methods

Function Signature Description
CNDPlayer::IsCommander bool CNDPlayer::IsCommander() Get whether or not the player is the commander for their team.
CNDPlayer::IsCommanding bool CNDPlayer::IsCommanding() Get whether or not the player is currently in RTS mode.
CNDPlayer::GetSquad handle CNDPlayer::GetSquad() Returns handle to the player's squad.
CNDPlayer::GetSquadNumber int CNDPlayer::GetSquadNumber() Returns squad index of the player (0 - Alpha, 1 - Bravo, 2 - Charlie, 3 - Delta).
CNDPlayer::GetClass int CNDPlayer::GetClass() Returns class index of the player.
CNDPlayer::GetKit int CNDPlayer::GetKit() Returns kit index of the player.
CNDPlayer::GetActiveGizmo int CNDPlayer::GetActiveGizmo() Returns index of the player's currently selected gizmo.
CNDPlayer::IsGizmoActive bool CNDPlayer::IsGizmoActive(int) Returns whether effect of gizmo is active, either from equipped on player or active gizmo for player's squad.
CNDPlayer::IsInCondition bool CNDPlayer::IsInCondition(int) Returns whether given condition is currently applied to the player.
CNDPlayer::GetWeaponByName handle CNDPlayer::GetWeaponByName(string) Returns handle to weapon owned by player of specified classname or null if unowned.
CNDPlayer::GetAmmoCount int CNDPlayer::GetAmmoCount(int) Returns reserve ammo count of the player of specificed ammo type.
CNDPlayer::GiveAmmo void CNDPlayer::GiveAmmo(int, int) Gives the player ammo of specified type.

CNDTeam

Extends CBaseEntity.

Methods

Function Signature Description
CNDTeam::GetTeamName string CNDTeam::GetTeamName() Returns name of the team.
CNDTeam::GetResources int CNDTeam::GetResources() Returns resource count of the team.
CNDTeam::SetResources void CNDTeam::SetResources(int) Sets resource count of the team.
CNDTeam::GetCommander handle CNDTeam::GetCommander() Returns handle to team's commander player.
CNDTeam::GetSquad handle CNDTeam::GetSquad(int) Returns handle to indexed squad for the team.
CNDTeam::GetPlayerCount int CNDTeam::GetPlayerCount() Returns the number of players in the team.
CNDTeam::GetPlayer handle CNDTeam::GetPlayer(int) Returns handle to player at specified index of team players (0-based).

CNDSquad

Extends CBaseEntity.

Methods

Function Signature Description
CNDSquad::GetActiveGizmo int CNDSquad::GetActiveGizmo Returns the active gizmo for the squad.
CNDSquad::AddPlayer void CNDSquad::AddPlayer(handle) Adds player to the squad.
CNDSquad::RemovePlayer void CNDSquad::RemovePlayer(handle) Removes player from the squad.
CNDSquad::HasPlayer bool CNDSquad::HasPlayer(handle) Returns whether or not the player is in the squad.

CNDBaseWeapon

Extends CBaseEntity.

Methods

Function Signature Description
CNDBaseWeapon::GetClipAmmoCount int CNDBaseWeapon::GetClipAmmoCount() Returns the current ammo count inside the clip of the weapon.
CNDBaseWeapon::SetClipAmmoCount void CNDBaseWeapon::SetClipAmmoCount(int) Sets the current ammo count inside the clip of the weapon.
CNDBaseWeapon::GetAmmoType int CNDBaseWeapon::GetAmmoType() Returns the ammo type used by the weapon.
CNDBaseWeapon::GetMaxClipAmmoCount int CNDBaseWeapon::GetMaxClipAmmoCount() Returns the maximum amount of ammo that the clip of the weapon can hold.
CNDBaseWeapon::GetDefaultClipAmmoCount int CNDBaseWeapon::GetDefaultClipAmmoCount() Returns the default amount of ammo that the clip of the weapon holds.

CEnvEntityMaker

Extends CBaseEntity.

Script handle class for env_entity_maker.

Methods

Function Signature Description
CEnvEntityMaker::SpawnEntity void CEnvEntityMaker::SpawnEntity() Create an entity at the location of the maker.
CEnvEntityMaker::SpawnEntityAtEntityOrigin void CEnvEntityMaker::SpawnEntityAtEntityOrigin(CBaseEntity entity) Create an entity at the location of a specified entity instance.
CEnvEntityMaker::SpawnEntityAtLocation void CEnvEntityMaker::SpawnEntityAtLocation(Vector origin, QAngle orientation) Create an entity at a specified location and orientation.
CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin void CEnvEntityMaker::SpawnEntityAtNamedEntityOrigin(string name) Create an entity at the location of a named entity.

CCallChainer

CCallChainer objects collect all functions with a matching prefix in a given scope, then inserts it all into the chains table with the prefix removed. All collected unprefixed functions can then be called in a chain using the class's Call() method, given the method's event argument matches the functions' name.

Whenever a CCallChainer object is created, a function named Dispatch followed by its given prefix will also be created, which the class binds the environment of its Call() method to.

Methods

Function Signature Description
constructor CCallChainer(string functionPrefix, table scope = null) Creates a CCallChainer object that'll collect functions that have a matching prefix in the given scope.
CCallChainer::PostScriptExecute void CCallChainer::PostScriptExecute() Search for all non-native functions with matching prefixes, then push them into the chains table.
CCallChainer::Call bool CCallChainer::Call(string event, any ...) Find an unprefixed function name in the chains table and call it with the given arguments.

Members

Instance Type Description
chains table Contains names of unprefixed functions, each with an array of functions to call.
prefix string Prefix that functions should have to be added into the chains table. Set by the constructor.
scope table If set, seek functions in this scope instead. Set by the constructor.

CSimpleCallChainer

Intended to be simpler to use than CCallChainer, the class CSimpleCallChainer holds only a single chain of functions inside an array instead of multiple inside a table. As such, its Call() method does not need a function's name.

Methods

Function Signature Description
constructor CSimpleCallChainer(string functionPrefix, table scope = null, exactMatch = false) Creates a CSimpleCallChainer object that'll collect functions that have a matching prefix in the given scope, unless it seek for an exact name match.
CSimpleCallChainer::PostScriptExecute void CSimpleCallChainer::PostScriptExecute() Begin searching for all non-native functions with matching prefixes, then push them into the chain array.
CSimpleCallChainer::Call bool CSimpleCallChainer::Call(any ...) Call all functions inside the chain array with the given arguments.

Members

Instance Type Description
chain array All functions to be called by the Call() method.
exactMatch bool If set, names of non-native functions and prefix must be an exact match. Set by the constructor.
prefix string Prefix that functions should have to be added into the chain array. Set by the constructor.
scope table If set, seek functions in this scope instead. Set by the constructor.


See also