Add Button
Category: Message
Event content that adds a single button at an arbitrary position on the screen. Whereas Add Choice is for menus inside a selection window, this event content creates buttons placed freely on the screen.
Difference from Add Choice
| Item | Add Choice | Add Button (this event content) |
|---|---|---|
| Purpose | Menu inside a selection window | Button placed freely on the screen |
| Placement | Lined up vertically in the selection window | Any position / any size |
| Behavior on add | Internal data only, not shown on screen | Button is generated immediately (but hidden) |
| Display | Shown all at once via Show Selection Window | Shown all at once via Show Buttons |
| Focus movement | next/previous in insertion order | Position-based (auto-calculated from layout) |
Use in pair with Show Buttons
When this event content runs, the button is generated but remains hidden (visible=false). To actually display it on screen, after lining up as many Add Buttons as needed, run Show Buttons.
Typical usage:
- Add Button (number 0, text
Yes) - Add Button (number 1, text
No) - Show Buttons <- the buttons appear on screen only here
Property List
| Item (tscn label) | Input type | Description |
|---|---|---|
| Button | Selection | Button design ID (selected from button_data in the UI tab) |
| Number | Number (0-100) | Button number (for identification, can overwrite with the same number) |
| Text | Text | Text displayed on the button (special notation supported) |
| Size x / y | Number (px) | Button size |
| Position x / y | Number (px) | Display position of the button (coordinates with the top-left of the screen as 0,0) |
| Screen Center buttons x 2 | - | Automatically set Position x / y to screen center |
| Event | Selection | Event to transition to on click (empty allowed) |
| Label | Text | Label name within the destination event (if empty, starts from the beginning) |
| Preview button | - | Preview the button on screen with the current settings |
| Text Help button | - | Open the special notation reference |
Property Details
Button
Select the button design from button_data defined in the UI tab.
- Options: automatically enumerated from all button designs created in the UI tab
- The button appearance (theme, font, color) follows the design specified here
- Cannot be empty (some button_data must always be specified)
Preset auto-apply (added 2026-09-17)
When you select a button, the presets (size, position) set on that button design are automatically reflected in this event content's size and position fields. Useful as initial values before manual adjustment.
Number
A number for identifying the button (integer 0-100, step 1).
- Specifying the same number overwrites: If you Add Button with the same number as an existing button, the existing button is replaced
- Also affects draw order (Z-order): The larger the number, the more frontmost it is displayed (same mechanism as Show Window)
- When placing multiple buttons, if they do not overlap, 0, 1, 2, ... is fine. If they overlap, give the button you want in front a larger number
Text
The text displayed on the button.
- Special notation supported: Variable expansion (
{var}), name expansion ({@char.MEM_0}), line break ([LF]), color change, and other special notations are available - Translation target: When localizing in the Translation tab, it is automatically extracted as a translation key
- Added 2026-10-01: Formula reference expansion and smart_number formatting also apply (unified with Show Text)
Examples: Yes, No, Attack, Gold {gold} G
Size x / y (Size x, Size y)
Specify the width and height of the button in pixels.
- Input fields are lined up horizontally with two slots: left is x (width), right is y (height)
- Unit is pixel (px)
- Empty or invalid values are treated as 0
Example: 200 x 60 -> a button 200px wide x 60px tall
Position x / y (Position x, Position y)
Specify the screen coordinates where the button is placed, in pixels.
- Origin: The top-left of the screen is (0, 0), x is rightward, y is downward
- Input fields are split into two rows, each with "number input + screen center button"
- "Screen Center" button: When pressed, auto-calculates the position so the button is at screen center and fills the input field
- x-side calculation:
(screen width - size x) / 2 - y-side calculation:
(screen height - size y) / 2 - If you change the size later, you need to press it again
- x-side calculation:
Example: With size 200 x 60 and position x=540, y=330 -> roughly centered on a 1280x720 screen
Event
Specify the event to transition to when the button is clicked.
- Options: automatically enumerated from all
.jsonfilenames indata/settings/events/ - Empty allowed: if no event is specified, continues within the current event (proceeds to the next event content)
Event transition behavior
When Event is specified, after a click, processing equivalent to "Move To Event" is performed. The destination event starts a new flow.
When Event is empty, after a click, processing continues within the current event (typically combined with Conditional Branch to write different processing for each button result).
Label
Specify the label name within the destination event.
- Empty: executes from the beginning of the destination event
- Value specified: starts execution from
Set Label (<label name>)within the destination event
Label is meaningless when Event is empty
When Event is empty, no transition occurs even if Label is specified, so the Label specification is meaningless.
Preview button
Pressing the button previews the button on screen with the current settings. You can visually confirm placement and size.
Text Help button
Pressing the button opens the special notation reference window. For details, see Text Special Notation Reference.
Runtime Behavior
When this event content runs, processing happens in the following order:
1. Formula reference expansion (added 2026-10-01)
Formula references within the text (such as USER.STR.MAX) are expanded to actual values. Furthermore, via smart_number processing, numbers with 0 after the decimal point (100.0) are displayed as integers like "100". This is the same processing as Show Text / Add Choice.
2. Button data save and immediate generation
- Internal button data (button_data) gets 1 entry added or updated
- button (design ID), number, text (post-expansion text), size x/y, position x/y, event, label
- Button node is generated immediately (inherits the design of the specified UI tab)
- Waits with visible=false (hidden)
- Z-order (z_index) = number is set (larger number is more frontmost)
- Automatically proceeds to the next event content (no wait)
When subsequent Show Buttons runs, all buttons added up to that point become visible=true and are displayed on screen.
3. Automatic focus movement setup (at Show Buttons time)
When Show Buttons runs, the following is set automatically:
- Position-based focus movement: From the coordinates of the placed buttons, the nearest buttons in up/down/left/right directions are automatically selected and set as keyboard/gamepad focus movement (up/down/left/right)
- Whereas Add Choice is insertion order next/previous, this event content is position-based up/down/left/right
Focus movement depends on layout
Focus movement in this event content is auto-calculated from on-screen placement, so keyboard/gamepad navigation behavior changes based on where you place the buttons. Diagonal placement or extremely distant placement may result in unintended focus movement.
Placement aligned on the same row or same column is recommended.
4. Behavior on click
When a button is clicked, the following processing occurs:
- The decision sound (system's
sound_decide) is played - Both event / label empty: continues within the current event (proceeds to the next event content)
- Either event or label present: transitions to the specified event / label
- In either case, all internal button data is cleared, so to redisplay buttons, you need to line up Add Buttons again from scratch
Typical Usage Flows
Flow 1: 2-choice buttons at screen center
- Show Text (number 0) <- "Do you really want to fight?"
- Add Button (number 0, text
Yes, size 200x60, position 400, 350, eventbattle_scene) - Add Button (number 1, text
No, size 200x60, position 680, 350, event empty) - Show Buttons <- the buttons appear on screen only here
- (When "No" is selected, comes here) Show Text <- "Escaped"
Flow 2: 4 buttons at the four screen corners
- Add Button (number 0, text
Top-left, position 100, 100) - Add Button (number 1, text
Top-right, position 1000, 100) - Add Button (number 2, text
Bottom-left, position 100, 600) - Add Button (number 3, text
Bottom-right, position 1000, 600) - Show Buttons
Since they are placed at the four corners, focus moves naturally with the keyboard up/down/left/right.
Flow 3: Center placement using the Screen Center button
- Add Button
- Enter size x: 300, size y: 80
- Press the "Screen Center" button for position x -> the calculated value is auto-entered
- Press the "Screen Center" button for position y -> the calculated value is auto-entered
- Show Buttons
Flow 4: Overwrite with the same number
Change the button text according to game progress:
- Add Button (number 0, text
Start) - Show Buttons
- (After user operation)
- Add Button (number 0, text
Continue) <- overwrite with the same number - Show Buttons
Flow 5: Dynamic with variables and formula references
- Add Button (number 0, text
Buy with {gold} G in hand, eventbuy) - Add Button (number 1, text
Challenge at Level MEM_0.LEVEL.NOW, eventchallenge)
Using variable expansion and formula references, you can display text that adapts to runtime conditions.
Typical Combinations
This event content is always used in pair with Show Buttons. By itself, no button appears on the screen. For the big picture, see Combination Pattern Collection.
Basic free-placement button group
Question -> Add Button x N -> Show Buttons -> Transition.
- Show Window (number 0)
- Show Text (number 0) <- "Which one will you choose?"
- Add Button (this event content) (number 0, text
A, position 400, 350) - Add Button (this event content) (number 1, text
B, position 680, 350) - Show Buttons <- the buttons appear on screen here
- (Transitions on button click)
Show a new button group after resetting existing buttons
Use different button sets within the same event:
- Add Button (this event content) x N
- Show Buttons
- (After operation)
- Reset Buttons <- delete buttons in bulk
- Add Button (this event content) x M <- new button group
- Show Buttons
Button set inside a window
Combining windows and buttons for a menu-screen look:
- Show Window (number 0, size 600x400, position 340, 160)
- Add Button (this event content) (number 1, text
Equip, position 400, 250) - Add Button (this event content) (number 1, text
Items, position 600, 250) - Add Button (this event content) (number 1, text
Back, position 800, 250) - Show Buttons
By making the button's number (1) larger than the window's number (0), the buttons are displayed in front of the window.
Related Event Contents
| Related event content | Purpose |
|---|---|
| Show Buttons | Display the added buttons on screen (always used in pair) |
| Reset Buttons | Delete all added buttons in bulk |
| Add Choice | Add a choice for the selection window (contrasted with this event content) |
| Show Window | Place a window as the background for buttons |
| Hide All Windows | Erase only background windows in bulk (buttons must be erased separately with Reset Buttons) |
| Set Label | Define a label within the destination event |
| Move To Event | Event transition without using buttons |
Related Pages
| Page | Related content |
|---|---|
| Text Special Notation Reference | Special notations usable within text |
| UI tab | Reference for the Button property (button design definitions) |
| Event tab | Reference for the Event property |
| Variable tab | For {variable name} expansion within button text |
| Event Content List | List of all event contents |
Notes
Add Button alone does not display on screen
When this event content runs, the button node is generated, but remains hidden (visible=false). Always run Show Buttons afterward.
Same number overwrites
Adding Add Button with the same number replaces the existing button. To avoid unintended overwrites, offset numbers when placing multiple buttons (0, 1, 2, ...).
Z-order follows number
The larger the number, the more frontmost it is displayed. For overlapping placement, adjust numbers to achieve the intended front/back relationship (same mechanism as Show Window).
Focus movement is position-based
The target of up/down/left/right focus movement on keyboard/gamepad is auto-selected from placement. The behavior differs from Add Choice's insertion-order next/previous. Diagonal or extremely distant placement may result in unintended focus movement, so aligned placement on the same row/column is recommended.
All internal data cleared after click
When a button is clicked, not only the clicked button but all button data is internally cleared. If you want to show the same button again after a click, you need to line up Add Buttons again.
Press Screen Center buttons after entering size
The "Screen Center" button calculates the position using the size x / y at the time of input. If you change the size afterward, press "Screen Center" again.
When Event is empty, handle with Conditional Branch
When Event is empty, after a click processing continues within the current event. In this case, you need to determine which button was pressed with a subsequent Conditional Branch.
Text special notation and translation
Button text can be localized in the Translation tab. For details, see Translation tab.
