Skip to content

Global GUIs

Patrick Miller edited this page Jul 17, 2026 · 1 revision

A global GUI is one that persists through the life of the server. That is, it is only lost once the server restarts.

Creating a Global GUI

A global GUI is identified by a unique identifier (text) that can be specified during the creation of a GUI. Consider the example below of a small server-wide GUI game:

on script load:
	set {-gui_boss_damage} to 0
	create a gui with id "game-boss fight" with a virtual dispenser inventory named "Boss Fight: Zombie":
		make gui slot 4 with a zombie head named "<red>Total Damage: 0":
			add a random integer between 1 and 5 to {-gui_boss_damage}
			set the name of the gui clicked item to "<red>Total Damage: %{-gui_boss_damage}%"

The with id "boss fight" is the crucial part here. Any text is fine, just be sure to keep it unique.

Accessing a Global GUI

If we want to make this game available, we need to expose it for users. The gui with id expression can be used to obtain any GUI by its ID:

[the] gui[s] [with [the] id[entifier][s]] %strings%

We can create a simple command that displays the boss fight GUI to the player:

command /bossfight:
	trigger:
		open the gui with the id "game-boss fight" for the player

Obtaining the ID of a Global GUI

It is also possible to obtain and modify the ID of a GUI, using the id of gui expression:

[the] [gui] id[entifier][s] of %guis%
%guis%'[s] [gui] id[entifier][s]

Accessing All Global GUIs

All existing global GUIs can be obtained through the all global guis expression:

[all [[of] the]|the] global guis

For example, we could use this expression to dynamically create a GUI to display the available GUI games:

command /games:
	trigger:
		create a gui with a virtual hopper inventory named "GUI Games":
			loop all global guis:
				if the id of the loop-gui starts with "game":
					set {_id} to the id of the loop-gui
					set {_name} to the last (length of {_id} - 5) characters of {_id} # remove "game-"
					set {_name} to {_name} in proper case
					make the next gui slot with a diamond sword named "<red>%{_name}%":
						open the gui with the id {_id} for the player
		open the last created gui for the player 
image

Clone this wiki locally