This wiki has been moved to https://github.com/SuperTux/wiki into the mediawiki branch.

Difference between revisions of "ScriptingCandle"

From SuperTux
Jump to: navigation, search
m (Created candle page)
 
(Added "Navbox Scripting reference" template.)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
  
= Summary =
+
== Summary ==
  
 
A Candle object that was given a name can be controlled by scripts.
 
A Candle object that was given a name can be controlled by scripts.
  
= Example =
+
== Instances ==
 +
A <tt>Candle</tt> is instantiated via a definition in a level. It can be accessed by its <tt>name</tt> in scripts and via <tt>sector.''name''</tt> in the console.
 +
 
 +
=== Example ===
  
 
Example of a definition:
 
Example of a definition:
Line 23: Line 26:
 
</pre>
 
</pre>
  
= Methods =
+
Console usage:
 +
 
 +
<pre>
 +
sector.CANDLE1.set_burning(false)
 +
</pre>
 +
 
 +
== Methods ==
 
{| class="objectlist"
 
{| class="objectlist"
 
! class="method"| get_burning()
 
! class="method"| get_burning()
Line 32: Line 41:
 
|}
 
|}
  
= Constants =
+
== Constants ==
  
 
None
 
None
  
 +
{{Navbox Scripting reference}}
 
[[Category:Scripting Reference]]
 
[[Category:Scripting Reference]]

Latest revision as of 11:20, 23 January 2010


Summary

A Candle object that was given a name can be controlled by scripts.

Instances

A Candle is instantiated via a definition in a level. It can be accessed by its name in scripts and via sector.name in the console.

Example

Example of a definition:

(candle
  (name "CANDLE1")
  (burning #f)
  (x 1632)
  (y 1088)
)

The above object will be exposed under the name CANDLE1 in the scripting engine. Example usage:

CANDLE1.set_burning(true);

Console usage:

sector.CANDLE1.set_burning(false)

Methods

get_burning() returns true if candle is lighted
set_burning(bool burning) true: light candle, false: extinguish candle

Constants

None

Scripting reference
Ambient sound · Camera · Candle · Display effect · Floating image · Globals · Level · Level time · Path · Platform · Player · Scripted object · Sector · Sound · Text · Thunderstorm · Tilemap · Will-o-wisp · Wind