Script: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
Note:The code can contain spaces but it cannot contain semicolons (
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 
Workaround:Define the variables as needed temporarily, e.g.  
		
	
 (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.) Tag: Removed redirect  | 
				m (Used game templates directly. Dark pre.)  | 
				||
| Line 1: | Line 1: | ||
{{lang|script}}  | {{lang|script}}  | ||
<code>'''script'''</code> is a [[console command]] in all {{  | <code>'''script'''</code> is a [[console command]] in all {{src|4}} games since {{l4d2|4}} that have a {{sq}} [[Squirrel]] implementation of [[VScript]]{{confirm}}, namely [[VScript#Squirrel|these]].  | ||
== Description ==  | == Description ==  | ||
| Line 8: | Line 8: | ||
== Syntax ==  | == Syntax ==  | ||
{{pre|  | |||
script   | script <code>  | ||
}}  | |||
== Example ==  | == Example ==  | ||
{{pre|  | |||
script printl( GetMapName() )  | script printl( GetMapName() )  | ||
}}  | |||
Should print the map   | Should print the name of the current map in the console in most games.  | ||
== See also ==  | == See also ==  | ||
Revision as of 17:13, 11 October 2022
script is a console command in all 
 Source games since 
 Left 4 Dead 2 that have a 
 Squirrel implementation of VScript[confirm], namely these.
Description
It executes Squirrel code from the root table.
;) because the developer console considers semicolons as delimiters for commands.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.