Script Functions

From Valve Developer Community
< Team Fortress 2‎ | Scripting
Revision as of 08:29, 24 November 2022 by Ficool2 (talk | contribs) (Add constants from latest update)
Jump to navigation Jump to search
English (en)Español (es)Русский (ru)Translate (Translate)

Stub

This article or section is a stub. You can help by expanding it.

Squirrel This list contains the engine-related Squirrel classes, functions and variables available for VScript in Template:Game name.

The official documentation can be printed in the console by setting developer to non-zero, loading a map, and executing script_help. However, this documentation is very incomplete and most methods are not listed, requiring them to be found by other means instead.

Warning.pngWarning:This page is still work-in-progress, many functions lack documentation and testing.
Note.pngNote:Most of these functions were dumped externally as they are not exposed by normal means. For these functions, the return is unknown and the arguments may not be fully correct.
[Todo] THE TRAGIC I-NEED-HELP TODO TABLE [Todo]
#1
Todo: Figure out inheritance - CBaseMultiplayerPlayer's inheritance is unclear.
#2
Todo: Constants and variables (e.g. PI)
#3
Todo: Copy over documentation from the L4D2 page, since Team Fortress 2 is derived from the VScript version as Left 4 Dead 2.
#4
Todo: Split the Globals section into various sub-sections, especially the built-in Squirrel functions.
#5
Todo: Names for function sigs's params, since params are mysterious magical properties otherwise.
#6
Todo: Format the data types's constructors more nicely
#7
Todo: Script debug functions have no info other than their names!
#8
Todo: Consolidate script function subpages from Left 4 Dead 2 together into a generic page that describes both Team Fortress 2 and Left 4 Dead 2, including any differences both branches have. E.g. TraceLine, ClientPrint...

Instances

Name Class Description
Entities CEntities Provides access to currently spawned entities.
EntityOutputs CScriptEntityOutputs Allows manipulation of entity output data
NavMesh CNavMesh Provides access to the maps NavMesh and NavAreas.
NetProps CNetPropManager Allows reading and updating the network properties of an entity.
PlayerVoiceListener PlayerVoiceListener Tracks if any player is using voice and for how long.

Variables

Name Type Value / Description
Documentation table Contains the printed strings from the script_help command.
print_indent integer 0
_PublishedHelp table NONE

Script Debug

Name Type Value
ScriptDebugDefaultWatchColor array [0, 192, 0]
ScriptDebugDrawTextEnabled bool true
ScriptDebugDrawWatchesEnabled bool true
ScriptDebugInDebugDraw bool false
ScriptDebugText array NONE
ScriptDebugTextIndent integer 0
ScriptDebugTextFilters table NONE
ScriptDebugTraces table NONE
ScriptDebugTraceAllOn bool false
ScriptDebugWatches array NONE

Constants

General

Name Type Value
_charsize_ integer 1
_floatsize_ integer 4
_intsize_ integer 4
_version_ string "Squirrel 3.0.4 stable"
_versionnumber_ integer 304
RAND_MAX integer 32767
PI float 3.14159

Buttons

Name Value
IN_ATTACK 1
IN_JUMP 2
IN_DUCK 4
IN_FORWARD 8
IN_BACK 16
IN_USE 32
IN_CANCEL 64
IN_LEFT 128
IN_RIGHT 256
IN_MOVELEFT 512
IN_MOVERIGHT 1024
IN_ATTACK2 2048
IN_RUN 4096
IN_RELOAD 8192
IN_ALT1 16384
IN_ALT2 32768
IN_SCORE 65536
IN_SPEED 131072
IN_WALK 262144
IN_ZOOM 524288
IN_WEAPON1 1048576
IN_WEAPON2 2097152
IN_BULLRUSH 4194304
IN_GRENADE1 8388608
IN_GRENADE2 16777216
IN_ATTACK3 33554432

ContentsFlags

Name Value
CONTENTS_EMPTY 0
CONTENTS_SOLID 1
CONTENTS_WINDOW 2
CONTENTS_AUX 4
CONTENTS_GRATE 8
CONTENTS_SLIME 16
CONTENTS_WATER 32
CONTENTS_BLOCKLOS 64
CONTENTS_OPAQUE 128
LAST_VISIBLE_CONTENTS 128
ALL_VISIBLE_CONTENTS 255
CONTENTS_TESTFOGVOLUME 256
CONTENTS_UNUSED 512
CONTENTS_UNUSED6 1024
CONTENTS_TEAM1 2048
CONTENTS_TEAM2 4096
CONTENTS_IGNORE_NODRAW_OPAQUE 8192
CONTENTS_MOVEABLE 16384
CONTENTS_AREAPORTAL 32768
CONTENTS_PLAYERCLIP 65536
CONTENTS_MONSTERCLIP 131072
CONTENTS_CURRENT_0 262144
CONTENTS_CURRENT_90 524288
CONTENTS_CURRENT_180 1048576
CONTENTS_CURRENT_270 2097152
CONTENTS_CURRENT_UP 4194304
CONTENTS_CURRENT_DOWN 8388608
CONTENTS_ORIGIN 16777216
CONTENTS_MONSTER 33554432
CONTENTS_DEBRIS 67108864
CONTENTS_DETAIL 134217728
CONTENTS_TRANSLUCENT 268435456
CONTENTS_LADDER 536870912
CONTENTS_HITBOX 1073741824

ECollisionGroup

Name Value
COLLISION_GROUP_NONE 0
COLLISION_GROUP_DEBRIS 1
COLLISION_GROUP_DEBRIS_TRIGGER 2
COLLISION_GROUP_INTERACTIVE_DEBRIS 3
COLLISION_GROUP_INTERACTIVE 4
COLLISION_GROUP_PLAYER 5
COLLISION_GROUP_BREAKABLE_GLASS 6
COLLISION_GROUP_VEHICLE 7
COLLISION_GROUP_PLAYER_MOVEMENT 8
COLLISION_GROUP_NPC 9
COLLISION_GROUP_IN_VEHICLE 10
COLLISION_GROUP_WEAPON 11
COLLISION_GROUP_VEHICLE_CLIP 12
COLLISION_GROUP_PROJECTILE 13
COLLISION_GROUP_DOOR_BLOCKER 14
COLLISION_GROUP_PASSABLE_DOOR 15
COLLISION_GROUP_DISSOLVING 16
COLLISION_GROUP_PUSHAWAY 17
COLLISION_GROUP_NPC_ACTOR 18
COLLISION_GROUP_NPC_SCRIPTED 19
LAST_SHARED_COLLISION_GROUP 20

EDmgType

Name Value
DMG_GENERIC 0
DMG_CRUSH 1
DMG_BULLET 2
DMG_SLASH 4
DMG_BURN 8
DMG_VEHICLE 16
DMG_FALL 32
DMG_BLAST 64
DMG_CLUB 128
DMG_SHOCK 256
DMG_SONIC 512
DMG_ENERGYBEAM 1024
DMG_PREVENT_PHYSICS_FORCE 2048
DMG_NEVERGIB 4096
DMG_ALWAYSGIB 8192
DMG_DROWN 16384
DMG_PARALYZE 32768
DMG_NERVEGAS 65536
DMG_POISON 131072
DMG_RADIATION 262144
DMG_DROWNRECOVER 524288
DMG_ACID 1048576
DMG_SLOWBURN 2097152
DMG_REMOVENORAGDOLL 4194304
DMG_PHYSGUN 8388608
DMG_PLASMA 16777216
DMG_AIRBOAT 33554432
DMG_DISSOLVE 67108864
DMG_BLAST_SURFACE 134217728
DMG_DIRECT 268435456
DMG_BUCKSHOT 536870912

EHitGroup

Name Value
HITGROUP_GENERIC 0
HITGROUP_HEAD 1
HITGROUP_CHEST 2
HITGROUP_STOMACH 3
HITGROUP_LEFTARM 4
HITGROUP_RIGHTARM 5
HITGROUP_LEFTLEG 6
HITGROUP_RIGHTLEG 7
HITGROUP_GEAR 10

EHoliday

Name Value
kHoliday_None 0
kHoliday_TFBirthday 1
kHoliday_Halloween 2
kHoliday_Christmas 3
kHoliday_CommunityUpdate 4
kHoliday_EOTL 5
kHoliday_Valentines 6
kHoliday_MeetThePyro 7
kHoliday_FullMoon 8
kHoliday_HalloweenOrFullMoon 9
kHoliday_HalloweenOrFullMoonOrValentines 10
kHoliday_AprilFools 11
kHoliday_Soldier 12
kHolidayCount 13

EHudNotify

Name Value
HUD_PRINTNOTIFY 1
HUD_PRINTCONSOLE 2
HUD_PRINTTALK 3
HUD_PRINTCENTER 4

EMoveCollide

Name Value
MOVECOLLIDE_DEFAULT 0
MOVECOLLIDE_FLY_BOUNCE 1
MOVECOLLIDE_FLY_CUSTOM 2
MOVECOLLIDE_FLY_SLIDE 3
MOVECOLLIDE_MAX_BITS 3
MOVECOLLIDE_COUNT 4

EMoveType

Name Value
MOVETYPE_NONE 0
MOVETYPE_ISOMETRIC 1
MOVETYPE_WALK 2
MOVETYPE_STEP 3
MOVETYPE_FLY 4
MOVETYPE_FLYGRAVITY 5
MOVETYPE_VPHYSICS 6
MOVETYPE_PUSH 7
MOVETYPE_NOCLIP 8
MOVETYPE_LADDER 9
MOVETYPE_OBSERVER 10
MOVETYPE_CUSTOM 11
MOVETYPE_LAST 11

EntityEffects

Name Value
EF_BONEMERGE 1
EF_BRIGHTLIGHT 2
EF_DIMLIGHT 4
EF_NOINTERP 8
EF_MAX_BITS 10
EF_NOSHADOW 16
EF_NODRAW 32
EF_NORECEIVESHADOW 64
EF_BONEMERGE_FASTCULL 128
EF_ITEM_BLINK 256
EF_PARENT_ANIMATES 512

EntityEFlags

Name Value
EFL_KILLME 1
EFL_DORMANT 2
EFL_NOCLIP_ACTIVE 4
EFL_SETTING_UP_BONES 8
EFL_HAS_PLAYER_CHILD 16
EFL_KEEP_ON_RECREATE_ENTITIES 16
EFL_DIRTY_SHADOWUPDATE 32
EFL_NOTIFY 64
EFL_FORCE_CHECK_TRANSMIT 128
EFL_BOT_FROZEN 256
EFL_SERVER_ONLY 512
EFL_NO_AUTO_EDICT_ATTACH 1024
EFL_DIRTY_ABSTRANSFORM 2048
EFL_DIRTY_ABSVELOCITY 4096
EFL_DIRTY_ABSANGVELOCITY 8192
EFL_DIRTY_SURROUNDING_COLLISION_BOUNDS 16384
EFL_DIRTY_SPATIAL_PARTITION 32768
EFL_FORCE_ALLOW_MOVEPARENT 65536
EFL_IN_SKYBOX 131072
EFL_USE_PARTITION_WHEN_NOT_SOLID 262144
EFL_TOUCHING_FLUID 524288
EFL_IS_BEING_LIFTED_BY_BARNACLE 1048576
EFL_NO_ROTORWASH_PUSH 2097152
EFL_NO_THINK_FUNCTION 4194304
EFL_NO_GAME_PHYSICS_SIMULATION 8388608
EFL_CHECK_UNTOUCH 16777216
EFL_DONTBLOCKLOS 33554432
EFL_DONTWALKON 67108864
EFL_NO_DISSOLVE 134217728
EFL_NO_MEGAPHYSCANNON_RAGDOLL 268435456
EFL_NO_WATER_VELOCITY_CHANGE 536870912
EFL_NO_PHYSCANNON_INTERACTION 1073741824
EFL_NO_DAMAGE_FORCES 2147483648

