Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorShowMessage
Behavior element behavior showing message to player if triggered. The message is shown each time the trigger evaluates to true.
By default message is printed on console. Typically a shout panel is used to show the latest console messages for a short time. Optionally you can also use subtitle instead.
This behavior can be used multiple times on an element to show different messages. Use the behavior identifier to tell them apart.
Element class properties have the prefix showMessage.
or showMessage({id}).
if id is not empty.
Set trigger. Message is shown if trigger evaluates to true.
showMessage.trigger
or showMessage({id}).trigger
enabled
<string name='showMessage.trigger'>@switchOnVent & @powerEnabled</string>
Set message.
showMessage.message
or showMessage({id}).message
<string name='showMessage.message'>You touched me!</string>
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). Saves selected color.
Since DragonScript Module Version 1.0
This example defines an element which shows message if player touches a trigger.
class MyElement extends BehaviorElementClass public var ECBehaviorShowMessage showMessage func new() showMessage = ECBehaviorShowMessage.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='ECBehaviorShowMessage'> <!-- optional: use BaseGameApp trigger table. game can add more supported values. default is 'default' --> <string name='triggerTable'>default</string> <!-- optional: use BaseGameApp console. game can add more supported values. default is 'default' --> <string name='console'>default</string> <!-- set element properties. omit property prefix if used inside behavior tag --> <string name='.message'>You touched me!</string> </behavior> <!-- for adding multiple behaviors use unique identifiers --> <behavior type='ECBehaviorShowMessage' id='second'/> </elementClass>