Script

From Valve Developer Community
Revision as of 21:29, 9 December 2021 by Popcorn (talk | contribs) (script is a console command. This page is only referenced once, namely for the script command (and not for Scripts), so this change is ok.)
Jump to navigation Jump to search
English (en)中文 (zh)Translate (Translate)

script is a console command in all Template:Game name games since Template:Game name that have a Squirrel Squirrel implementation of VScript[confirm], namely these.

Description

It executes Squirrel code from the root table.

Note.pngNote:The code can contain spaces but it cannot contain semicolons (;) because the developer console considers semicolons as delimiters for commands.
Note.pngNote: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.pngWorkaround: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