ERenderFx

Name Value
kRenderFxNone 0
kRenderFxPulseSlow 1
kRenderFxPulseFast 2
kRenderFxPulseSlowWide 3
kRenderFxPulseFastWide 4
kRenderFxFadeSlow 5
kRenderFxFadeFast 6
kRenderFxSolidSlow 7
kRenderFxSolidFast 8
kRenderFxStrobeSlow 9
kRenderFxStrobeFast 10
kRenderFxStrobeFaster 11
kRenderFxFlickerSlow 12
kRenderFxFlickerFast 13
kRenderFxNoDissipation 14
kRenderFxDistort 15
kRenderFxHologram 16
kRenderFxExplode 17
kRenderFxGlowShell 18
kRenderFxClampMinScale 19
kRenderFxEnvRain 20
kRenderFxEnvSnow 21
kRenderFxSpotlight 22
kRenderFxRagdoll 23
kRenderFxPulseFastWider 24
kRenderFxMax 25

ERenderMode

Name Value
kRenderNormal 0
kRenderTransColor 1
kRenderTransTexture 2
kRenderGlow 3
kRenderTransAlpha 4
kRenderTransAdd 5
kRenderEnvironmental 6
kRenderTransAddFrameBlend 7
kRenderTransAlphaAdd 8
kRenderWorldGlow 9
kRenderNone 10
kRenderModeCount 11

ERoundState

Name Value
GR_STATE_INIT 0
GR_STATE_PREGAME 1
GR_STATE_STARTGAME 2
GR_STATE_PREROUND 3
GR_STATE_RND_RUNNING 4
GR_STATE_TEAM_WIN 5
GR_STATE_RESTART 6
GR_STATE_STALEMATE 7
GR_STATE_GAME_OVER 8
GR_NUM_ROUND_STATES 11

ESolidType

Name Value
SOLID_NONE 0
SOLID_BSP 1
SOLID_BBOX 2
SOLID_OBB 3
SOLID_OBB_YAW 4
SOLID_CUSTOM 5
SOLID_VPHYSICS 6
SOLID_LAST 7

ESpectatorMode

Name Value
OBS_MODE_NONE 0
OBS_MODE_DEATHCAM 1
OBS_MODE_FREEZECAM 2
OBS_MODE_FIXED 3
OBS_MODE_IN_EYE 4
OBS_MODE_CHASE 5
OBS_MODE_POI 6
OBS_MODE_ROAMING 7
NUM_OBSERVER_MODES 8

EStopwatchState

Name Value
STOPWATCH_CAPTURE_TIME_NOT_SET 0
STOPWATCH_RUNNING 1
STOPWATCH_OVERTIME 2

ETFClass

Name Value
TF_CLASS_UNDEFINED 0
TF_CLASS_SCOUT 1
TF_CLASS_SNIPER 2
TF_CLASS_SOLDIER 3
TF_CLASS_DEMOMAN 4
TF_CLASS_MEDIC 5
TF_CLASS_HEAVYWEAPONS 6
TF_CLASS_PYRO 7
TF_CLASS_SPY 8
TF_CLASS_ENGINEER 9
TF_CLASS_CIVILIAN 10
TF_CLASS_COUNT_ALL 11
TF_CLASS_RANDOM 12

ETFDmgCustom

Name Value
TF_DMG_CUSTOM_NONE 0
TF_DMG_CUSTOM_HEADSHOT 1
TF_DMG_CUSTOM_BACKSTAB 2
TF_DMG_CUSTOM_BURNING 3
TF_DMG_WRENCH_FIX 4
TF_DMG_CUSTOM_MINIGUN 5
TF_DMG_CUSTOM_SUICIDE 6
TF_DMG_CUSTOM_TAUNTATK_HADOUKEN 7
TF_DMG_CUSTOM_BURNING_FLARE 8
TF_DMG_CUSTOM_TAUNTATK_HIGH_NOON 9
TF_DMG_CUSTOM_TAUNTATK_GRAND_SLAM 10
TF_DMG_CUSTOM_PENETRATE_MY_TEAM 11
TF_DMG_CUSTOM_PENETRATE_ALL_PLAYERS 12
TF_DMG_CUSTOM_TAUNTATK_FENCING 13
TF_DMG_CUSTOM_PENETRATE_NONBURNING_TEAMMATE 14
TF_DMG_CUSTOM_TAUNTATK_ARROW_STAB 15
TF_DMG_CUSTOM_TELEFRAG 16
TF_DMG_CUSTOM_BURNING_ARROW 17
TF_DMG_CUSTOM_FLYINGBURN 18
TF_DMG_CUSTOM_PUMPKIN_BOMB 19
TF_DMG_CUSTOM_DECAPITATION 20
TF_DMG_CUSTOM_TAUNTATK_GRENADE 21
TF_DMG_CUSTOM_BASEBALL 22
TF_DMG_CUSTOM_CHARGE_IMPACT 23
TF_DMG_CUSTOM_TAUNTATK_BARBARIAN_SWING 24
TF_DMG_CUSTOM_AIR_STICKY_BURST 25
TF_DMG_CUSTOM_DEFENSIVE_STICKY 26
TF_DMG_CUSTOM_PICKAXE 27
TF_DMG_CUSTOM_ROCKET_DIRECTHIT 28
TF_DMG_CUSTOM_TAUNTATK_UBERSLICE 29
TF_DMG_CUSTOM_PLAYER_SENTRY 30
TF_DMG_CUSTOM_STANDARD_STICKY 31
TF_DMG_CUSTOM_SHOTGUN_REVENGE_CRIT 32
TF_DMG_CUSTOM_TAUNTATK_ENGINEER_GUITAR_SMASH 33
TF_DMG_CUSTOM_BLEEDING 34
TF_DMG_CUSTOM_GOLD_WRENCH 35
TF_DMG_CUSTOM_CARRIED_BUILDING 36
TF_DMG_CUSTOM_COMBO_PUNCH 37
TF_DMG_CUSTOM_TAUNTATK_ENGINEER_ARM_KILL 38
TF_DMG_CUSTOM_FISH_KILL 39
TF_DMG_CUSTOM_TRIGGER_HURT 40
TF_DMG_CUSTOM_DECAPITATION_BOSS 41
TF_DMG_CUSTOM_STICKBOMB_EXPLOSION 42
TF_DMG_CUSTOM_AEGIS_ROUND 43
TF_DMG_CUSTOM_FLARE_EXPLOSION 44
TF_DMG_CUSTOM_BOOTS_STOMP 45
TF_DMG_CUSTOM_PLASMA 46
TF_DMG_CUSTOM_PLASMA_CHARGED 47
TF_DMG_CUSTOM_PLASMA_GIB 48
TF_DMG_CUSTOM_PRACTICE_STICKY 49
TF_DMG_CUSTOM_EYEBALL_ROCKET 50
TF_DMG_CUSTOM_HEADSHOT_DECAPITATION 51
TF_DMG_CUSTOM_TAUNTATK_ARMAGEDDON 52
TF_DMG_CUSTOM_FLARE_PELLET 53
TF_DMG_CUSTOM_CLEAVER 54
TF_DMG_CUSTOM_CLEAVER_CRIT 55
TF_DMG_CUSTOM_SAPPER_RECORDER_DEATH 56
TF_DMG_CUSTOM_MERASMUS_PLAYER_BOMB 57
TF_DMG_CUSTOM_MERASMUS_GRENADE 58
TF_DMG_CUSTOM_MERASMUS_ZAP 59
TF_DMG_CUSTOM_MERASMUS_DECAPITATION 60
TF_DMG_CUSTOM_CANNONBALL_PUSH 61
TF_DMG_CUSTOM_TAUNTATK_ALLCLASS_GUITAR_RIFF 62
TF_DMG_CUSTOM_THROWABLE 63
TF_DMG_CUSTOM_THROWABLE_KILL 64
TF_DMG_CUSTOM_SPELL_TELEPORT 65
TF_DMG_CUSTOM_SPELL_SKELETON 66
TF_DMG_CUSTOM_SPELL_MIRV 67
TF_DMG_CUSTOM_SPELL_METEOR 68
TF_DMG_CUSTOM_SPELL_LIGHTNING 69
TF_DMG_CUSTOM_SPELL_FIREBALL 70
TF_DMG_CUSTOM_SPELL_MONOCULUS 71
TF_DMG_CUSTOM_SPELL_BLASTJUMP 72
TF_DMG_CUSTOM_SPELL_BATS 73
TF_DMG_CUSTOM_SPELL_TINY 74
TF_DMG_CUSTOM_KART 75
TF_DMG_CUSTOM_GIANT_HAMMER 76
TF_DMG_CUSTOM_RUNE_REFLECT 77
TF_DMG_CUSTOM_DRAGONS_FURY_IGNITE 78
TF_DMG_CUSTOM_DRAGONS_FURY_BONUS_BURNING 79
TF_DMG_CUSTOM_SLAP_KILL 80
TF_DMG_CUSTOM_CROC 81
TF_DMG_CUSTOM_TAUNTATK_GASBLAST 82
TF_DMG_CUSTOM_AXTINGUISHER_BOOSTED 83
TF_DMG_CUSTOM_END 84

ETFTeam

Name Value
TEAM_UNASSIGNED 0
TEAM_SPECTATOR 1
TF_TEAM_PVE_DEFENDERS 2
TF_TEAM_RED 2
TF_TEAM_BLUE 3
TF_TEAM_PVE_INVADERS 3
TF_TEAM_COUNT 4
TF_TEAM_PVE_INVADERS_GIANTS 4
TEAM_ANY 4294967294
TEAM_INVALID 4294967295

HideHUD

Name Value
HIDEHUD_WEAPONSELECTION 1
HIDEHUD_FLASHLIGHT 2
HIDEHUD_ALL 4
HIDEHUD_HEALTH 8
HIDEHUD_BITCOUNT 12
HIDEHUD_PLAYERDEAD 16
HIDEHUD_NEEDSUIT 32
HIDEHUD_MISCSTATUS 64
HIDEHUD_CHAT 128
HIDEHUD_CROSSHAIR 256
HIDEHUD_VEHICLE_CROSSHAIR 512
HIDEHUD_INVEHICLE 1024
HIDEHUD_BONUS_PROGRESS 2048

Math

Name Value
Zero 0
Epsilon 1
GoldenRatio 1
One 1
Sqrt2 1
Sqrt3 1
E 2
Pi 3
Tau 6

PlayerFlags

Name Value
FL_ONGROUND 1
FL_DUCKING 2
FL_ANIMDUCKING 4
FL_WATERJUMP 8
PLAYER_FLAG_BITS 11
FL_ONTRAIN 16
FL_INRAIN 32
FL_FROZEN 64
FL_ATCONTROLS 128
FL_CLIENT 256
FL_FAKECLIENT 512
FL_INWATER 1024
FL_FLY 2048
FL_SWIM 4096
FL_CONVEYOR 8192
FL_NPC 16384
FL_GODMODE 32768
FL_NOTARGET 65536
FL_AIMTARGET 131072
FL_PARTIALGROUND 262144
FL_STATICPROP 524288
FL_GRAPHED 1048576
FL_GRENADE 2097152
FL_STEPMOVEMENT 4194304
FL_DONTTOUCH 8388608
FL_BASEVELOCITY 16777216
FL_WORLDBRUSH 33554432
FL_OBJECT 67108864
FL_KILLME 134217728
FL_ONFIRE 268435456
FL_DISSOLVING 536870912
FL_TRANSRAGDOLL 1073741824
FL_UNBLOCKABLE_BY_PLAYER 2147483648

