mirror of
https://github.com/vegu-ai/talemate.git
synced 2026-09-02 20:20:40 +02:00
197 lines
5.8 KiB
Markdown
197 lines
5.8 KiB
Markdown
|
|
# Event Nodes
|
||
|
|
|
||
|
|
Emit messages and status updates from graphs, and react to scene events with the **Event** listener node. See [Events](../../core-concepts/events.md) for the event system and the [Events reference](../events.md) for every event a graph can listen to.
|
||
|
|
|
||
|
|
<!-- glossary:generated - everything below this line is generated by `python -m talemate.game.engine.nodes.tools glossary --write` - do not edit -->
|
||
|
|
|
||
|
|
|
||
|
|
_7 nodes._
|
||
|
|
|
||
|
|
| Node | Registry path |
|
||
|
|
| --- | --- |
|
||
|
|
| [Emit Agent Message](#emit-agent-message) | `event/EmitAgentMessage` |
|
||
|
|
| [Emit Scene Status](#emit-scene-status) | `event/EmitSceneStatus` |
|
||
|
|
| [Emit Status](#emit-status) | `event/EmitStatus` |
|
||
|
|
| [Emit Status (Conditional)](#emit-status-conditional) | `event/EmitStatusConditional` |
|
||
|
|
| [Emit System Message](#emit-system-message) | `event/EmitSystemMessage` |
|
||
|
|
| [Emit World Editor Sync](#emit-world-editor-sync) | `event/EmitWorldEditorSync` |
|
||
|
|
| [Event](#event) | `event/Event` |
|
||
|
|
|
||
|
|
## Emit Agent Message
|
||
|
|
|
||
|
|
`event/EmitAgentMessage`
|
||
|
|
|
||
|
|
Emits an agent message to the UX
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
| `message` | `str` | (optional) The message text to emit |
|
||
|
|
| `agent` | `agent,str` | (optional) The agent (agent object or agent name) |
|
||
|
|
| `header` | `str` | (optional) The header of the message |
|
||
|
|
| `message_color` | `str` | (optional) The color of the message |
|
||
|
|
| `meta` | `dict` | (optional) The meta data of the message |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The state input, passed through |
|
||
|
|
| `emitted` | `bool` | Whether the message was emitted (True) or not (False) |
|
||
|
|
|
||
|
|
**Properties**
|
||
|
|
|
||
|
|
| Property | Type | Default | Description |
|
||
|
|
| --- | --- | --- | --- |
|
||
|
|
| `message` | `str` | `""` | The message text to emit |
|
||
|
|
| `agent` | `str` | `""` | The agent the message is attributed to. Choices are generated at runtime. |
|
||
|
|
| `header` | `str` | `""` | The header of the message |
|
||
|
|
| `message_color` | `str` | `"grey"` | The color of the message. Choices are generated at runtime. |
|
||
|
|
| `meta` | `dict` | `{}` | The meta data of the message |
|
||
|
|
|
||
|
|
## Emit Scene Status
|
||
|
|
|
||
|
|
`event/EmitSceneStatus`
|
||
|
|
|
||
|
|
Emits the scene status object to the UX
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The state input, passed through |
|
||
|
|
|
||
|
|
## Emit Status
|
||
|
|
|
||
|
|
`event/EmitStatus`
|
||
|
|
|
||
|
|
Emits a status message
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `message` | `str` | (optional) The message text to emit |
|
||
|
|
| `status` | `str` | (optional) The status of the message |
|
||
|
|
| `as_scene_message` | `bool` | Whether to emit the message as a scene message (optional) |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `emitted` | `bool` | Whether the message was emitted (True) or not (False) |
|
||
|
|
|
||
|
|
**Properties**
|
||
|
|
|
||
|
|
| Property | Type | Default | Description |
|
||
|
|
| --- | --- | --- | --- |
|
||
|
|
| `message` | `str` | `""` | The message text to emit |
|
||
|
|
| `status` | `str` | `"info"` | The status of the message. Choices are generated at runtime. |
|
||
|
|
| `as_scene_message` | `bool` | `False` | Whether to emit the message as a scene message |
|
||
|
|
|
||
|
|
## Emit Status (Conditional)
|
||
|
|
|
||
|
|
`event/EmitStatusConditional`
|
||
|
|
|
||
|
|
Emits a status message if a condition is met
|
||
|
|
|
||
|
|
Unlike EmitStatus, the `state` input is required, so the message is
|
||
|
|
only emitted when the state input actually receives a value -
|
||
|
|
connect it through a conditional branch to gate the emission.
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
| `message` | `str` | (optional) The message text to emit |
|
||
|
|
| `status` | `str` | (optional) The status of the message |
|
||
|
|
| `as_scene_message` | `bool` | Whether to emit the message as a scene message (optional) |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
| `emitted` | `bool` | Whether the message was emitted (True) or not (False) |
|
||
|
|
|
||
|
|
**Properties**
|
||
|
|
|
||
|
|
| Property | Type | Default | Description |
|
||
|
|
| --- | --- | --- | --- |
|
||
|
|
| `message` | `str` | `""` | The message text to emit |
|
||
|
|
| `status` | `str` | `"info"` | The status of the message. Choices are generated at runtime. |
|
||
|
|
| `as_scene_message` | `bool` | `False` | Whether to emit the message as a scene message |
|
||
|
|
|
||
|
|
## Emit System Message
|
||
|
|
|
||
|
|
`event/EmitSystemMessage`
|
||
|
|
|
||
|
|
Emits a system message
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
| `message_title` | `str` | The title of the message (optional) |
|
||
|
|
| `message` | `str` | (optional) The message text to emit |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | The graph state |
|
||
|
|
|
||
|
|
**Properties**
|
||
|
|
|
||
|
|
| Property | Type | Default | Description |
|
||
|
|
| --- | --- | --- | --- |
|
||
|
|
| `message_title` | `str` | `""` | The title of the message |
|
||
|
|
| `message` | `text` | `""` | The message text to emit |
|
||
|
|
| `font_color` | `str` | `"grey"` | The color of the message. Choices are generated at runtime. |
|
||
|
|
| `icon` | `str` | `"mdi-information"` | The icon of the message |
|
||
|
|
| `display` | `str` | `"text"` | Whether to display the message. Choices are generated at runtime. |
|
||
|
|
| `as_markdown` | `bool` | `False` | Whether to render the message as markdown |
|
||
|
|
|
||
|
|
## Emit World Editor Sync
|
||
|
|
|
||
|
|
`event/EmitWorldEditorSync`
|
||
|
|
|
||
|
|
Sends a world editor sync message which on the UX side
|
||
|
|
will cause the world editor to sync its state with the server
|
||
|
|
|
||
|
|
This is useful when the world editor needs to be updated with the latest state.
|
||
|
|
|
||
|
|
**Inputs**
|
||
|
|
|
||
|
|
| Input | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | |
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `state` | `any` | |
|
||
|
|
|
||
|
|
## Event
|
||
|
|
|
||
|
|
`event/Event`
|
||
|
|
|
||
|
|
Returns the current event object when inside a Listen node module.
|
||
|
|
|
||
|
|
**Outputs**
|
||
|
|
|
||
|
|
| Output | Type | Description |
|
||
|
|
| --- | --- | --- |
|
||
|
|
| `event` | `event` | The current event object |
|