Nuclear Dawn/Scripting/Script Functions: Difference between revisions
(minor adjustments but i'll yap here more to continue the previous edit summary, i could've just reverted to previous page but that was incomplete (some classes were just not filled in), i'll look into adding more functions to this page and see if those incomplete classes from previous page are in the game) |
(Add CBaseAnimating, CCallChainer and CSimpleCallChainer) |
||
| (3 intermediate revisions by the same user not shown) | |||
| Line 79: | Line 79: | ||
! Signature | ! Signature | ||
! Description | ! Description | ||
|- | |||
| <code>CBaseEntity::__KeyValueFromInt</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>CBaseEntity::ConnectOutput</code> | ||
| Line 180: | Line 192: | ||
| Ensure that an entity's script scope has been created | | 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 === | === CEntities === | ||
==== Methods ==== | ==== Methods ==== | ||
| Line 236: | Line 254: | ||
|} | |} | ||
=== CNDPlayer === | === CNDPlayer === | ||
Extends <code>CBaseEntity</code>. | |||
==== Methods ==== | ==== Methods ==== | ||
{| class="standard-table" style="width: 100%;" | {| class="standard-table" style="width: 100%;" | ||
| Line 292: | Line 311: | ||
=== CNDTeam === | === CNDTeam === | ||
Extends <code>CBaseEntity</code>. | |||
==== Methods ==== | ==== Methods ==== | ||
{| class="standard-table" style="width: 100%;" | {| class="standard-table" style="width: 100%;" | ||
| Line 328: | Line 348: | ||
=== CNDSquad === | === CNDSquad === | ||
Extends <code>CBaseEntity</code>. | |||
==== Methods ==== | ==== Methods ==== | ||
{| class="standard-table" style="width: 100%;" | {| class="standard-table" style="width: 100%;" | ||
| Line 352: | Line 373: | ||
=== CNDBaseWeapon === | === CNDBaseWeapon === | ||
Extends <code>CBaseEntity</code>. | |||
==== Methods ==== | ==== Methods ==== | ||
{| class="standard-table" style="width: 100%;" | {| class="standard-table" style="width: 100%;" | ||
| Line 378: | Line 400: | ||
| 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>. | |||
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''' 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 ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Function | |||
! Signature | |||
! Description | |||
|- | |||
| <code>constructor</code> | |||
| <code>CCallChainer(string ''functionPrefix'', table ''scope'' = null)</code> | |||
| 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>chains</code> | |||
| <code>table</code> | |||
| Contains names of unprefixed functions, each with an array of functions to call. | |||
|- | |||
| <code>prefix</code> | |||
| <code>string</code> | |||
| Prefix that functions should have to be added into the chains table. Set by the constructor. | |||
|- | |||
| <code>scope</code> | |||
| <code>table</code> | |||
| 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>constructor</code> | |||
| <code>CSimpleCallChainer(string ''functionPrefix'', table ''scope'' = null, exactMatch = false)</code> | |||
| 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>CSimpleCallChainer::PostScriptExecute</code> | |||
| <code>void CSimpleCallChainer::PostScriptExecute()</code> | |||
| Begin searching for all non-native functions with matching prefixes, then push them into the chain array. | |||
|- | |||
| <code>CSimpleCallChainer::Call</code> | |||
| <code>bool CSimpleCallChainer::Call(any ...)</code> | |||
| Call all functions inside the chain array with the given arguments. | |||
|} | |||
==== Members ==== | |||
{| class="standard-table" style="width: 100%;" | |||
! Instance | |||
! Type | |||
! Description | |||
|- | |||
| <code>chain</code> | |||
| <code>array</code> | |||
| All functions to be called by the Call() method. | |||
|- | |||
| <code>exactMatch</code> | |||
| <code>bool</code> | |||
| If set, names of non-native functions and prefix must be an exact match. Set by the constructor. | |||
|- | |||
| <code>prefix</code> | |||
| <code>string</code> | |||
| Prefix that functions should have to be added into the chain array. Set by the constructor. | |||
|- | |||
| <code>scope</code> | |||
| <code>table</code> | |||
| If set, seek functions in this scope instead. Set by the constructor. | |||
|} | |||
== See also == | == See also == | ||
Latest revision as of 07:58, 19 November 2025
Automatically generated Squirrel functions list for
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. |