Server

Name Value
MAX_PLAYERS 33
MAX_EDICTS 2048

SolidFlags

Name Value
FSOLID_CUSTOMRAYTEST 1
FSOLID_CUSTOMBOXTEST 2
FSOLID_NOT_SOLID 4
FSOLID_TRIGGER 8
FSOLID_MAX_BITS 10
FSOLID_NOT_STANDABLE 16
FSOLID_VOLUME_CONTENTS 32
FSOLID_FORCE_WORLD_ALIGNED 64
FSOLID_USE_TRIGGER_BOUNDS 128
FSOLID_ROOT_PARENT_ALIGNED 256
FSOLID_TRIGGER_TOUCH_DEBRIS 512

SurfFlags

Name Value
SURF_LIGHT 1
SURF_SKY2D 2
SURF_SKY 4
SURF_WARP 8
SURF_TRANS 16
SURF_NOPORTAL 32
SURF_TRIGGER 64
SURF_NODRAW 128
SURF_HINT 256
SURF_SKIP 512
SURF_NOLIGHT 1024
SURF_BUMPLIGHT 2048
SURF_NOSHADOWS 4096
SURF_NODECALS 8192
SURF_NOCHOP 16384
SURF_HITBOX 32768

TFNavAttributeType

Name Value
TF_NAV_INVALID 0
TF_NAV_BLOCKED 1
TF_NAV_SPAWN_ROOM_RED 2
TF_NAV_SPAWN_ROOM_BLUE 4
TF_NAV_SPAWN_ROOM_EXIT 8
TF_NAV_HAS_AMMO 16
TF_NAV_HAS_HEALTH 32
TF_NAV_CONTROL_POINT 64
TF_NAV_BLUE_SENTRY_DANGER 128
TF_NAV_RED_SENTRY_DANGER 256
TF_NAV_BLUE_SETUP_GATE 2048
TF_NAV_RED_SETUP_GATE 4096
TF_NAV_BLOCKED_AFTER_POINT_CAPTURE 8192
TF_NAV_BLOCKED_UNTIL_POINT_CAPTURE 16384
TF_NAV_BLUE_ONE_WAY_DOOR 32768
TF_NAV_RED_ONE_WAY_DOOR 65536
TF_NAV_WITH_SECOND_POINT 131072
TF_NAV_WITH_THIRD_POINT 262144
TF_NAV_WITH_FOURTH_POINT 524288
TF_NAV_WITH_FIFTH_POINT 1048576
TF_NAV_SNIPER_SPOT 2097152
TF_NAV_SENTRY_SPOT 4194304
TF_NAV_ESCAPE_ROUTE 8388608
TF_NAV_ESCAPE_ROUTE_VISIBLE 16777216
TF_NAV_NO_SPAWNING 33554432
TF_NAV_RESCUE_CLOSET 67108864
TF_NAV_BOMB_CAN_DROP_HERE 134217728
TF_NAV_DOOR_NEVER_BLOCKS 268435456
TF_NAV_DOOR_ALWAYS_BLOCKS 536870912
TF_NAV_UNBLOCKABLE 1073741824
TF_NAV_PERSISTENT_ATTRIBUTES 1988098048






Classes

CBaseEntity

This is a script handle class for entities. All entities have a script handle using this class, sometimes as one of its subclasses.

An entity's own handle are accessed with:

Methods

Function Signature Description
__KeyValueFromFloat __KeyValueFromFloat(string, float)
__KeyValueFromInt __KeyValueFromInt(string, int)
__KeyValueFromString __KeyValueFromString(string, string)
__KeyValueFromVector __KeyValueFromVector(string, Vector)
ApplyAbsVelocityImpulse void ApplyAbsVelocityImpulse(Vector) Apply a Velocity Impulse
ApplyLocalAngularVelocityImpulse void ApplyLocalAngularVelocityImpulse(Vector) Apply an Ang Velocity Impulse
ConnectOutput void ConnectOutput(string, string) Adds an I/O connection that will call the named function when the specified output fires
Destroy void Destroy()
DisableDraw void DisableDraw() Enable drawing (removes EF_NODRAW)
DisconnectOutput void DisconnectOutput(string, string) Removes a connected script function from an I/O event.
DispatchSpawn void DispatchSpawn() Alternative dispatch spawn, same as the one in CEntities, for convenience.
EmitSound void EmitSound(string) Plays a sound from this entity.
EnableDraw void EnableDraw() Disable drawing (sets EF_NODRAW)
entindex int entindex()
EyeAngles QAngle EyeAngles() Returns the entity's eye angles
EyePosition Vector EyePosition() Get vector to eye position - absolute coords
FirstMoveChild handle FirstMoveChild()
GetAbsAngles QAngle GetAbsAngles() Get entity pitch, yaw, roll as QAngles
GetAbsVelocity Vector GetAbsVelocity() Returns the current absolute velocity of the entity
Obsolete GetAngles (→ GetAbsAngles) Vector GetAngles() Get entity pitch, yaw, roll as a vector
GetAngularVelocity Vector GetAngularVelocity() Get the local angular velocity - returns a vector of pitch,yaw,roll
GetBaseVelocity Vector GetBaseVelocity() Returns any constant velocity currently being imparted onto the entity. This includes being pushed by effects like trigger_push and players standing on moving geometry like elevators. Should always returns a zero vector if the entity is not affected by any movement effects.
GetBoundingMaxs Vector GetBoundingMaxs() Get a vector containing max bounds, centered on object
GetBoundingMaxsOriented Vector GetBoundingMaxsOriented() Get a vector containing max bounds, centered on object, taking the object's orientation into account
GetBoundingMins Vector GetBoundingMins() Get a vector containing min bounds, centered on object
GetBoundingMinsOriented Vector GetBoundingMinsOriented() Get a vector containing min bounds, centered on object, taking the object's orientation into account
GetCenter Vector GetCenter() Get vector to center of object - absolute coords
GetClassname string GetClassname()
GetEntityHandle <unknown> GetEntityHandle() Get the entity as an EHANDLE
GetEntityIndex int GetEntityIndex()
GetForwardVector Vector GetForwardVector() Get the forward vector of the entity
GetFriction float GetFriction() Get PLAYER friction, ignored for objects
GetHealth int GetHealth()
Obsolete GetLeftVector (→ GetRightVector) Vector GetLeftVector() Get the right vector of the entity. This is purely for compatibility.
GetLocalAngles QAngle GetLocalAngles()
GetLocalOrigin Vector GetLocalOrigin()
GetLocalVelocity Vector GetLocalVelocity() Get Entity relative velocity
GetMaxHealth int GetMaxHealth()
GetModelKeyValues handle GetModelKeyValues() Get a KeyValue class instance on this entity's model
GetModelName string GetModelName() Returns the name of the model
GetMoveParent handle GetMoveParent() If in hierarchy, retrieves the entity's parent
GetMoveType int GetMoveType()
GetName string GetName()
GetOrigin Vector GetOrigin() This is GetAbsOrigin with a funny script name for some reason. Not changing it for legacy compat though.
GetOwner handle GetOwner() Gets this entity's owner
GetPhysAngularVelocity Vector GetPhysAngularVelocity()
GetPhysVelocity Vector GetPhysVelocity()
GetPreTemplateName string GetPreTemplateName() Get the entity name stripped of template unique decoration
GetRightVector Vector GetRightVector() Get the right vector of the entity
GetRootMoveParent handle GetRootMoveParent() If in hierarchy, walks up the hierarchy to find the root parent
GetScriptId string GetScriptId() Retrieve the unique identifier used to refer to the entity within the scripting system.
GetScriptScope handle GetScriptScope() Retrieve the script-side data associated with an entity
GetScriptThinkFunc string GetScriptThinkFunc() Retrieve the name of the current script think func
GetSoundDuration float GetSoundDuration(string, string) Returns float duration of the sound. Takes soundname and optional actormodelname.
GetTeam int GetTeam()
GetUpVector Vector GetUpVector() Get the up vector of the entity
Obsolete GetVelocity (→ GetAbsVelocity) Vector GetVelocity()
IsPlayer bool IsPlayer()
IsValid bool IsValid()
KeyValueFromFloat bool KeyValueFromFloat(string, float) Executes KeyValue with a float
KeyValueFromInt bool KeyValueFromInt(string, int) Executes KeyValue with an int
KeyValueFromString bool KeyValueFromString(string, string) Executes KeyValue with a string
KeyValueFromVector bool KeyValueFromVector(string, Vector) Executes KeyValue with a vector
Kill void Kill()
LocalEyeAngles handle LocalEyeAngles() Returns the entity's local eye angles
NextMovePeer handle NextMovePeer()
PrecacheModel void PrecacheModel(string)
PrecacheScriptSound void PrecacheScriptSound(string)
PrecacheSoundScript void PrecacheSoundScript(string) Precache a sound for later playing.
SetAbsAngles void SetAbsAngles(QAngle) Set entity pitch, yaw, roll as QAngles
SetAbsVelocity void SetAbsVelocity(Vector) Sets the current absolute velocity of the entity
SetAbsOrigin void SetAbsOrigin(Vector) SetAbsOrigin
Obsolete SetAngles (→ SetAbsAngles) void SetAngles(float, float, float) Set entity pitch, yaw, roll.
SetAngularVelocity void SetAngularVelocity(float, float, float) Set the local angular velocity - takes float pitch,yaw,roll velocities
SetDrawEnabled void SetDrawEnabled(bool) Enables drawing if you pass true, disables drawing if you pass false.
SetForwardVector void SetForwardVector(Vector) Set the orientation of the entity to have this forward vector
SetFriction void SetFriction(float) Set PLAYER friction, ignored for objects
SetGravity void SetGravity(float) Set PLAYER gravity, ignored for objects
SetHealth void SetHealth(int)
SetLocalAngles void SetLocalAngles(QAngle)
SetLocalOrigin void SetLocalOrigin(Vector)
SetMaxHealth void SetMaxHealth(int)
SetModel void SetModel(string) Set a model for this entity
SetModelSimple void SetModelSimple(string) Set a model for this entity. Matches easier behaviour of the SetModel input, automatically precaches, maintains sequence/cycle if possible.
Obsolete SetOrigin (→ SetAbsOrigin) void SetOrigin(Vector)
SetOwner void SetOwner(handle) Sets this entity's owner
SetPhysAngularVelocity void SetPhysAngularVelocity(Vector)
SetPhysVelocity void SetPhysVelocity(Vector)
SetSize void SetSize(Vector, Vector)
SetTeam void SetTeam(int)
SetVelocity void SetVelocity(Vector)
StopSound void StopSound(string) Stops a sound on this entity.
TakeDamage void TakeDamage(float flDamage, int nDamageType, handle hAttacker)
Teleport void Teleport(bool, Vector, bool, QAngle, bool, Vector) Teleports this entity
TakeDamageEx void TakeDamageEx(handle hInflictor, handle hAttacker, handle hWeapon, Vector vecDamageForce, Vector vecDamagePosition, float flDamage, int nDamageType)
ValidateScriptScope bool ValidateScriptScope() Ensure that an entity's script scope has been created

