See it respond.
The same raylib runtime, compiled to WebAssembly. Load this example, inject MQTT messages and watch its published events.
The browser requires a user action before the scene is loaded. Click Load demo scene first. MQTT is emulated and never leaves this page. Shaders are disabled in the web build; GPIO is hardware-only.
Orchestrates classic adventure-style dialog: intro, up to N visible choices, question/answer playback, conditional choices and idle timeout. Inputs may be visible button elements, keypress elements, GPIO inputs, or a mixture.
Component configuration
| Field | Default | Description |
|---|---|---|
type | required | interactive_dialog |
file | empty | Metadata JSON from media/assets/ |
autoplay | false | Start whenever the containing scene activates |
media_element_id | required | Audio visualizer or video element ID |
choice_input_ids | required | Ordered input IDs mapped to A, B, C… |
cancel_input_id | empty | Input that closes the dialog |
timeout_seconds | 60 | Idle timeout; 0 disables it |
content_font | fallback font | Intro/question/answer TTF |
content_font_size | font_size | Content size |
choice_font | content font | Choice TTF |
choice_font_size | content size | Choice size |
font, font_size | built-in / 28 | Backward-compatible font fallbacks |
line_spacing | 6 | Additional pixels between content lines |
Copy-and-paste scene JSON
{
"type": "interactive_dialog",
"id": "interview_dialog",
"pos": [160, 570],
"size": [1600, 400],
"file": "dialog-example.json",
"autoplay": true,
"media_element_id": "dialog_audio",
"choice_input_ids": [
"choice_a",
"choice_b",
"choice_c",
"choice_d"
],
"cancel_input_id": "dialog_cancel",
"timeout_seconds": 60,
"content_font": "_decterm.ttf",
"content_font_size": 32,
"choice_font": "Technology.ttf",
"choice_font_size": 34,
"line_spacing": 8,
"layer": 2
}Metadata configuration
| Field | Description |
|---|---|
intro_text, intro_audio | Intro display and clip |
options[].id | Stable option ID used by conditions |
label | Choice-menu label |
question, answer | Displayed content |
question_audio, answer_audio | Separate clips |
audio | One combined question+answer clip |
important | Required before automatic completion |
repeatable | Keep option available after asking |
show_after | Show only after all listed IDs were asked |
hide_after | Hide after any listed ID was asked |
question_audio without answer_audio is treated as one combined clip.
{
"intro_text": "Choose a question.",
"intro_audio": "intro.wav",
"options": [
{
"id": "A1",
"label": "Where were you last night?",
"question": "Where were you last night?",
"answer": "I was at home.",
"audio": "a1_combined.mp3",
"important": true,
"repeatable": false,
"show_after": [],
"hide_after": []
}
]
}MQTT
ergs/rpi01/cmd/interview_dialog/open dialog-example.json
ergs/rpi01/cmd/interview_dialog/file dialog-example.json
ergs/rpi01/cmd/interview_dialog/play ON
ergs/rpi01/cmd/interview_dialog/play OFF
ergs/rpi01/cmd/interview_dialog/close 1open/file load metadata and start immediately. The dialog also stops on cancel, timeout, no remaining options, all important options asked, or scene deactivation.