Script
Jump to navigation
Jump to search
script
is a console command in all Source games since
Left 4 Dead 2 that have a
Squirrel implementation of VScript, namely these, and also in
Team Fortress 2.
Description
It executes Squirrel code from the root table, which can contain spaces without quotation marks used. Despite this, the developer console reads the code like a typical command's value, so special console delimiters like quotation marks ("
) and semicolons (;
) cannot be used for scripting needs.

`
) can be used to create `strings` safely with this command.
activator
, caller
or self
. 
script ::activator <- Entities.FindByClassname(null, "player")
.Syntax
script <code>
Example
script printl( GetMapName() )
Should print the name of the current map in the console in most games.
script player <- Entities.FindByClassname(null, `player`); script player.SetMaxHealth( 200 )
(only in ) Using backticks and a variable, find a player then set their max health to 200.