CBaseAnimating

Extends CBaseEntity

Script handle class for animatable entities, such as props.

Methods

Function Signature Description
FindBodygroupByName int FindBodygroupByName(string) Find a bodygroup id by name
GetAttachmentAngles QAngle GetAttachmentAngles(int) Get the attachement id's angles as a p,y,r vector
GetAttachmentBone int GetAttachmentBone(int) Get the named attachement's parent bone index
GetAttachmentOrigin Vector GetAttachmentOrigin(int) Get the attachement id's origin vector
GetBodygroup int GetBodygroup(int) Get a bodygroup by id
GetBodygroupName string GetBodygroupName(int) Get the bodygroup id's name
GetBodygroupPartName string GetBodygroupPartName(int, int) Get name by group and part
GetBoneAngles QAngle GetBoneAngles(int) Get the bone id's angles as a p,y,r vector
GetBoneOrigin Vector GetBoneOrigin(int) Get the bone id's origin vector
GetModelScale float GetModelScale()
GetSequence int GetSequence() Get the current sequence id
GetSequenceActivityName string GetSequenceActivityName(int) Get the activity name for a sequence by id
GetSequenceDuration float GetSequenceDuration(int) Get a sequence duration by id
GetSequenceName string GetSequenceName(int) Get a sequence name by id
GetSkin int GetSkin() Gets the current skin index.
IsSequenceFinished bool IsSequenceFinished() Ask whether the main sequence is done playing
LookupActivity int LookupActivity(string) Get the named activity index
LookupAttachment int LookupAttachment(string) Get the named attachement id
LookupBone int LookupBone(string) Get the named bone index
LookupSequence int LookupSequence(string) Looks up a sequence by sequence name or activity name
ResetSequence void ResetSequence(int) Reset a sequence by id. If the id is different than the current sequence, switch to the new sequence
SetBodygroup void SetBodygroup(int, int) Sets a bodygroup
SetModelScale void SetModelScale(float, float) (scale, change_duration) Changes a model's scale over time
SetPoseParameter float SetPoseParameter(int, float) (id, value) Sets a pose parameter value
SetSequence void SetSequence(int) Set a sequence by id
SetSkin void SetSkin(int) Sets the skin.


CBasePlayer

Extends CBaseAnimating

Script handle class for player entities.

Methods

Function Signature Description
GetForceLocalDraw bool GetForceLocalDraw() Gets the state of whether the player is being forced by SetForceLocalDraw to be drawn
GetPlayerMaxs Vector GetPlayerMaxs()
GetPlayerMins Vector GetPlayerMins()
GetScriptOverlayMaterial string GetScriptOverlayMaterial() Gets the current view overlay material
IsNoclipping bool IsNoclipping() Returns true if the player is in noclip mode.
SetForceLocalDraw void SetForceLocalDraw(bool) Forces the player to be drawn as if they are third person
SetScriptOverlayMaterial void SetScriptOverlayMaterial(string) Sets a view overlay material
SnapEyeAngles void SnapEyeAngles(QAngle) Snap the player's eye angles to this.
ViewPunch void ViewPunch(QAngle) Ow! Punches the player's view
ViewPunchReset void ViewPunchReset(float) Reset's the player's view punch

CBaseMultiplayerPlayer

Extends CBasePlayer

Script handle sub-class for player entities in multiplayer games. No additional methods.


CEconEntity

Extends CBaseAnimating

Script handle class for economic leisure exquisite items, meaning hats and weapons.

Methods

Function Signature Description
AddAttribute void AddAttribute(string, float, float) Add an attribute to the entity
RemoveAttribute void RemoveAttribute(string) Remove an attribute to the entity

CTFPlayer

Extends CBaseMultiplayerPlayer

Script handle class for player entities of Team Fortress 2.

Methods

Function Signature Description
AddCond void AddCond(string)
AddCondEx void AddCondEx(string, float, handle)
AddCustomAttribute void AddCustomAttribute(string, float, float) Add a custom attribute to the player
ApplyPunchImpulseX bool ApplyPunchImpulseX(float)
BleedPlayer void BleedPlayer(float)
BleedPlayerEx void BleedPlayerEx(float, int, bool, int)
CanAirDash bool CanAirDash()
CanBeDebuffed bool CanBeDebuffed()
CanBreatheUnderwater bool CanBreatheUnderwater()
CanDuck bool CanDuck() Can the player duck?
CanGetWet bool CanGetWet()
CanJump bool CanJump() Can the player jump?
ClearCustomModelRotation void ClearCustomModelRotation()
ClearSpells void ClearSpells()
CanPlayerMove bool CanPlayerMove() Can the player move?
DropFlag void DropFlag(bool) Force player to drop the flag.
DropRune void DropRune(bool, int) Force player to drop the rune.
ExtinguishPlayerBurning void ExtinguishPlayerBurning()
FiringTalk void FiringTalk() Makes eg. a heavy go AAAAAAAAAAaAaa like they are firing their minigun.
FirstMoveChild FirstMoveChild()
ForceChangeTeam void ForceChangeTeam(int, bool) Force player to change their team.
ForceRegenerateAndRespawn void ForceRegenerateAndRespawn(int, bool) Force regenerates and respawns the player
ForceRespawn void ForceRespawn(int) Force respawns the player
GetActiveWeapon handle GetActiveWeapon() Get the player's current weapon
GetBackstabs int GetBackstabs()
GetBonusPoints int GetBonusPoints()
GetBuildingsDestroyed int GetBuildingsDestroyed()
GetCaptures int GetCaptures()
GetClassEyeHeight Vector GetClassEyeHeight() Gets the eye height of the player
GetCondDuration float GetCondDuration(string)
GetCurrency int GetCurrency() Get player's cash for game modes with upgrades, ie. MvM
GetCurrentTauntMoveSpeed float GetCurrentTauntMoveSpeed()
GetDefenses int GetDefenses()
GetDisguiseAmmoCount int GetDisguiseAmmoCount()
GetDisguiseTarget handle GetDisguiseTarget()
GetDisguiseTeam int GetDisguiseTeam()
GetDominations int GetDominations()
GetGrapplingHookTarget handle GetGrapplingHookTarget() What entity is the player grappling?
GetHeadshots int GetHeadshots()
GetHealPoints int GetHealPoints()
GetHealTarget handle GetHealTarget() Who is the medic healing?
GetInvulns int GetInvulns()
GetKillAssists int GetKillAssists()
GetNextChangeClassTime float GetNextChangeClassTime() Get next change class time.
GetNextChangeTeamTime float GetNextChangeTeamTime() Get next change team time.
GetNextRegenTime float GetNextRegenTime() Get next health regen time.
GetPlayerClass int GetPlayerClass()
GetRageMeter float GetRageMeter()
GetResupplyPoints int GetResupplyPoints()
GetRevenge int GetRevenge()
GetScoutHypeMeter float GetScoutHypeMeter()
GetSpyCloakMeter float GetSpyCloakMeter()
GetTeleports int GetTeleports()
GetTimeSinceCalledForMedic float GetTimeSinceCalledForMedic() When did the player last call medic
HasItem bool HasItem() Currently holding an item? Eg. capture flag
IgnitePlayer void IgnitePlayer()
InAirDueToExplosion bool InAirDueToExplosion()
InAirDueToKnockback bool InAirDueToKnockback()
InCond bool InCond(string)
IsAirDashing bool IsAirDashing()
IsAllowedToTaunt bool IsAllowedToTaunt()
IsCallingForMedic bool IsCallingForMedic() Is this player calling for medic?
IsCarryingRune bool IsCarryingRune()
IsControlStunned bool IsControlStunned()
IsCritBoosted bool IsCritBoosted()
IsFireproof bool IsFireproof()
IsFullyInvisible bool IsFullyInvisible()
IsHypeBuffed bool IsHypeBuffed()
IsImmuneToPushback bool IsImmuneToPushback()
IsInspecting bool IsInspecting()
IsInvulnerable bool IsInvulnerable()
IsJumping bool IsJumping()
IsMiniBoss bool IsMiniBoss() Is this player an MvM mini-boss?
IsParachuteEquipped bool IsParachuteEquipped()
IsPlacingSapper bool IsPlacingSapper() Returns true if we placed a sapper in the last few moments
IsPlayer IsPlayer()
IsRageDraining bool IsRageDraining()
IsRegenerating bool IsRegenerating()
IsSapping bool IsSapping() Returns true if we are currently sapping
IsSnared bool IsSnared()
IsStealthed bool IsStealthed()
IsUsingActionSlot bool IsUsingActionSlot()
IsViewingCYOAPDA bool IsViewingCYOAPDA()
IsViewingCYOAPDA bool IsViewingCYOAPDA()
Regenerate void Regenerate(bool) Resupplies a player. If regen health/ammo is set, clears negative conds, gives back player health/ammo
RemoveAllItems void RemoveAllItems(bool)
RemoveAllObjects void RemoveAllObjects(bool) Remove all player objects. Eg. dispensers/sentries.
RemoveCond void RemoveCond(string)
RemoveCondEx void RemoveCondEx(string, bool)
RemoveCurrency void RemoveCurrency(int) Take away money from a player for reasons such as ie. spending.
RemoveCustomAttribute void RemoveCustomAttribute(string) Remove a custom attribute to the player
RemoveDisguise void RemoveDisguise() Undisguise a spy.
RemoveInvisibility void RemoveInvisibility() Un-invisible a spy.
RemoveTeleportEffect void RemoveTeleportEffect()
ResetScores void ResetScores()
RollRareSpell void RollRareSpell()
SetCondDuration void SetCondDuration(string, float)
SetCurrency void SetCurrency(int) Set player's cash for game modes with upgrades, ie. MvM
SetCurrentTauntMoveSpeed void SetCurrentTauntMoveSpeed(float)
SetCustomModel void SetCustomModel(string)
SetCustomModelOffset void SetCustomModelOffset(Vector)
SetCustomModelRotates void SetCustomModelRotates(bool)
SetCustomModelRotation void SetCustomModelRotation(QAngle)
SetCustomModelVisibleToSelf void SetCustomModelVisibleToSelf(bool)
SetCustomModelWithClassAnimations void SetCustomModelWithClassAnimations(string)
SetDisguiseAmmoCount void SetDisguiseAmmoCount(int)
SetForcedTauntCam void SetForcedTauntCam(int)
SetGrapplingHookTarget void SetGrapplingHookTarget(handle, bool) Set the player's target grapple entity
SetIsMiniBoss void SetIsMiniBoss(bool) Make this player an MvM mini-boss.
SetNextChangeClassTime void SetNextChangeClassTime(float) Set next change class time.
SetNextChangeTeamTime void SetNextChangeTeamTime(float) Set next change team time.
SetNextRegenTime void SetNextRegenTime(float) Set next health regen time.
SetPlayerClass void SetPlayerClass(int)
SetRageMeter void SetRageMeter(float)
SetScoutHypeMeter void SetScoutHypeMeter(float)
SetSpyCloakMeter void SetSpyCloakMeter(float)
SetUseBossHealthBar void SetUseBossHealthBar(bool)
TryToPickupBuilding bool TryToPickupBuilding() Make the player attempt to pick up a building in front of them
WasInCond bool WasInCond(string)


Convars

Game Instance: Convars

Provides an interface for getting and setting convars on the server.

Note.pngNote:Protected convars (e.g. rcon_password) cannot be accessed.

Methods

