Variables
A Variable remembers a value under a name: a member's XP, a counter, a cooldown, the channel picked for announcements. A value to remember is a Variable.
Three scopes
| Scope | One value… | Example |
|---|---|---|
| Server | for the whole server | the announcement channel picked with /setup |
| Per member | for each member | each member's XP, going up with every message |
| Temporary | for the execution | a level computed from XP, reused in several messages |
A server or member value stays stored until a Blueprint clears it, and shows on the server's Variables page, with the View the Variables permission (Edit the Variables to correct it). A temporary Variable disappears when the execution ends.
Creating a Variable
In a Variables node, pick the scope, then type a new name: the Variable is created. Give it:
- a type: Number, Text, Yes/No, Date, Member, Channel or Role;
- a starting value: what it holds until someone sets it, or once it's cleared (0 for XP);
- for a server or member Variable, resets after…: after this delay, the value goes back to its starting value. A one-hour cooldown, a weekly counter. With extend on each use, the delay restarts on every read or write.
These settings apply to the whole Variable, in every node of the Blueprint. Another Blueprint of the server can use the same Variable: the editor offers its settings. Both must give it the same type.
A Member Variable only stores a member from Discord (whoever triggered the Event, a "user" option), never a text: read back later, it can safely be checked with "has the role".
The five nodes
| Node | Does |
|---|---|
| Set a Variable | Gives it a value. With Only if it holds a value, only writes a Variable already set: otherwise nothing is written, without failing, and the Written output is no. |
| Add to a Variable / Subtract from a Variable | Adds or subtracts a number, losing nothing even when several messages arrive at once. |
| Read a Variable | Reads the value of a server or member Variable, to reuse it further on. |
| Clear a Variable | Puts it back to its starting value. |
For a per member Variable, the Member field picks whose: empty, it's whoever triggered the Event.
Reusing a value
- A server or member Variable is reused through the output of the node that read or wrote it: "Read xp ▸ Value". A Member, Channel or Role Variable gives the whole record (its name, its roles…).
- A temporary Variable reads anywhere after the node that set it: "Temporary ▸ level", written
{{ temp.level }}. Setting a temporary Variable with a formula works as a calculation:{{ floor(actions.xp.value / 100) }}.
A computed name
A server or member Variable's name can hold a computed part: ticket_owner:{{ events.<id>.channel.id }} remembers each ticket's author, one value per channel. The computed part may only give letters, digits, _, : and -.
Limits
A value is at most 64 KB, and a server's Variables 50 MB in all. The Variables page shows the space used.
The Variables page
It shows what your Blueprints remembered, in two tabs:
- Members: a table, one row per member with a value, one column per member Variable. Search a member by name, sort by a column (an XP ranking); a value never written shows in grey, as the starting value. A column's
⋯menu sorts it or opens the Blueprint declaring it. - Server: a search through the names and values, then each server Variable, its type, the Blueprints using it and its value; a Variable with a computed name shows its three latest values; Show all opens every one, 25 per page, with a search through their names and values.
The page is read-only. Switch to edit mode (with the Edit the Variables permission) first explains what it changes, then makes the values editable: each correction applies at once, online Blueprints included, and goes to the server's log with the old and new value. A member's bin clears their values; Clear the values, in a column's menu or under a server Variable, clears all of a Variable's: everyone starts over from its starting value. Done goes back to reading.
A Variable no Blueprint uses anymore is marked no longer used: the editor drops its declaration once no node names it, and the online Blueprint keeps it until the next deploy. Its values stay stored; Delete the Variable clears them and it leaves the page.