This article's documentation is for anything that uses the Source engine. Click here for more information.
This article's documentation is for Source 2. Click here for more information.

Logic script: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎Inputs: clean up, replaced: {{ModernNote| → {{note|)
m (Updated old entity format to {{this is a}}. This action was perfomed by a bot.)
Line 5: Line 5:
[[File:Logic_script_src2.png|left|Source 2 editor sprite]]
[[File:Logic_script_src2.png|left|Source 2 editor sprite]]


{{Entity|logic_script|type=e0|since=Left 4 Dead 2}} It is also available in {{tf2|4}} and it is the container for [[VScript]]s. 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.
{{this is a|e0|name=logic_script|since=Left 4 Dead 2}} It is also available in {{tf2|4}} and it is the container for [[VScript]]s. 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.


{{clr}}
{{clr}}

Revision as of 11:48, 4 January 2024

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CLogicScript
CPointEntity
CBaseEntity
Source 1 editor sprite
Source 2 editor sprite

logic_script is an e0 available in all Source Source games since Left 4 Dead 2 Left 4 Dead 2. It is also available in Team Fortress 2 Team Fortress 2 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

start ([todo internal name (i)])
Group00 ([todo internal name (i)]) <targetname>
EntityGroup[0]
vscripts ([todo internal name (i)]) <scriptlist> (in all games since Left 4 Dead 2)
Entity Scripts
thinkfunction ([todo internal name (i)]) <string> (in all games since Left 4 Dead 2)
Think function
end ([todo internal name (i)])

Inputs

RunScriptFile <scriptRedirectInput/string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
Execute a VScript file from disk, without file extension. The script contents are merged with the script scope of the receiving entity.
RunScriptCode <stringRedirectInput/string> (in all games since Left 4 Dead 2) (also in Team Fortress 2)
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. Template:ModernBugfix
Note.pngNote:Team Fortress 2 Backtick characters ` are replaced with quotation marks at runtime, allowing quotation marks to be used when normally not possible.
CallScriptFunction <stringRedirectInput/string> (in all games since Left 4 Dead 2) (also in Team Fortress 2) !FGD
Calls a VScript function defined in the scope of the receiving entity.
TerminateScriptScope  (only in Team Fortress 2) !FGD
Destroys the script scope of the receving entity.

See also

External links