Variables
Variables are a powerful Developer-tier feature that allow you to store, manipulate, and display dynamic data anywhere in your launcher. They act as a global memory bank for your runtime environment.
What is a Global Variable?
In Game Launcher Creator, a variable is a custom piece of data—like a player's username, a high score, a download URL, or a JSON response—that is saved in the background of your launcher.
Because they are global, a variable you create on Page 1 can be accessed, read, or modified on Page 5. They can hold default numbers or strings, and they can be continually updated by the user or by backend processes while the launcher is running.
Developer Exclusive: The Global Variables system is strictly available to users on the Developer Tier, unlocking advanced programmatic control over the launcher's behavior.
The Universal Syntax
The true power of GLC Variables is that the runtime engine will process them ANYWHERE in the editor. You can use them inside button text, image URLs, webview links, query strings, and more.
To tell the engine to display a variable, wrap the variable's exact name in the following format:
For example, if you have a variable named player_level, you can set a Label object's text to:
"Current Level: %-%player_level%-%". When the launcher runs, it will automatically swap out the tag with the actual stored value.
Creating and Managing Variables
Setting up your initial variables is done directly inside the GLC Editor.
- Click the Variables button (database icon) in the top editor toolbar.
- Click Add Variable.
- Variable Key (Name): Give your variable a unique name (e.g.,
auth_tokenorusername). Spaces will automatically be converted to underscores. - Default Value: Enter the starting value. This can be left blank, or you can enter a default string or number (e.g.,
Guestor0). - Click Save.
Inside the Variables dialog, you can click on the generated syntax hint below your variable name to instantly copy the %-%tag%-% to your clipboard!
Why are Variables so Powerful?
While basic launchers are static, variables bridge the gap between design and dynamic data. Here are a few advanced ways developers utilize variables:
- Launcher Login Plugin: When a user logs in, the plugin can automatically save their data to variables. You can then use
%-%user_avatar%-%as an Image Object source, or%-%username%-%to display a personalized "Welcome back!" message. - Parsing JSON APIs: If your launcher fetches data from your website or server (like server status, player counts, or patch notes), you can map the JSON responses directly into your variables.
- Holding Valuable State Data: Variables can be updated via Events and Actions at runtime. You can build complex logic, like requiring a user to click a specific sequence of buttons, tracking their progress by updating a variable, and only showing the "Play" button when the variable reaches a certain value.
- Dynamic Webviews: Pass variables directly into URLs. For example, setting a Webview URL to
https://yourwebsite.com/profile?user=%-%username%-%.
Note on Naming: Always ensure your variable names are unique. If you name a variable the same as an internal system function, or duplicate a name, the runtime will overwrite the data with the most recent value.
Summary
Variables transform your launcher from a simple menu into a fully-fledged, data-driven application. By defining variables in the editor and using the %-%variable_name%-% tag across your objects, you can build deeply integrated, personalized, and highly dynamic user experiences.