Difference between revisions of "Trigger script"

From Sven Co-op
Jump to navigation Jump to search
(Import of converted entguide pages from Sven Manor.)
 
m
 
(2 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
}}
 
}}
  
This powerful entity allows you to put scripts made with AngelScript language on your map. Before Sven Co-op 5.0 you already were able to create almost everything with existed entities- this entity pushes imagination barrier even further allowing you to open an existed script.
+
This powerful entity allows you to put scripts made with AngelScript language on your map. Before Sven Co-op 5.0 you already were able to create almost anything with existed entities- this entity pushes imagination barrier even further allowing you to open an existing script and use functions.
 +
For more information on how to build trigger_script functions, visit the [https://github.com/baso88/SC_AngelScript/wiki/trigger_script SC AngelScript documentation].
  
 
== Keyvalues ==
 
== Keyvalues ==
  
{{Entity_keyvalue|Script to load|m_iszScriptFile|The name of the script to load in "scripts\maps" directory, e.g. "mymap/my_script1.as".}}
+
{{Entity_keyvalue|Script to load|m_iszScriptFile|The name of the script to load in "scripts\maps" directory, e.g. <code>mymap/my_script1</code>. This can be left empty if the function already exists from scripts specified via <code>map_script</code> in cfg.}}
{{Entity_keyvalue|Function to execute when triggered|m_iszScriptFunctionName|Function (declared in the opened script file) to call when trigger_script is triggered.}}
+
{{Entity_keyvalue|Function to execute when triggered|m_iszScriptFunctionName|Function (declared in the opened script file) to call when trigger_script is triggered. If the function belongs to a namespace, you must use prefix the function name with the namespace name followed by:: e.g. <code>mynamespace::MyFunction</code> for the keyvalue.}}
 
{{Entity_keyvalue|Time between thinks|m_flThinkDelta|If "Mode" is set to 'Think', this is a time delay between script calls.}}
 
{{Entity_keyvalue|Time between thinks|m_flThinkDelta|If "Mode" is set to 'Think', this is a time delay between script calls.}}
 
{{Entity_keyvalue|Mode|m_iMode|Script call mode. 'Trigger' allows to execute script once, 'Think' executes script every (specified in "Time between thinks")  
 
{{Entity_keyvalue|Mode|m_iMode|Script call mode. 'Trigger' allows to execute script once, 'Think' executes script every (specified in "Time between thinks")  

Latest revision as of 15:59, 14 March 2023

trigger_script
Type

point

Status

supported

 


This powerful entity allows you to put scripts made with AngelScript language on your map. Before Sven Co-op 5.0 you already were able to create almost anything with existed entities- this entity pushes imagination barrier even further allowing you to open an existing script and use functions. For more information on how to build trigger_script functions, visit the SC AngelScript documentation.

1 Keyvalues

Script to load : m_iszScriptFile

The name of the script to load in "scripts\maps" directory, e.g. mymap/my_script1. This can be left empty if the function already exists from scripts specified via map_script in cfg.

Function to execute when triggered : m_iszScriptFunctionName

Function (declared in the opened script file) to call when trigger_script is triggered. If the function belongs to a namespace, you must use prefix the function name with the namespace name followed by:: e.g. mynamespace::MyFunction for the keyvalue.

Time between thinks : m_flThinkDelta

If "Mode" is set to 'Think', this is a time delay between script calls.

Mode : m_iMode

Script call mode. 'Trigger' allows to execute script once, 'Think' executes script every (specified in "Time between thinks") time interval.

2 Flags

1 : Start on

Script is activated on start.