Table of Contents

,

Start Page » DragonScript Scripting Language » Behavior Elements: Quick and Easy Development » ECBehaviorShowMessage

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.

Instance Counts

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

Element class properties have the prefix showMessage. or showMessage({id}). if id is not empty.

trigger

Set trigger. Message is shown if trigger evaluates to true.

message

Set message.

Events

This behavior has no events.

Required Behaviors

This behavior requires no other behaviors.

Optional Behaviors

This behavior does not support optional behaviors.

Persistency

This behavior does support element class to be persistable (setPersistable). Saves selected color.

API Documentation

ECBehaviorShowMessage.

Since DragonScript Module Version 1.0

Use Cases

Element Class Example

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

Behavior Factory

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>

Live Examples