Function Signature Description
GetBool bool GetClientConvarValue(string name) Returns the convar as a bool. May return null if no such convar.
GetClientConvarValue string GetClientConvarValue(string name, int entindex) Returns the convar value for the entindex as a string. Only works on client convars with the FCVAR_USERINFO flag.
GetInt int GetInt(string name) Returns the convar as an int. May return null if no such convar.
GetStr string GetStr(string name) Returns the convar as a string. May return null if no such convar.
GetFloat float GetFloat(string name) Returns the convar as a float. May return null if no such convar.
IsConVarOnAllowList bool IsConVarOnAllowList(string name) Checks if the convar is allowed to be used and is in cfg/vscript_convar_allowlist.txt. Please be nice with this and use it for *compatibility* if you need check support and NOT to force server owners to allow hostname to be set... or else this will simply lie and return true in future. ;-) You have been warned!
SetValue void SetValue(string name, value) Sets the value of the convar. The convar must be in cfg/vscript_convar_allowlist.txt to be set. Supported types are bool, int, float, string.

CEntities

Game Instance: Entities

An interface to find and iterate over the script handles for the entities in play. To iterate over a set of entities, pass null to the previous parameter in the appropriate method to start an iteration. A reference to a previously-found entity can be used instead to continue a search.

The following are two equivalent examples and iterate over all weapons on the map:

local ent = null;
while ( ent = Entities.FindByClassname(ent, "tf_weapon_*") )
{
  // ...
}
for (local ent; ent = Entities.FindByName(ent, "tf_weapon_*"); )
{
  // ...
}
Note.pngNote:
  • The variable name ent is arbitrary.
  • Indeed, we mean "=" and not "==" in the loop conditions! The loops end if ent becomes null, which happens when no matching entities have an entity index higher to the one in previous parameter.
  • Semicolons are optional, except in the header of the for statement.
  • The string parameters of the FindBy... functions support the wildcard star *. In the above example, FindByClassname only returns either a handle of an entity whose classname begins with "tf_weapon_" or it returns null.

Methods

Function Signature Description
CreateByClassname handle CreateByClassname(string classname) Creates an entity by classname
DispatchSpawn void DispatchSpawn(handle entity) Dispatches spawn of an entity!
FindByClassname handle FindByClassname(handle previous, string classname) Find entities by the value of their classname keyvalue. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
Note.pngNote:The classname keyvalue of an entity can be manipulated and does not necessarily reflect its code class. There might be entities that have a different classname than the one they are created with.
FindByClassnameNearest handle FindByClassnameNearest(string classname, Vector center, float radius) Find entities by classname nearest to a point.
FindByClassnameWithin handle FindByClassnameWithin(handle previous, string classname, Vector center, float radius) Find entities by classname within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByModel handle FindByModel(handle previous, string modelname) Find entities by the value of their model keyvalue. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByName handle FindByName(handle previous, string targetname) Find entities by the value of their targetname keyvalue. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByNameNearest handle FindByNameNearest(string targetname, Vector center, float radius) Find entities by targetname nearest to a point.
FindByNameWithin handle FindByNameWithin(handle previous, string targetname, Vector center, float radius) Find entities by targetname within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindByTarget handle FindByTarget(handle previous, string target) Find entities by the value of their target keyvalue.[confirm] Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
FindInSphere handle FindInSphere(handle previous, Vector center, float radius) Find entities within a radius. Pass 'null' to start an iteration, or reference to a previously found entity to continue a search
First handle First() Begin an iteration over the list of entities
Next handle Next(handle previous) At the given reference of a previously-found entity, returns the next one after it in the list.

CTFNavArea

Methods

Function Signature Description
AddIncomingConnection void AddIncomingConnection(handle area, int dir) Add areas that connect TO this area by a ONE-WAY link
ClearAttributeTF void ClearAttributeTF(int) Clear TF-specific area attribute bits
ComputeDirection int ComputeDirection(Vector point) Return direction from this area to the given point
ConnectTo void ConnectTo(handle area, int dir) Connect this area to given area in given direction
Contains bool Contains(handle area) Return true if other area is on or above this area, but no others
ContainsOrigin bool ContainsOrigin(Vector point) Return true if given point is on or above this area, but no others
DebugDrawFilled void DebugDrawFilled(int, int, int, int, float, bool, float) Draw area as a filled rect of the given color
Disconnect void Disconnect(handle area) Disconnect this area from given area
FindRandomSpot Vector FindRandomSpot() Get random origin within extent of area
GetAdjacentArea handle GetAdjacentArea(int dir, int n) Return the n'th adjacent area in the given direction
GetAdjacentAreas void GetAdjacentAreas(int dir, handle table) Fills a passed in table with all adjacent areas in the given direction
GetAdjacentCount int GetAdjacentCount(int dir) Get the number of adjacent areas in the given direction
GetAttributes int GetAttributes() Get area attribute bits
GetAvoidanceObstacleHeight float GetAvoidanceObstacleHeight() Returns the maximum height of the obstruction above the ground
GetCenter Vector GetCenter() Get center origin of area
GetCorner <unknown> GetCorner(int dir) Get corner origin of area
GetDistanceSquaredToPoint float GetDistanceSquaredToPoint(Vector pos) Return shortest distance between point and this area
GetDoor handle GetDoor() Returns the door entity above the area
GetElevator handle GetElevator() Returns the elevator if in an elevator's path
GetElevatorAreas void GetElevatorAreas(handle table) Fills table with a collection of areas reachable via elevator from this area
GetID int GetID() Get area ID.
GetIncomingConnections void GetIncomingConnections(int dir, handle table) Fills a passed in table with areas connected TO this area by a ONE-WAY link (ie: we have no connection back to them)
GetParent handle GetParent() Returns the area just prior to this one in the search path
GetParentHow int GetParentHow() Returns how we get from parent to us
GetPlaceName string GetPlaceName() Get place name
GetPlayerCount int GetPlayerCount(int team) Return number of players of given team currently within this area (team of zero means any/all)
GetRandomAdjacentArea handle GetRandomAdjacentArea(int dir) Return a random adjacent area in the given direction
GetSizeX float GetSizeX() Return the area size along the X axis
GetSizeY float GetSizeY() Return the area size along the Y axis
GetTravelDistanceToBombTarget float GetTravelDistanceToBombTarget() Gets the travel distance to the MvM bomb target
GetZ float GetZ(Vector pos) Return Z of area at (x,y) of 'pos'
HasAttributeTF bool HasAttributeTF(int) Has TF-specific area attribute bits
HasAttributes bool HasAttributes(int) Has area attribute bits
HasAvoidanceObstacle bool HasAvoidanceObstacle(float maxheight) Returns true if there's a large, immobile object obstructing this area
IsBlocked bool IsBlocked(int team, bool) Return true if team is blocked in this area
IsBottleneck bool IsBottleneck() Returns true if area is a bottleneck
IsCompletelyVisibleToTeam bool IsCompletelyVisibleToTeam(int team) Return true if given area is completely visible from somewhere in this area by someone on the team
IsConnected bool IsConnected(handle area, int dir) Return true if given area is connected in given direction
IsCoplanar bool IsCoplanar(handle area) Return true if this area and given area are approximately co-planar
IsDamaging bool IsDamaging() Return true if continuous damage (ie: fire) is in this area
IsDegenerate bool IsDegenerate() Return true if this area is badly formed
IsEdge bool IsEdge(int dir) Return true if there are no bi-directional links on the given side
IsFlat bool IsFlat() Return true if this area is approximately flat
IsOverlapping bool IsOverlapping(handle area) Return true if 'area' overlaps our 2D extents
IsOverlappingOrigin bool IsOverlappingOrigin(Vector pos, float tolerance) Return true if 'pos' is within 2D extents of area
IsPotentiallyVisibleToTeam bool IsPotentiallyVisibleToTeam(int team) Return true if any portion of this area is visible to anyone on the given team
IsReachableByTeam bool IsReachableByTeam(int) Is this area reachable by the given team?
IsRoughlySquare bool IsRoughlySquare() Return true if this area is approximately square
IsTFMarked bool IsTFMarked() Is this nav area marked with the current marking scope?
IsUnderwater bool IsUnderwater() Return true if area is underwater
IsValidForWanderingPopulation bool IsValidForWanderingPopulation() Returns true if area is valid for wandering population
IsVisible bool IsVisible(Vector point) Return true if area is visible from the given eyepoint
MarkAsBlocked void MarkAsBlocked(int team) Mark this area as blocked for team
MarkAsDamaging void MarkAsDamaging(float duration) Mark this area is damaging for the next 'duration' seconds
MarkObstacleToAvoid void MarkObstacleToAvoid(float height) Marks the obstructed status of the nav area
RemoveAttributes void RemoveAttributes(int) Removes area attribute bits
RemoveOrthogonalConnections void RemoveOrthogonalConnections(int dir) Removes all connections in directions to left and right of specified direction
SetAttributeTF void SetAttributeTF(int) Set TF-specific area attributes
SetAttributes void SetAttributes(int) Set area attribute bits
SetPlaceName void SetPlaceName(string name) Set place name
TFMark void TFMark() Mark this nav area with the current marking scope.
UnblockArea void UnblockArea() Unblocks this area

CNavMesh

Game Instance: NavMesh

Methods

Function Signature Description
FindNavAreaAlongRay handle FindNavAreaAlongRay(Vector startpos, Vector endpos, handle ignoreAreaID) get nav area from ray
GetAllAreas void GetAllAreas(handle table) fills a passed in table of all nav areas
GetAreasWithAttributes void GetAreasWithAttributes(int bits, handle table) fills a passed in table of all nav areas that have the specified attributes
GetNavArea handle GetNavArea(Vector origin, float flBeneath) given a position in the world, return the nav area that is closest to or below that height.
GetNavAreaByID handle GetNavAreaByID(int areaID) get nav area by ID
GetNavAreaCount int GetNavAreaCount() return total number of nav areas
GetNavAreasFromBuildPath bool GetNavAreasFromBuildPath(handle table, handle, Vector, float, int, bool, handle) Fills the table with areas from a path. Returns whether a path was found
GetNavAreasInRadius void GetNavAreasInRadius(Vector origin, float radius, handle table) fills a passed in table of nav areas within radius
GetNavAreasOverlappingEntityExtent void GetNavAreasOverlappingEntityExtent(handle entity, handle table) fills passed in table with areas overlapping entity's extent
GetNearestNavArea handle GetNearestNavArea(Vector origin, float maxDist, bool checkLOS, bool checkGround) given a position in the world, return the nav area that is closest to or below that height.
GetObstructingEntities void GetObstructingEntities(handle table) fills a passed in table of all obstructing entities
NavAreaBuildPath bool NavAreaBuildPath(handle area, handle area, Vector goalPos, float flMaxPathLength, int teamID, bool ignoreNavBlockers) returns true if a path exists
NavAreaTravelDistance float NavAreaTravelDistance(handle area, handle area, float flMaxPathLength) compute distance between two areas. Return -1 if can't reach 'endArea' from 'startArea'
RegisterAvoidanceObstacle void RegisterAvoidanceObstacle(handle entity) registers avoidance obstacle
UnregisterAvoidanceObstacle void UnregisterAvoidanceObstacle(handle entity) unregisters avoidance obstacle

CNetPropManager

Game Instance: NetProps

Allows reading and updating the network properties and datamaps of an entity.

If the entity has multiple netprops with the same name, the data table name can be prepended with a dot to specify which one to use (e.g. "m_itTimer.m_timestamp").

Warning.pngWarning:Each netprop has a set size in bits, exceeding the size may desync the clients from the server causing unpredictable behavior.

Methods

