-
Notifications
You must be signed in to change notification settings - Fork 0
Broker Events
A broker event is defined as a combination of the following elements:
data_typefilter_fieldfilter_valuebroadcast_messageoverride
As previously mentioned, the ScriptorBroker is a broadcast listener that, by default, listens to * (all broadcasts). This means every broadcast sent in your game, including raptor-internal broadcasts, will be inspected by the broker.
The broker allows you to attach ("hook") scripts to any broadcast by defining a set of rules.
Each broker event hook is defined by the following five components:
| Element | Type | Example | Description |
|---|---|---|---|
| Data Type | string |
"Enemy" |
The name of a script class or game object. This is the sender (the .from) of the broadcast message. |
| Filter Field | string |
"name" |
Optional. The name of a field in the sender of the broadcast. NOTE: Call chains are allowed! Like data.group.name. |
| Filter Value | string |
"Rogue*""Zombie"
|
Required, if "Filter Field" is present, otherwise optional too. The value, the field must have, to launch the script. raptor wildcards are supported. |
| Broadcast | string |
"combat.monster.died" |
Must be the exact name of a broadcast message (the .title). Wildcards are not supported here, as each script must hook to a specific broadcast. |
| Override | bool |
true or false
|
If the event is an override, no base class events can trigger. It replaces them. |
Run a script on a broadcast combat.monster.died for an Enemy object, whose name starts with Rogue.
- This hook will trigger for all broadcasts from
Enemyobjects or their child classes (e.g.,Humans,Orcs,Dragons, etc.). - The script will execute only if the name field of the sender starts with
"Rogue".
data_type "Enemy"
filter_field "name"
filter_value "Rogue*"
broadcast_message "combat.monster.died"
override false
Run a script on a broadcast combat.monster.died for a Boss object, without any additional filter (run on all bosses).
- This hook triggers for all
Bossobjects when they send thecombat.monster.diedbroadcast. - If the dying monster is a
Boss, this script runs in addition to any script hooked forEnemyobjects.
data_type "Boss"
filter_field ""
filter_value ""
broadcast_message "combat.monster.died"
override false
Run a script on a broadcast combat.monster.died for a Boss object, and prevent other scripts from triggering when a boss dies.
- This can be achieved by adding the same hook as above but setting
override = true. - When
overrideis set, this script replaces any other scripts (like the one forEnemy) that would normally run for this broadcast. -
overrideprevents base class triggers to fire, so this only works, if your inheritance chain of the object is "Enemy -> Boss" (Bossmust be a child class or base object ofEnemy)
data_type "Boss"
filter_field ""
filter_value ""
broadcast_message "combat.monster.died"
override true
Read on the next page, how to Register Broker Events.
Back to Repo ● Wiki Home
Copyright © coldrock.games
- Home
- Scriptor Contents
- Scriptor Configuration
- Notepad⁺⁺ Integration
- Create a Script
- $ Variables
- Call a GML Function
- Scriptor global functions
- #-Commands
- The Scriptor Broker
- Broker Events
- Self-Registering Scripts
- Registering Broker Events
- Scriptor Broker File Format
- Extending Scriptor
- var
- new
- goto
- gosub and return
- return (without gosub)
- call
- reset
- Loops
- Conditionals