Custom GUIs now lets you pass variables as placeholders.
Using Variables
You can pass up to 9 variables to your GUI using placeholders. If you have a GUI named test with an alias you can send variables one of two ways:
Code (Text):
/gui open test var1 var2 var3
/test var1 var2 var3
Each variable is created as a placeholder (up to 9). One value as a string and the other as a player’s display name. If var1 isn’t a valid player then a blank display name will be returned.
Code (Text):
%ecore_gui_test_1% = var1
%ecore_gui_test_1_player% = display name of username var1
You can require specific variables before a GUI will open by adding vars under the info section. Here is an example:
Code (YAML):
info:
vars
:
# Require the first variable
1
:
# Require value to not be blank
required
: true
# Require variable to be a valid player
requiredPlayer
: true
If you’re struggling with how to work with variables there is an example file on the Wiki and listed below. It is for a GUI with an alias of
/test. It requires the first variable to not be blank and be a value player name. Use it by typing
/test <playername>.
Code (YAML):
messages:
noaccess
: '&8➤ &7You do not have permission to load this page'
missingvars
: '&8➤ &7Command is missing
%i%'
# Set page information
info
:
# Title of this page
title
: '
%ecore_gui_test_1_player%'
# Permission needed to open this
permission
: ''
# Size of this page
size
: 27
# Enable / disable navigation bar
nav
: true
# Alias, used to open this GUI directly
# If it conflicts with another alias or command it will not work
alias
:
"test"
# Variable settings for the GUI
vars
:
# Require the first variable
1
:
# Require value to not be blank
required
: true
# Require variable to be a valid player
requiredPlayer
: true
# All of the items on this page
children:
1:
slot
: 0
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 1"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_1%"
- "2
:
%ecore_gui_test_1_player%"
# This can be any command and doesn't have to be an Epic Core command
action
:
# Command the player executes
playerCommand
:
"?"
close
: true
2:
slot
: 1
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 2"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_2%"
- "2
:
%ecore_gui_test_2_player%"
3:
slot
: 2
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 3"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_3%"
- "2
:
%ecore_gui_test_3_player%"
4:
slot
: 3
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 4"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_4%"
- "2
:
%ecore_gui_test_4_player%"
5:
slot
: 4
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 5"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_5%"
- "2
:
%ecore_gui_test_5_player%"
6:
slot
: 5
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 6"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_6%"
- "2
:
%ecore_gui_test_6_player%"
7:
slot
: 6
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 7"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_7%"
- "2
:
%ecore_gui_test_7_player%"
8:
slot
: 7
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 8"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_8%"
- "2
:
%ecore_gui_test_8_player%"
9:
slot
: 8
item:
type
:
"COMMAND_BLOCK"
# Name of the item
name
:
"Variable 9"
# Lore of the item
lore:
- "1
:
%ecore_gui_test_9%"
- "2
:
%ecore_gui_test_9_player%"