Function Signature Description
GetPropArraySize int GetPropArraySize(handle entity, string propertyName) Returns the size of an netprop array, or -1.
GetPropEntity handle GetPropEntity(handle entity, string propertyName) Reads an EHANDLE-valued netprop (21 bit integer). Returns the script handle of the entity.
GetPropEntityArray handle GetPropEntityArray(handle entity, string propertyName, int arrayElement) Reads an EHANDLE-valued netprop (21 bit integer) from an array. Returns the script handle of the entity.
GetPropFloat float GetPropFloat(handle entity, string propertyName) Reads a float-valued netprop.
GetPropFloatArray float GetPropFloatArray(handle entity, string propertyName, int arrayElement) Reads a float-valued netprop from an array.
GetPropInt int GetPropInt(handle entity, string propertyName) Reads an integer-valued netprop.
GetPropIntArray int GetPropIntArray(handle entity, string propertyName, int arrayElement) Reads an integer-valued netprop from an array.
GetPropString string GetPropString(handle entity, string propertyName) Reads an string-valued netprop.
GetPropStringArray string GetPropStringArray(handle entity, string propertyName, int arrayElement) Reads an string-valued netprop from an array.
GetPropType string GetPropType(handle entity, string propertyName) Returns the name of the netprop type as a string.
GetPropVector Vector GetPropVector(handle entity, string propertyName) Reads a 3D vector-valued netprop.
Todo:  Does it work for other dimensions too?
GetPropVectorArray Vector GetPropVectorArray(handle entity, string propertyName, int arrayElement) Reads a 3D vector-valued netprop from an array.
HasProp bool HasProp(handle entity, string propertyName) Checks if a netprop exists.
SetPropEntity void SetPropEntity(handle entity, string propertyName, handle value) Sets an EHANDLE-valued netprop (21 bit integer) to reference the specified entity.
SetPropEntityArray void SetPropEntityArray(handle entity, string propertyName, handle value, int arrayElement) Sets an EHANDLE-valued netprop (21 bit integer) from an array to reference the specified entity.
SetPropFloat void SetPropFloat(handle entity, string propertyName, float value) Sets a netprop to the specified float.
SetPropFloatArray void SetPropFloatArray(handle entity, string propertyName, float value, int arrayElement) Sets a netprop from an array to the specified float.
SetPropInt void SetPropInt(handle entity, string propertyName, int value) Sets a netprop to the specified integer.
SetPropIntArray void SetPropInt(handle entity, string propertyName, int value, int arrayElement) Sets a netprop from an array to the specified integer.
SetPropString void SetPropString(handle entity, string propertyName, string value) Sets a netprop to the specified string.
SetPropStringArray void SetPropStringArray(handle entity, string propertyName, string value, int arrayElement) Sets a netprop from an array to the specified string.
SetPropVector void SetPropVector(handle entity, string propertyName, Vector value) Sets a netprop to the specified vector.
SetPropVectorArray void SetPropVectorArray(handle entity, string propertyName, Vector value, int arrayElement) Sets a netprop from an array to the specified vector.

CScriptEntityOutputs

Game Instance: EntityOutputs

Allows reading and manipulation of entity output data.

Methods

Function Signature Description
AddOutput void AddOutput(handle entity, string outputName, string targetName, string inputName, string parameter, float delay, int timesToFire) Adds a new output to the entity.
GetNumElements int GetNumElements(handle ntity entity, string outputName) Returns the number of array elements.
GetOutputTable void GetOutputTable(handle entity, string outputName, table, int arrayElement) Fills the passed table with output information.
HasAction bool HasAction(handle entity, string outputName) Returns true if an action exists for the output.
HasOutput bool HasOutput(handle entity, string outputName) Returns true if the output exists.
RemoveOutput void RemoveOutput(handle entity, string outputName, string targetName, string inputName, string parameter) Removes an output from the entity.


CScriptKeyValues

Script handle representation of a model's $keyvalues block. All sub-keys are instances of the same class.

Methods

Function Signature Description
constructor
FindKey CScriptKeyValues FindKey(string key) Find a sub key by the key name.
GetFirstSubKey CScriptKeyValues GetFirstSubKey() Return the first sub key object.
GetKeyBool bool GetKeyBool(string key) Return the key value as a bool.
GetKeyFloat float GetKeyFloat(string key) Return the key value as a float.
GetKeyInt int GetKeyInt(string key) Return the key value as an integer.
GetKeyString string GetKeyString(string key) Return the key value as a string.
GetNextKey CScriptKeyValues GetNextKey() Return the next neighbor key object to the one the method is called on.
IsKeyEmpty bool IsKeyEmpty(string key) Returns true if the named key has no value.
IsValid bool IsValid() Whether the handle belongs to a valid key.
ReleaseKeyValues void ReleaseKeyValues() Releases the contents of the instance.


CPlayerVoiceListener

Game Instance: PlayerVoiceListener

Tracks if any player is using voice and for how long.

Methods

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

CEnvEntityMaker

Extends CBaseEntity

Script handle class for env_entity_maker.

Methods

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

CFuncTrackTrain

Extends CBaseEntity

Script handle class for func_tracktrain.

Methods

Function Signature Description
GetFuturePosition Vector GetFuturePosition(float, float) Get a position on the track x seconds in the future


CPointScriptTemplate

Extends CBaseEntity

Script handle class for point_script_template.

Methods

Function Signature Description
AddTemplate void AddTemplate(string, handle) Add an entity to the template spawner
SetGroupSpawnTables void SetGroupSpawnTables(handle, handle) Cache the group spawn tables


CSceneEntity

Extends CBaseEntity

Script handle class for scripted_scene, which make use of VCD data.

Methods

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


CSimpleCallChainer

Has the same members as CCallChainer. [Todo]

Methods

Function Signature Description
Call Call()
chain chain()
constructor constructor()
PostScriptExecute PostScriptExecute()
prefix prefix()
scope scope()

CCallChainer

Methods

Function Signature Description
Call Call()
chains chains()
constructor constructor()
PostScriptExecute PostScriptExecute()
prefix prefix()
scope scope()

LateBinder

[Todo]

Methods

Function Signature Description
Begin Begin()
End End()
EstablishDelegation EstablishDelegation()
HookRootMetamethod HookRootMetamethod()
Log Log()
m_bindNamesStack m_bindNamesStack()
m_fixupSet m_fixupSet()
m_targetTable m_targetTable()
RemoveDelegation RemoveDelegation()
Resolve Resolve()
UnhookRootMetamethod UnhookRootMetamethod()

regexp

The built-in Squirrel class for regular expressions.

Methods

Function Signature Description
constructor regexp()
capture table capture(str, [start]) Returns an array of tables containing two indexes ("begin" and "end") of the first match of the regular expression in the string str. An array entry is created for each captured sub expressions. If no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string.
match bool match(str) Returns a true if the regular expression matches the string str, otherwise returns false.
search table search(str, [start]) Returns a table containing two indexes ("begin" and "end") of the first match of the regular expression in the string str, otherwise if no match occurs returns null. The search starts from the index start of the string, if start is omitted the search starts from the beginning of the string.
subexpcount subexpcount()

Data Types

Vector

Squirrel equivalent of the C++ Vector class. A three-dimensional vector with overloaded arithmetic operations for both Vectors and scalar values.

Methods

Function Signature Description
constructor Vector() Creates a new null vector.
constructor Vector(float x, float y, float z) Creates a new vector with the specified Cartesian coordiantes.
Cross float Cross(Vector factor) The vector product of two vectors. Returns a vector orthogonal to the input vectors.
Dot float Dot(Vector factor) The scalar product of two vectors.
Length float Length() Magnitude of the vector.
LengthSqr float LengthSqr() The magnitude of the vector squared. Faster than the above method.
Length2D float Length2D() Returns the magnitude of the vector on the x-y plane. Meant to be used when working with the client's HUD.
Length2DSqr float Length2DSqr() Returns the square of the magnitude of the vector on the x-y plane. Faster than the above method.
Norm float Norm() Seems to also return the vector length.
Scale Vector Scale(float factor) Scales the vector magnitude.
ToKVString string ToKVString() Returns a string without separations commas.
tostring string tostring() Returns a human-readable string.


Members

Instance Type Description
x float Cartesian X axis.
y float Cartesian Y axis.
z float Cartesian Z axis.

Operations

Operation Return Type Description
Vector + Vector Vector Returns the sum of both classes's members (XYZ).
QAngle + Vector
Vector - Vector Vector Returns the subtraction of both classes's members (XYZ).
QAngle + Vector
Vector * integer Vector Returns the multiplication of a Vector against a scalar.
Vector * float

QAngle

Squirrel equivalent of the C++ QAngle class. Represents a three-dimensional orientation as Euler angles.

Has overloaded arithmetic operations with both QAngles and scalar values. [Todo]

Methods

Function Signature Description
constructor constructor()
Forward Forward()
Left Left()
Pitch Pitch()
Roll Roll()
ToKVString ToKVString()
ToQuat ToQuat()
Up Up()
Yaw Yaw()

Members

Instance Type Description
x float Pitch in degrees.
y float Yaw in degrees.
z float Roll in degrees.

Operations

Operation Return Type Description
QAngle + QAngle QAngle Sum of both classes's members (XYZ).
Vector + QAngle
QAngle - QAngle QAngle Subtraction of both classes's members (XYZ).
Vector - QAngle
QAngle * int QAngle QAngle multiplied by a number.
QAngle * float


Vector2D, Vector4D

Two and four-dimensional equivalents to Vector.

Methods

Function Signature Description
constructor VectorXD(float x, float y, ...) Creates a new vector with the specified Cartesian coordiantes.
Dot float Dot(VectorXD factor) The scalar product of two vectors.
Length float Length() Magnitude of the vector.
LengthSqr float LengthSqr() The magnitude of the vector squared. Faster than the above method.
Norm float Norm() Seems to also return the vector length.
ToKVString string ToKVString() Returns a string without separations commas.


Quaternion

Quaternion represents rotations in three-dimensional space.

Methods

Function Signature Description
constructor Quaternion() Creates a new identity quaternion.
constructor Quaternion(float x,float y,float z,float w) Creates a new quaternion of the form w + xi + yj + zk.
Dot float Dot(Quaternion factor) The 4D scalar product of two quaternions. represents the angle between the quaternions in the range [1, 0].
Invert Quaternion Invert() Returns a quaternion with the complimentary rotation.
Norm Quaternion Norm() Normalizes the 4D vector length.
Todo: What effect does this have in quaternions?
SetPitchYawRoll void SetPitchYawRoll(float pitch, float yaw, float roll) Recomputes the quaternion from the supplied Euler angles.
ToKVString string ToKVString() Returns a string with the values separated by one space.
ToQAngle QAngle ToQAngle() Returns the angles resulting from the rotation.

Members

Instance Type Description
x float Vector component along the i axis.
y float Vector component along the j axis.
z float Vector component along the k axis.
w float Scalar part.

Operations

Todo: Descriptions of the operations are lacking details.
Operation Return Type Description
Quaternion + Quaternion Quaternion Sum of the two Quaternions.
Quaternion - Quaternion Quaternion Subtraction of the two Quaternions.
Quaternion * integer Quaternion Quaternion multiplied by a number.
Quaternion * float

Globals

