Logic script: Difference between revisions
		
		
		
		
		
		Jump to navigation
		Jump to search
		
				
		
		
	
|  (-default kv template) | SirYodaJedi (talk | contribs)  No edit summary | ||
| Line 29: | Line 29: | ||
| * [http://leeland.stores.yahoo.net/l4d2-scripting.html Scripting for Left 4 Dead 2 (Leeland.net)] - Example uses of logic_script | * [http://leeland.stores.yahoo.net/l4d2-scripting.html Scripting for Left 4 Dead 2 (Leeland.net)] - Example uses of logic_script | ||
| [[Category:Mapbase  | [[Category:Mapbase entities]] | ||
| [[Category:Team Fortress 2 entities]] | |||
Revision as of 08:32, 13 September 2024
|  Class hierarchy | 
|---|
| CLogicScript | 
logic_script  is a   point entity  available in all  Source games since
 Source games since  Left 4 Dead 2. It is also available in
 Left 4 Dead 2. It is also available in  Team Fortress 2 and
 Team Fortress 2 and  Mapbase and it is the container for VScripts. In Left 4 Dead 2, for example, this entity is used extensively for the logic in "carnival games" found in the Dark Carnival campaign, such as Peanut Gallery, Strongman Contest, Whack-a-Stach, etc.
 Mapbase and it is the container for VScripts. In Left 4 Dead 2, for example, this entity is used extensively for the logic in "carnival games" found in the Dark Carnival campaign, such as Peanut Gallery, Strongman Contest, Whack-a-Stach, etc.
KeyValues
- Name (targetname) <string>[ Edit ]
- The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentnameortarget).
 Also displayed in Hammer's 2D views and Entity Report.See also: Generic Keyvalues, Inputs and Outputs available to all entities
- EntityGroup[0] (Group00) to EntityGroup[15] (Group15) <targetname>
- Entities to add in the EntityGroup array for the script.
- Entity Scripts (vscripts)  <scriptlist> (in all games since  ) )
- Space delimited list of VScript files (without file extension) that are executed after all entities have spawned. The scripts are all executed in the same script scope, later ones overwriting any identical variables and functions.
- Think function (thinkfunction)  <string> (in all games since  ) )
- Name of the function within this entity's script that'll be called automatically every 100 milliseconds, or a user-defined interval if the function returns a number. Avoid expensive operations in this function, as it may cause performance problems.
Inputs
- RunScriptFile  <script> (in all games since  ) (also in ) (also in ) )
- Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
- RunScriptCode  <string> (in all games since  ) (also in ) (also in ) )
- Execute a string of VScript source code in the scope of the entity receiving the input. String quotation may be needed when fired via console. 
- CallScriptFunction  <string> (in all games since  ) (also in ) (also in ) !FGD ) !FGD
- Calls a VScript function defined in the scope of the receiving entity.
- TerminateScriptScope   (only in  ) !FGD ) !FGD
- Destroys the script scope of the receving entity.
See also
External links
- It's the vscripting documentation FAQ! (Steam Forums)
- Scripting for Left 4 Dead 2 (Leeland.net) - Example uses of logic_script































