Script objects: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
(add redirect for searching)
 
(update after split)
Line 1: Line 1:
#REDIRECT [[Script object]]
== Introduction ==
 
A '''script object''' is an object that is written in the idTech4 scripting language, and an be attached to arbitrary entities. Each entity can have '''only one''' script object.
 
For your convience, TDM already contains a few useful script objects:
 
=== tdm_suicide ===
 
<pre>
"script_object" "tdm_suicide"
"remove_delay"  "100"              // remove this entity 100 seconds after spawning it
</pre>
 
=== tdm_light_holder ===
 
<pre>
"script_object" "tdm_light_holder"
"extinguished"  "1"                // the light starts off, but can be lit by the player
</pre>
 
This is typical attached to either lights (an electrical lamp f.i.) or light holders (a candle holder with attached candle + flame, or a torch with attached flame). This script object has handy methods to toggle all lights that this holder has, regardless how many (multiple flames?) or where (flame on holder or flame on candle on holder?).
 
This script object also makes the entity react to fire stims, an/or triggers like when you link a button/lever/trigger to this entity.
 
== See also ==
 
* [[Writing script objects]]
 
{{scripting}}

Revision as of 11:20, 15 January 2011

Introduction

A script object is an object that is written in the idTech4 scripting language, and an be attached to arbitrary entities. Each entity can have only one script object.

For your convience, TDM already contains a few useful script objects:

tdm_suicide

 "script_object" "tdm_suicide"
 "remove_delay"  "100"              // remove this entity 100 seconds after spawning it

tdm_light_holder

 "script_object" "tdm_light_holder"
 "extinguished"  "1"                // the light starts off, but can be lit by the player

This is typical attached to either lights (an electrical lamp f.i.) or light holders (a candle holder with attached candle + flame, or a torch with attached flame). This script object has handy methods to toggle all lights that this holder has, regardless how many (multiple flames?) or where (flame on holder or flame on candle on holder?).

This script object also makes the entity react to fire stims, an/or triggers like when you link a button/lever/trigger to this entity.

See also