Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorParameterTable
Behavior element behavior adding parameter table support for actors.
Adds ParameterTable instance. This allows to store parameter with primitive or persistable type for game elements or global game state. Parameter tables are sometimes called “Black boards”. Various game scripts can set values in a table while other game scripts can read the values from the table without the individual systems knowing each other. For performance reasons the entries in the table are queried and can be stored locally to avoid looking them up all the time. In addition to primitive values parameters support objects implementing the Persistable interface. This allows parameter tables to be stored in save states easily. Parameter values are cleared by setting them to \em null. This avoids the need to remove parameters from the table.
The parameter table is a pure storage facility. No notifications about changes to parameter values is done in any way. If you need tracking state changes use TSTriggerTable or the EventTracker.
This behavior can be used only once on an element.
Element class properties have the prefix parameterTable.
.
This behavior has no events.
This behavior requires no other behaviors.
This behavior does not support optional behaviors.
This behavior does support element class to be persistable (setPersistable).
Since DragonScript Module Version 1.0
This example defines an element which support parameter table.
class MyElement extends BehaviorElementClass public var ECBehaviorParameterTable parameterTrable func new() parameterTable = ECBehaviorParameterTable.new(this) end end
Using element class supporting adding behaviors the behavior can be added like this:
<?xml version='1.0' encoding='UTF-8'?> <elementClass name='MyClass' class='GenericBehaviorElement'> <behavior type='ECBehaviorParameterTable'> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.name'>value</string> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorParameterTable' id='second'/> </elementClass>