Script

From Valve Developer Community
Jump to: navigation, search
English

script is a console command in all Source Source games since Left 4 Dead 2 Left 4 Dead 2 that have a Squirrel Squirrel implementation of VScript[confirm], namely these.

Description

It executes Squirrel code from the root table.

Note.png Note: The code can contain spaces but it cannot contain semicolons (;) because the developer console considers semicolons as delimiters for commands.
Note.png Note: Since the code is not executed from an entity's script scope and not in response to I/O, one can most likely not execute code that calls the variables activator, caller or self.
Placementtip.gif Workaround: Define the variables as needed temporarily, e.g. script ::activator <- Entities.FindByClassname(null, "player").

Syntax

script <code>

Example

script printl( GetMapName() )

Should print the map name in the console in most games.

See also