Function Signature Description
AddThinkToEnt void AddThinkToEnt(handle entity, string FuncName) Sets a function in the entity's script to rerun by itself constantly. Pass null as the function name to remove a think function.
AddToScriptHelp AddToScriptHelp()
AllowThirdPersonCamera bool AllowThirdPersonCamera()
ArePlayersInHell bool ArePlayersInHell()
Assert void Assert(bool value, string optional message) Test value and if not true, throws exception, optionally with message.
BeginScriptDebug BeginScriptDebug()
ClearGameEventCallbacks void ClearGameEventCallbacks() Empties the tables of game event callback functions.
CreateProp handle CreateProp(string, Vector, string, int) Create a physics prop
CreateSceneEntity handle CreateSceneEntity(string) Create a scene entity to play the specified scene.
developer int developer() The current level of the developer console variable.
DispatchParticleEffect void DispatchParticleEffect(string, Vector, Vector) Dispatches a one-off particle system
Document void Document(unknown symbolOrTable, unknown itemIfSymbol = null, string descriptionIfSymbol = null)
DoEntFire void DoEntFire(string target, string action, string value, float delay, handle activator, handle caller) Generate an entity I/O event. The caller and activator argument takes a CBaseEntity script handle, and entities assigned can receive inputs with target set to !self, or !activator / !caller.
DoIncludeScript bool DoIncludeScript(string file, handle/table scope) Execute a script. and put all its content for the argument passed to thescopeparameter. (internal)
IncludeScript bool IncludeScript(string file, handle scope = null) Wrapper for DoIncludeScript
EmitAmbientSoundOn void EmitAmbientSoundOn(string soundName, float volume, int soundlevel, int pitch, handle entity) Play named sound on an entity using configurations similar to ambient_generic.
StopAmbientSoundOn void StopAmbientSoundOn(string soundName, handle entity) Stop named sound on an entity using configurations similar to ambient_generic.
EmitSoundOn void EmitSoundOn(string soundScript, handle entity) Play named sound on an entity.
StopSoundOn void StopSoundOn(string soundScript, handle entity) Stop named sound on an entity.
EmitSoundOnClient void EmitSoundOnClient(string soundScript, handle player) Play named sound only on the client for the specified player.
EndScriptDebug EndScriptDebug()
EntFire void EntFire(string target, string action, string value = null, float delay = 0, handle activator = null) Wrapper for DoEntFire() that setsactivator to null, but has nocallerparam.
EntFireByHandle void EntFireByHandle(handle, string, string, float, handle, handle) Generate and entity i/o event. First parameter is an entity instance.
EntIndexToHScript handle EntIndexToHScript(int entIndex) Turn an entity index integer to an HScript representing that entity's script instance.
FileToString string FileToString(string file) Reads a string from file. Returns the string from the file, null if no file or file is greater than 16384 bytes. The game will crash to desktop if the file is exactly 16384 bytes.
FindCircularReference FindCircularReference()
FindCircularReferences FindCircularReferences()
FireGameEvent bool FireGameEvent(string, handle) Fire a game event to a listening callback function in script. Parameters are passed in a squirrel table.
FireScriptEvent void FireScriptEvent(string event, table params) Wrapper for __RunEventCallbacks()
ForceEnableUpgrades void ForceEnableUpgrades(int) Whether to force on MvM-styled upgrades on/off. 0 -> default, 1 -> force off, 2 -> force on
FlagsMayBeCapped bool FlagsMayBeCapped() May a flag be captured?
FrameTime float FrameTime() Get the time spent on the server in the last frame
GameModeUsesCurrency bool GameModeUsesCurrency() Does the current gamemode have currency?
GameModeUsesMiniBosses bool GameModeUsesMiniBosses() Does the current gamemode have minibosses?
GameModeUsesUpgrades bool GameModeUsesUpgrades() Does the current gamemode have upgrades?
GetClassLimit int GetClassLimit(int) Get class limit for class. Indices:
GetDeveloperLevel int GetDeveloperLevel() Gets the level of 'developer'
GetFrameCount int GetFrameCount() Returns the engines current frame count
GetFriction float GetFriction(handle player) Returns the Friction on a player entity, meaningless if not a player
GetFunctionSignature GetFunctionSignature()
GetGravityMultiplier float GetGravityMultiplier()
GetListenServerHost handle GetListenServerHost() Get the local player on a listen server.
GetMannVsMachineAlarmStatus bool GetMannVsMachineAlarmStatus()
GetMapName string GetMapName() Get the name of the map.
GetModelIndex int GetModelIndex(string filename) Returns the index of the named model.
GetOvertimeAllowedForCTF bool GetOvertimeAllowedForCTF()
GetPhysAngularVelocity Vector GetPhysAngularVelocity(handle entity) Returns the Angular velocity of the entity.
GetPhysVelocity Vector GetPhysVelocity(handle entity) Returns the velocity of the entity.
GetPlayerFromUserID handle GetPlayerFromUserID(int ID) Given a user id, return the entity, or null.
GetRoundState int GetRoundState() Get current round state. Indices:
GetSoundDuration float GetSoundDuration(string soundname, string actormodel) Returns float dur
GetStopWatchState int GetStopWatchState() Get the current stopwatch state. Indices:
GetWinningTeam int GetWinningTeam() Who won!
HaveStopWatchWinner bool HaveStopWatchWinner()
InMatchStartCountdown bool InMatchStartCountdown() Are we in the pre-match state?
InOvertime bool InOvertime() Currently in overtime?
IsAttackDefenseMode bool IsAttackDefenseMode()
IsBirthday bool IsBirthday() Are we in birthday mode?
IsCompetitiveMode bool IsCompetitiveMode() Playing competitive?
IsDedicatedServer bool IsDedicatedServer() Returns true if this server is a dedicated server.
IsDefaultGameMode bool IsDefaultGameMode() The absence of arena, mvm, tournament mode, etc
IsHolidayActive bool IsHolidayActive(int holiday) class="mw-collapsible mw-collapsed" style="background:rgba(0,0,0,0.05) ;float:no;margin-bottom:1em;margin-left:0;padding-right:0.5em;border:1px solid rgba(255,255,255,0.1); border-left:solid 1px #8bb9e0; padding-left:1em;"
Indices:
  • 0: kHoliday_None
  • 1: kHoliday_TFBirthday
  • 2: kHoliday_Halloween
  • 3: kHoliday_Christmas
  • 4: kHoliday_CommunityUpdate
  • 5: kHoliday_EOTL
  • 6: kHoliday_Valentines
  • 7: kHoliday_MeetThePyro
  • 8: kHoliday_FullMoon
  • 9: kHoliday_HalloweenOrFullMoon
  • 10: kHoliday_HalloweenOrFullMoonOrValentines
  • 11: kHoliday_AprilFools
  • 12: kHoliday_Soldier

|- | IsHolidayMap | bool IsHolidayMap(int holiday) | Playing a holiday map? See the description of IsHolidayActive. |- | IsInArenaMode | bool IsInArenaMode() | Playing arena mode? |- | IsInKothMode | bool IsInKothMode() | Playing king of the hill mode? |- | IsInMedievalMode | bool IsInMedievalMode() | Playing medieval mode? |- | IsInWaitingForPlayers | bool IsInWaitingForPlayers() | Are we waiting for some stragglers? |- | IsMannVsMachineMode | bool IsMannVsMachineMode() | Playing MvM? Beep boop |- | IsMannVsMachineRespecEnabled | bool IsMannVsMachineRespecEnabled() | Are players allowed to refund their upgrades? |- | IsMatchTypeCasual | bool IsMatchTypeCasual() | Playing casual? |- | IsMatchTypeCompetitive | bool IsMatchTypeCompetitive() | Playing competitive? |- | IsModelPrecached | bool IsModelPrecached(string modelname) | Checks if the modelname is precached. |- | IsSoundPrecached | bool IsSoundPrecached(string soundname) | Checks if the soundname is precached. |- | IsPasstimeMode | bool IsPasstimeMode() | No ball games. |- | IsPlayerABot | bool IsPlayerABot(handle player) | Is this player/entity a bot. |- | IsPowerupMode | bool IsPowerupMode() | Playing powerup mode? Not compatible with MvM |- | IsPVEModeActive | bool IsPVEModeActive() | |- | IsQuickBuildTime | bool IsQuickBuildTime() | If an engie places a building, will it immediately upgrade? Eg. MvM pre-round etc. |- | IsTruceActive | bool IsTruceActive() | |- | IsUsingGrapplingHook | bool IsUsingGrapplingHook() | |- | IsUsingSpells | bool IsUsingSpells() | |- | IsWeakref | bool IsWeakref() | |- | LocalTime | void LocalTime(table) | Fills out a table with the local time (second, minute, hour, day, month, year, dayofweek, dayofyear, daylightsavings) |- | MakeNamespace | MakeNamespace() | |- | MapHasMatchSummaryStage | bool MapHasMatchSummaryStage() | |- | MatchmakingShouldUseStopwatchMode | bool MatchmakingShouldUseStopwatchMode() | |- | PickupObject | void PickupObject(handle player, handle entity) | Object from world is put into the "Held" slot of the player. Warning: it will smoothly interpolate from where it is to the players hand - which is a bit goofy if it is on other side of level. |- | PlayerInstanceFromIndex | CBasePlayer PlayerInstanceFromIndex(int index) | Get a script handle of a player using the player index. |- | PlayerReadyStatus_ArePlayersOnTeamReady | bool PlayerReadyStatus_ArePlayersOnTeamReady(int) | |- | PlayerReadyStatus_HaveMinPlayersToEnable | bool PlayerReadyStatus_HaveMinPlayersToEnable() | |- | PlayerReadyStatus_ResetState | void PlayerReadyStatus_ResetState() | |- | PlayersAreOnMatchSummaryStage | bool PlayersAreOnMatchSummaryStage() | |- | PointsMayBeCaptured | bool PointsMayBeCaptured() | Are points able to be captured? |- | PrecacheEntityFromTable | bool PrecacheEntityFromTable(table keyvalues) | Precache an entity from KeyValues in a table; useful for env_shake. |- | PrecacheModel | int PrecacheModel(string filename) | Precache a model and return index of the model. |- | PrecacheSound | void PrecacheSound(string soundName) | Precache a sound. |- | PrintHelp | PrintHelp() | |- | RandomFloat | float RandomFloat(float min, float max) | Generate a random floating-point number within a range, inclusive. |- | RandomInt | int RandomInt() | Generate a random integer within a range, inclusive. |- | RegisterFunctionDocumentation | void RegisterFunctionDocumentation(unknown func, string name, string signature, string description) | |- | RegisterScriptGameEventListener | void RegisterScriptGameEventListener(string eventName) | Register as a listener for a game event from script. It's what __CollectGameEventCallbacks() uses to register event callbacks to the C++ code. |- | RetrieveNativeSignature | RetrieveNativeSignature() | |- | RotateOrientation | QAngle RotateOrientation(QAngle, QAngle) | Rotate a QAngle by another QAngle. |- | RotatePosition | Vector RotatePosition(Vector origin, QAngle rotation, Vector input) | Rotate the input Vector around an origin. |- | ScreenFade | void ScreenFade(handle player, int red, int green, int blue, int alpha, float fadeTime, float fadeHold, int flags) | Start a customisable screenfade. |- | ScreenShake | void ScreenShake(Vector vecCenter, float flAmplitude, float flFrequency, float flDuration, float flRadius, int eCommand, bool bAirShake) | Start a customisable screenshake; eCommand( SHAKE_START = 0, SHAKE_STOP = 1 ). |- | SendToConsole | void SendToConsole(string command)

| Send a string to the console as a command.

Note.pngNote:This obeys the behavior of the sv_allow_point_servercommand convar. By default, this command will do nothing unless the server has this command to set to "always"

