Variable tab
The Variable tab is where you create and manage global variables shared across the entire game. One entry corresponds to one variable.
What is a Variable?
In this tool, you can use "variables" to hold values across the entire game, letting you record event progress, player choices, counters, flags, and more.
- Money counter: A numeric counter like "current gold = 1500"
- Flag: A boolean such as "boss defeated = 1, not defeated = 0"
- Stage progress: A progress tracker like "current chapter = 3"
- Player choice: State such as "chosen hero's name" or "chosen difficulty"
A variable's value can be referenced in formulas as {variable_name}, and can be changed during gameplay by variable-assignment events.
Overview
Purpose of this screen
- Register variable names
- Rename variables
- Delete variables
Save location
data/settings/variable.json— stored with variable name as the key
Where it is referenced
- Event tab (variable assignment): Changes the value of a variable
- Event tab (conditional branch): Branches based on a variable's value
- All formulas: Retrieves a variable's value with
{variable_name} - Text special notation: Writing
{variable_name}inside Show Text expands to the variable's value - At game startup:
variable.jsonis loaded into save data
Reserved IDs
Variables have no reserved IDs. All variables can be freely created, renamed, and deleted.
Initial sample
When a new project is created, a sample variable var_1 (value is empty string) is auto-generated (only if variable.json does not exist). Delete it or rename it as needed.
Screen layout
The Variable tab has a two-panel left/right layout (the left pane is not used; the entire screen is extended to the right with two panels inside).
Left panel (variable list)
| Element | Purpose |
|---|---|
| New button | Add a new variable by specifying a name |
| List | Displays all variable names in a vertical column |
Right panel (operations on the selected variable)
| Element | Purpose |
|---|---|
| Variable name (read-only) | Displays the selected variable's name (cannot be edited directly) |
| Rename button | Rename the selected variable |
| Delete button (red text) | Delete the selected variable (confirmation dialog shown) |
Bottom area
| Element | Purpose |
|---|---|
| Save button | Writes the edits to variable.json |
No UI to edit values directly
The Variable tab has no UI for directly editing a variable's value. What you can do here is only "variable name management (create / rename / delete)".
Ways to change a variable's value:
- During gameplay: Place a variable-assignment event on the Event tab
- Set an initial value: Edit
variable.jsondirectly (open with a JSON editor)
Why there is no value-editing UI
Variables are meant to hold "values that change dynamically during gameplay". For example, gold increases/decreases with purchases/sales, and flags change when events are cleared. Since there is little use for setting values statically in the editor, this tab is specialized for registering variable names.
Variable naming rules
Variable names have the following constraints:
- Allowed characters:
_(underscore) /a-z/A-Z/0-9only - Empty strings not allowed
- Hyphens (
-), spaces, Japanese, and symbols are not allowed
Japanese variable names are not supported
Japanese cannot be used in variable names. This is because when referenced as {variable_name} in formulas, the parser cannot recognize the name. Use meaningful alphanumeric names (e.g. gold, boss_defeated, chapter_number).
Duplicate with existing name
If you try to create a new variable with the same name as an existing one, a suffix _2, _3, etc. is automatically appended. For example, creating gold when gold already exists produces gold_2.
Operating the left panel
New
Pressing the New button opens a name input dialog. The new variable is added with the entered name.
Input rules:
- Follow the naming rules (above)
- Empty strings not allowed
- Duplicates are auto-numbered
The initial value just after creation is empty string "". This initial value is written to variable.json, but when a variable-assignment event sets a value during gameplay, that value is retained thereafter (recorded in save data).
List
The list shows all variable names in creation order. Selecting one displays the variable name in the right panel.
Operating the right panel
Rename
Pressing the Rename button opens a rename dialog with the current name as the initial value. Entering a new name and clicking OK renames the variable.
Input rules are the same as for New.
Renaming resets the value (important)
Renaming a variable resets its value to an empty string. This is the intended behavior of this tool.
What specifically happens:
- The value held under the old name (e.g.
gold = 1500) is discarded - A new empty variable is created under the new name (e.g.
money = "") - Since the entire contents of
variable.jsonis loaded into save data at game startup, the old-named value disappears even in existing save data
Workaround if you want to preserve the value:
- Before renaming, copy the old variable's value to a new variable, then delete the old variable
- Or note the old variable's value, and after renaming, set it on the new variable via a variable-assignment event
Delete
Pressing the Delete button displays a confirmation dialog; clicking OK deletes the selected variable.
Caution when deleting
Deleting a variable invalidates all {variable_name} references in formulas and texts. Before deleting, check where the variable is used in events and formulas.
The deleted variable disappears from variable.json. Since variable.json overrides save data at game startup, the variable disappears from existing save data as well.
Save
Pressing the Save button writes all edited variable data to data/settings/variable.json. Changes before saving are held in memory only, and a (*) mark appears in the tab title.
Referencing variables in formulas
Variables registered on this tab can be referenced in all formulas within the tool using the {variable_name} form.
Basic notation
| Notation | Meaning |
|---|---|
{gold} | Value of variable gold |
{boss_defeated} | Value of variable boss_defeated |
{gold} + 100 | Value of variable gold + 100 |
{chapter} >= 3 | True if variable chapter is 3 or more |
Where formulas can be used
Variable references can be used in all of the following formulas:
- Item target-effect formulas (damage, healing amount)
- Class parameter growth formulas
- Enemy action pattern activation probabilities
- State activation probability and parameter variation values
- Attach equipment requirements
- Event conditional branches
- All other formula input fields in the tool
Example usage
| Formula | Meaning |
|---|---|
USER.STR.MAX * {str_bonus} | Damage multiplied by str_bonus variable (manage buff strength as a variable) |
{boss_defeated} >= 1 | True if boss has been defeated (used in event conditional branches) |
{gold} - 500 | Subtract 500 from gold (purchase processing) |
{chapter} == 3 | True when the current chapter is 3 |
Handling of empty-string variables
If a variable's value is empty string (""), it is treated as 0 in formulas. This is a safeguard so the Expression parser does not error out.
For example, for a newly created variable my_counter (value ""), writing {my_counter} + 1 evaluates as 0 + 1 = 1.
Referencing variables in text
Variables can also be referenced as {variable_name} inside text messages (Show Text events).
Example usage
| Text | Displayed result (when the variable value is 1500) |
|---|---|
Current gold: {gold} G | Current gold: 1500 G |
You are in chapter {chapter} | You are in chapter 3 |
Combination with text special notation
Variable references can be combined with text special notation (\n for newline, color change, etc.). See Text special notation for details.
Typical usage flow
Flow 1: Create a gold counter gold
- Press the New button
- Enter the name
goldand click OK goldis added to the list (initial value is empty string"")- Press the Save button
- On the Event tab, place a variable-assignment event like
gold = 100to change the value - Reference as
{gold}in formulas
Flow 2: Create a boss-defeated flag
- Press the New button
- Enter the name
boss_defeatedand click OK - Press the Save button
- At the end of the boss-defeat event, set
boss_defeated = 1via a variable-assignment event - From then on, conditional branches can test
{boss_defeated} >= 1to show lines only after boss defeat
Flow 3: Manage stage progress
- Press the New button
- Enter the name
chapterand click OK - Press the Save button
- In each chapter-clear event, assign
chapter = 1,chapter = 2, ... - In conditional branches, branch logic by
{chapter} == 1,{chapter} == 2, ...
Flow 4: Calculation using multiple variables
- Create variables
base_damage = 10,str_bonus = 5 - Set the item damage formula to
{base_damage} + USER.STR.MAX * {str_bonus} - Change the variable values during gameplay to adjust the damage of all items at once
Flow 5: Avoid the rename pitfall
- Suppose the existing variable
goldholds 500 - Select
goldand press the Rename button - Enter the new name
moneyand click OK - At this point, the value 500 of
goldis lost, andmoneyis newly created as empty string - To preserve 500, run
money = {gold}via a variable-assignment event before renaming, then deletegold
When you want to set an initial value for a variable
Since the Variable tab has no value-editing UI, if you want to set an initial value other than 0, use one of the following:
Method 1: Run a variable-assignment event at game start
In an event that runs at game start, use variable assignment to set the initial value.
Example: gold = 1000 (set gold to 1000 at game start)
Method 2: Edit variable.json directly
Open data/settings/variable.json in a JSON editor and rewrite the variable values directly.
Example:
{
"gold": "1000",
"boss_defeated": "0"
}Caution when editing JSON directly
Values are all recorded as strings (not JSON numbers; wrap in quotes like "1000"). The tool treats variable values as strings and converts them to numbers when needed in formulas.
Breaking the JSON syntax may prevent the tool from starting, so making a backup before editing is recommended.
Related tabs
| Tab | Related content |
|---|---|
| Event tab | Variable-assignment events change variable values; conditional branches reference variables |
| Formula reference | Details of the {variable_name} notation |
| Text special notation | Expansion of {variable_name} inside Show Text |
Notes
Renaming resets the value
Renaming a variable on this tab resets its value to empty string. Since all variables are overridden by variable.json at game startup, the old-named value disappears even in existing save data.
To preserve the value, copy it to another variable before renaming, or set it on the new variable via a variable-assignment event.
Deletion is destructive
Deleting a variable invalidates all {variable_name} references in formulas and texts. Before deleting, check where the variable is used in events and formulas.
Japanese variable names cannot be used
Variable names can only contain _ / a-z / A-Z / 0-9. Japanese, hyphens, spaces, etc. are not allowed. This constraint is to ensure the formula parser can correctly recognize variable names.
All values are kept as strings
Variable values are internally handled as strings. When writing {gold} + 100 in a formula, it is evaluated as a number at computation time. Booleans are also handled as strings like "0" (false) / "1" (true).
Empty-string variables are treated as 0 in formulas
A newly created variable has empty string (""), but when referenced as {variable_name} in a formula, it is treated as 0, so you can compute {new_variable} + 10 = 10.
variable.json is loaded into save data at startup
At game startup, all variable names and initial values in variable.json are loaded into save data. Even if old variable names remain in existing save data, they are overridden by variable.json at startup.
Variables are shared across the entire game
Variables registered here hold a single value shared across the entire game (not per-character). Use the Parameter tab if you need per-character values.
