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.  
		
	
 (Redirect vague term to disambiguation page) Tag: New redirect  | 
				 (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  | 
				||
| Line 1: | Line 1: | ||
#  | {{lang|script}}  | ||
<code>'''script'''</code> is a [[console command]] in all {{game name|src|name=Source}} games since {{game name|l4d2|name=Left 4 Dead 2}} that have a {{sq}} [[Squirrel]] implementation of [[VScript]]{{confirm}}, namely [[VScript#Squirrel|these]].  | |||
== Description ==  | |||
It executes Squirrel code from the root table.  | |||
{{note|The code can contain spaces but it cannot contain semicolons (<code>;</code>) because the developer console considers semicolons as delimiters for commands.}}  | |||
{{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 <code>activator</code>, <code>caller</code> or <code>self</code>. {{workaround|Define the variables as needed temporarily, e.g. <code>script ::activator <- Entities.FindByClassname(null, "player")</code>.}} }}  | |||
== Syntax ==  | |||
<pre>  | |||
script <code>  | |||
</pre>  | |||
== Example ==  | |||
<pre>  | |||
script printl( GetMapName() )  | |||
</pre>  | |||
Should print the map name in the console in most games.  | |||
== See also ==  | |||
* [[Scripts]]  | |||
* [[VScript]]  | |||
* {{sq}} [[Squirrel]]  | |||
[[Category:Console Commands]]  | |||
[[Category:VScript]]  | |||
Revision as of 20:29, 9 December 2021
script is a console command in all Template:Game name games since Template:Game name 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 map name in the console in most games.