|- | SendToServerConsole | void SendToServerConsole(string command) | Send a string that gets executed on the server as a ServerCommand. |- | SendToConsoleServer | void SendToConsoleServer(string command) | Copy of SendToServerConsole with another name for compat. |- | SetFakeClientConVarValue | void SetFakeClientConVarValue(handle bot, string cvar, string value) | Sets a USERINFO client ConVar for a fakeclient. |- | SetGravityMultiplier | void SetGravityMultiplier(float multiplier) | |- | SetMannVsMachineAlarmStatus | void SetMannVsMachineAlarmStatus(bool status) | |- | SetOvertimeAllowedForCTF | void SetOvertimeAllowedForCTF(bool state) | |- | SetPlayersInHell | void SetPlayersInHell(bool state) | |- | SetUsingSpells | void SetUsingSpells(bool state) | |- | SpawnEntityFromTable | handle SpawnEntityFromTable(string name, handle keyvalues) | Spawn entity from KeyValues in table - 'name' is entity name, rest are KeyValues for spawn. |- | SpawnEntityGroupFromTable | bool SpawnEntityGroupFromTable(handle entityGroup) | Hierarchically spawn an entity group from a set of spawn tables. See L4D2_EMS/Appendix:_Spawning. |- | StringToFile | void StringToFile(string file, string string) | Stores a string as a file. |- | 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 |- | TraceLineEx | bool TraceLineEx(table traceTable) | Input Table: start, end, mask, ignore
Output Table: pos, fraction, hit, enthit, allsolid, startpos, endpos, startsolid, plane_normal, plane_dist, surface_name, surface_flags, surface_props |- | TraceLinePlayersIncluded | float TraceLinePlayersIncluded(Vector, Vector, handle) | given 2 points & ent to ignore, return fraction along line that hits world, models, players or npcs |- | TraceHull | bool TraceHull(table traceTable) | Input Table: start, end, hullmin, hullmax, mask, ignore
Output Table: pos, fraction, hit, enthit, allsolid, startpos, endpos, startsolid, plane_normal, plane_dist, surface_name, surface_flags, surface_props |- | UniqueString | string UniqueString(string input) | 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. |- | DoUniqueString | string DoUniqueString(string input) | Unknown; presumably an internal function called by UniqueString, so call that instead. |- | UsePlayerReadyStatusMode | bool UsePlayerReadyStatusMode() | |- | VSquirrel_OnCreateScope | table VSquirrel_OnCreateScope(any value, table scope) | Creates a new scope with the name of value in the submitted table (includes unique params). |- | VSquirrel_OnReleaseScope | void VSquirrel_OnReleaseScope(table createdScope) | Removes a scope created via VSquirrel_OnCreateScope. |- | __CollectEventCallbacks | void __CollectEventCallbacks(scope, prefix, globalTableName, regFunc) | Overloaded function. Its only used for this: __CollectEventCallbacks(scope, "OnGameEvent_", "GameEventCallbacks", ::RegisterScriptGameEventListener) |- | __CollectGameEventCallbacks | void __CollectGameEventCallbacks(scope) | Wrapper that registers callbacks for both OnGameEvent_x and OnScriptEvent_ functions. Done using the __CollectEventCallbacks function. |- | __ReplaceClosures | void __ReplaceClosures(script, scope) | |- | __RunEventCallbacks | void __RunEventCallbacks(event, params, prefix, globalTableName, bWarnIfMissing) | Call all functions in the callback array for the given game event |- | __RunGameEventCallbacks | void __RunGameEventCallbacks(event, params | Wrapper for __RunEventCallbacks() |}

Printing and Drawing

Function Signature Description
ClientPrint void ClientPrint(CBasePlayer player, int destination, string message) Print a client message. If you pass null instead of a valid player, the message will be sent to all clients.
DebugDrawBox void DebugDrawBox(Vector origin, vector min, vector max, int r, int g, int b, int alpha, float duration) Draw a debug overlay box.
DebugDrawBoxAngles void DebugDrawBoxAngles(Vector origin, Vector min, Vector max, QAngle direction, Vector rgb, int alpha, float duration) Draw a debug oriented box (cent, min, max, angles(p,y,r), vRgb, a, duration).
DebugDrawBoxDirection void DebugDrawBoxDirection(Vector center, Vector min, Vector max, Vector forward, Vector rgb, float alpha, float duration) Draw a debug forward box.
DebugDrawCircle void DebugDrawCircle(Vector center, Vector rgb, float alpha, float radius, bool ztest, float duration) Draw a debug circle.
DebugDrawClear void DebugDrawClear() Try to clear all the debug overlay info.
DebugDrawLine void DebugDrawLine(Vector start, Vector end, int red, int green, int blue', bool zTest, float time) Draw a debug overlay line.
DebugDrawLine_vCol void DebugDrawLine_vCol(Vector start, vector end, vector rgb, bool ztest, float duration) Draw a debug line using color vec.
DebugDrawScreenTextLine void DebugDrawScreenTextLine(float x, float y, int lineOffset, string text, int r, int g, int b, int a, float duration) Draw text with a line offset.
DebugDrawText void DebugDrawText(Vector origin, string text, bool useViewCheck, float duration) Draw text on the screen, starting on the position of origin.
__DumpScope void __DumpScope(int indentation, handle scope) Dumps contents of everything in the scope.
DumpObject void DumpObject(handle object) Dumps information about a class or instance.
Msg void Msg(string message) Prints message to console without any line feed after.
printl void printl(string message) Prints message to console with a line feed after.
realPrint void realPrint(string message) Identical to print. print seems to be a wrapper for this.
Say void Say(CBasePlayer player, string message, bool teamOnly) Calling this will have the specified player send the message to chat, either to teamOnly (true) or to everyone.
ShowMessage void ShowMessage(string message) Print a hud message on all clients

Squirrel Standard Library

Squirrel Functions of both Squirrel's built-in functions and standard library.

Function Signature Description
array array(int length, any fill = null) Returns a new array of the given length where each element is set to fill (null by default).
assert assert(bool exp) Throws an assertion error if the given expression evaluates to false (i.e. the values 0, 0.0, null and false)
callee function callee() Returns the currently running closure.
collectgarbage int collectgarbage() Runs the garbage collector and returns the number of reference cycles found(and deleted) This function only works on garbage collector builds.
compilestring any compilestring(string string, string buffername = null) Compiles a string containing a squirrel script into a function and returns it.
dummy dummy()
enabledebuginfo void enabledebuginfo(any enable) Enable/disable the debug line information generation at compile time. enable != null enables . enable == null disables.
error void error(string x) Prints x in the standard error output .
getconsttable table getconsttable() Returns the const table of the VM.
getroottable table getroottable() Returns the root table of the VM.
getstackinfos table getstackinfos(int stacklevel) Returns the stack frame informations at the given stack level (0 is the current function 1 is the caller and so on). If the stack level doesn't exist the function returns null.
Example
{
	func = "DoStuff",		// function name
	
	src = "test.nut",		// source file
	
	line = 10,			// line number
	
	locals =			// a table containing the local variables
	{
		a = 10,
		
		testy = "I'm a string"
	}
}
newthread coroutine newthread(function threadfunc) Creates a new cooperative thread object(coroutine) and returns it .
print print(string message) Prints the given parameter but with no newline unlike printl()
resurrectunreachable array resurrectunreachable() Runs the garbage collector and returns an array containing all unreachable object found. If no unreachable object is found, null is returned instead. This function is meant to help debugging reference cycles. This function only works on garbage collector builds.
setconsttable table setconsttable(table consttable) Sets the const table of the VM which also returns the previous const table.
setdebughook void setdebughook(function hook_func) Sets the debug hook.
seterrorhandler void seterrorhandler(function func) Sets the runtime error handler .
setroottable table setroottable(table roottable) Sets the root table of the VM which also returns the previous root table.
suspend void suspend(any ret) Suspends the coroutine that called this function.
type type(var) Returns var._typeof(), i.e. the type of the given parameter as a string

Math

Function Signature Description
abs abs(num x) Returns |x| as integer unlike fabs()
acos acos(num x) Returns cos-1(x), -1 ≤ x ≤ 1
asin asin(num x) Returns sin-1(x), -1 ≤ x ≤ 1
atan atan(num x) Returns tan-1(x)
atan2 atan2(num y, num x) (!) Returns the angle between the ray from the point (0, 0) through (x, y) and the positive x-axis, confined to (−PI, PI], see also atan2. Note the order of the parameters x and y!
ceil ceil(num x) Returns the smallest integer that is ≥ x
cos cos(num x) Returns cos(x)
exp exp(num x) Returns exp(x) = ex
fabs fabs(num x) Returns |x| as float unlike abs()
floor floor(num x) Returns the largest integer that is ≤ x
log log(num x) Returns loge(x) = ln(x)
log10 log10(num x) Returns log10(x)
pow pow(num x, num y) Returns xy
rand rand() Returns a random integer with 0 ≤ rand() ≤ RAND_MAX
sin sin(num x) Returns sin(x)
sqrt sqrt(num x) Returns the square root of x
srand srand(num seed) Sets the starting point for generating a series of pseudorandom integers
tan tan(num x) Returns tan(x)

Strings

Function Signature Description
format format(string, args...) Returns a formatted string
lstrip lstrip(string) Removes whitespace at the beginning of the given string
rstrip rstrip(string) Removes whitespace at the end of the given string
split string split(string str, string separator') Returns an array of strings split at each point where a separator character occurs in str. The separator is not returned as part of any array element. the parameter separators is a string that specifies the characters as to be used for the splitting.
strip strip(string) Removes whitespace at the beginning and end of the given string

Script Debug

[Todo]

Function Signature Description
ScriptDebugAddTextFilter void ScriptDebugAddTextFilter()
ScriptDebugAddTrace void ScriptDebugAddTrace()
ScriptDebugAddWatch void ScriptDebugAddWatch()
ScriptDebugAddWatches void ScriptDebugAddWatches()
ScriptDebugAddWatchPattern void ScriptDebugAddWatchPattern()
ScriptDebugClearTraces void ScriptDebugClearTraces()
ScriptDebugClearWatches void ScriptDebugClearWatches()
ScriptDebugDefaultWatchColor void ScriptDebugDefaultWatchColor()
ScriptDebugDraw void ScriptDebugDraw()
ScriptDebugDrawWatches void ScriptDebugDrawWatches()
ScriptDebugDumpKeys void ScriptDebugDumpKeys()
ScriptDebugHook void ScriptDebugHook()
ScriptDebugIterateKeys void ScriptDebugIterateKeys()
ScriptDebugIterateKeysRecursive void ScriptDebugIterateKeysRecursive()
ScriptDebugRemoveTextFilter void ScriptDebugRemoveTextFilter()
ScriptDebugRemoveTrace void ScriptDebugRemoveTrace()
ScriptDebugRemoveWatch void ScriptDebugRemoveWatch()
ScriptDebugRemoveWatches void ScriptDebugRemoveWatches()
ScriptDebugRemoveWatchPattern void ScriptDebugRemoveWatchPattern()
ScriptDebugText void ScriptDebugText()
ScriptDebugTextDraw void ScriptDebugTextDraw()
ScriptDebugTextPrint void ScriptDebugTextPrint()
ScriptDebugTextTrace void ScriptDebugTextTrace()
ScriptDebugTraceAll void ScriptDebugTraceAll()
ScriptDebugWatches void ScriptDebugWatches()
__VScriptServerDebugHook __VScriptServerDebugHook()

See also