Skip to main content

GuiInterface

A userdata object representing a GUI interface.

A GUI interface is an adapter between a script and a GUI.

Can only be used on the client

Values:
  • id [ int ]

    • Get: The id of the effect.
Operations:
OperationDescription
GuiInterface == GuiInterfaceChecks if two instances of GuiInterface refer to the same GuiInterface.

Functions

addGridItem

guiInterface:addGridItem( gridName, item )
Client-Only

Adds an item to a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • item [ table ]: The item.

addGridItemsFromFile

guiInterface:addGridItemsFromFile( gridName, jsonPath, additionalData )
Client-Only

Adds an item to a grid from a JSON file.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • jsonPath [ string ]: The path to the JSON file.
  • additionalData [ table ]: Additional data (optional).

addListItem

guiInterface:addListItem( listName, itemName, data )
Client-Only

Appends an item to a list.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • listName [ string ]: The name of the list.
  • itemName [ string ]: The name of the item.
  • data [ table ]: Table of data to store.

clearGrid

guiInterface:clearGrid( gridName )
Client-Only

Clears a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.

clearList

guiInterface:clearList( listName )
Client-Only

Clears a list.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • listName [ string ]: The name of the list.

close

guiInterface:close()
Client-Only

Closes the GUI.

Arguments:

createDropDown

guiInterface:createDropDown( widgetName, functionName, options )
Client-Only

Creates a dropdown menu at the specified widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widgetName [ string ]: The name of the widget.
  • functionName [ string ]: The name of the callback function.
  • options [ table ]: The options in the dropdown menu.

createGridFromJson

guiInterface:createGridFromJson( gridName, data )
Client-Only

Creates a grid from a table.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • data [ table ]: The grid data (see table below).
Grid Data Table Structure
{
type = string,
layout = string,
itemWidth = int,
itemHeight = int,
itemCount = int
}

createHorizontalSlider

guiInterface:createHorizontalSlider( widget, range, value, callback, enableNumbers )
Client-Only

Creates a horizontal slider with the specified widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • range [ number ]: The slider range.
  • value [ number ]: The slider position.
  • callback [ string ]: The name of the callback function to be called when the user interacts with the slider.
  • enableNumbers [ bool ]: Whether the slider should have numbers on it or not. Defaults to false.

createVerticalSlider

guiInterface:createVerticalSlider( widget, range, value, callback )
Client-Only

Creates a vertical slider with the specified widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • range [ number ]: The slider range.
  • value [ number ]: The slider position.
  • callback [ string ]: The name of the callback function to be called when the user interacts with the slider.

destroy

guiInterface:destroy()
Client-Only

Destroys the guiInterface object.

Arguments:

isActive

guiInterface:isActive()
Client-Only

Returns whether the GUI is currently open.

Arguments:
Returns:
  • [ bool ]: Whether the GUI is open or not.

open

guiInterface:open()
Client-Only

Opens the GUI.

Arguments:

playEffect

guiInterface:playEffect( widget, effect, restart )
Client-Only

Plays an effect at a widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • effect [ string ]: The name of the effect.
  • restart [ bool ]: Whether the effect should restart or not.

playGridEffect

guiInterface:playGridEffect( gridName, index, effectName, restart )
Client-Only

Plays an effect at a widget inside a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • index [ int ]: The index of the grid.
  • effectName [ string ]: The name of the effect.
  • restart [ bool ]: Whether the effect should restart or not.

setButtonCallback

guiInterface:setButtonCallback( button, callback )
Client-Only

Binds a Lua callback to a button widget. The callback is called when the button widget is clicked.

The callback receives:
  • self [ table ]: The class instance.
  • name [ string ]: The name of the button that was clicked.
Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • button [ string ]: The name of the button widget.
  • callback [ string ]: The name of the callback function.

setButtonState

guiInterface:setButtonState( button, state )
Client-Only

Sets the state of a button widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • button [ string ]: The name of the button widget.
  • state [ bool ]: The state to set.

setColor

guiInterface:setColor( widget, color )
Client-Only

Sets the color of a widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • color [ Color ]: The color to set.

setContainer

guiInterface:setContainer( gridName, container )
Client-Only

Sets a container to a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • container [ Container ]: The container.

setContainers

guiInterface:setContainers( gridName, containers )
Client-Only

Sets multiple containers to a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • container [ table ]: The table of containers.

setData

guiInterface:setData( widget, data )
Client-Only

Sets data to a widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • data [ table ]: The data.

setFadeRange

guiInterface:setFadeRange( range )
Client-Only

Sets the fade range for a world GUI.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • range [ number ]: The fade range.

setFocus

guiInterface:setFocus( widget )
Client-Only

Sets a widget to receive key focus.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.

setGridButtonCallback

guiInterface:setGridButtonCallback( buttonName, callback )
Client-Only

Sets a callback to be called when a button inside a grid is pressed

Binds a Lua callback to a button widget inside a grid. The callback is called when the button widget is clicked.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • buttonName [ string ]: The name of the button widget.
  • callback [ string ]: The name of the callback function.

setGridItem

guiInterface:setGridItem( gridName, index, item )
Client-Only

Sets an item in a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • index [ int ]: The item index.
  • item [ table ]: The item.

setGridItemChangedCallback

guiInterface:setGridItemChangedCallback( gridName, callback )
Client-Only

Sets a callback to be called when a grid item is changed.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • callback [ string ]: The name of the callback function.

setGridMouseFocusCallback

guiInterface:setGridMouseFocusCallback(widgetName, callbackName, gridName)
Client-Only

Sets a callback on a widget in a grid, to be called whenever the mouse focus of that widget changes.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widgetName [ string ]: The name of the widget in the grid.
  • callbackName [ string ]: The name of the callback method to call on the script instance that is setting the callback (self).
  • gridName [ string ]: The name of the grid (e.g., the name passed to createGridFromJson). Omitting this argument is equivalent to passing an empty string, but this may result in the callback not working properly.

Note: No errors or warnings are generated if the grid or widget names are incorrect, which can make debugging difficult.

Callback Signature:
callback(self, widgetName, gridIndex, gridItemData, isHoverInto, gridName)
Callback Arguments:
  • self [ table ]: The script instance (self).
  • widgetName [ string ]: The name of the widget whose mouse focus has changed.
  • gridIndex [ int ]: The index of the widget in the grid.
  • gridItemData [ table ]: The data table that was set to the widget with setGridItem.
  • isHoverInto [ bool ]: True if the mouse was moved into the widget, false if it was moved out.
  • gridName [ string ]: The name of the grid containing the widget.

setGridSize

guiInterface:setGridSize( gridName, size )
Client-Only

Sets the size of a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • size [ int ]: The size.

setHost

guiInterface:setHost( widget, host, joint )
Client-Only

Sets the host for a world gui.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • host [ Shape / Character ]: The GUI host.
  • joint [ string ]: The joint (optional).

setIconImage

guiInterface:setIconImage( ItemBox, uuid )
Client-Only

Sets the icon image to a shape from a uuid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • ItemBox [ string ]: The name of the ItemBox widget.
  • uuid [ Uuid ]: The item uuid.

setImage

guiInterface:setImage( ImageBox, image )
Client-Only

Sets the image of an imagebox.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • ImageBox [ string ]: The name of the ImageBox widget.
  • image [ string ]: The path to the image file.

setItemIcon

guiInterface:setItemIcon( ImageBox, itemResource, itemGroup, itemName )
Client-Only

Sets the resource, group and item name on an ImageBox widget

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • ImageBox [ string ]: The name of the ImageBox widget.
  • itemResource [ string ]: The item resource.
  • itemGroup [ string ]: The item group.
  • itemName [ string ]: The item name.

setListSelectionCallback

guiInterface:setListSelectionCallback( listName, callback )
Client-Only

Sets a callback to be called when a list selection is changed.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • listName [ string ]: The name of the list.
  • callback [ string ]: The name of the callback function.

setMaxRenderDistance

guiInterface:setMaxRenderDistance( distance )
Client-Only

Sets the maximum render distance for a world GUI.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • distance [ number ]: The max render distance.

setMeshPreview

guiInterface:setMeshPreview( widgetName, uuid )
Client-Only

Sets a mesh preview to display an item from uuid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widgetName [ string ]: The name of the widget.
  • uuid [ Uuid ]: The uuid of the item to display.

setOnCloseCallback

guiInterface:setOnCloseCallback( callback )
Client-Only

Sets a callback to be called when the GUI is closed.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • callback [ string ]: The name of the callback function.

setRequireLineOfSight

guiInterface:setRequireLineOfSight( state )
Client-Only

Sets if a world GUI requires line of sight to be visible.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • state [ bool ]: Whether the GUI requires line of sight or not.

setSelectedDropDownItem

guiInterface:setSelectedDropDownItem()
Client-Only

[Missing Information]

Arguments:

setSelectedListItem

guiInterface:setSelectedListItem( listName, itemName )
Client-Only

Selects an item in a list.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • listName [ string ]: The name of the list.
  • itemName [ string ]: The name of the item.

setSliderCallback

guiInterface:setSliderCallback( sliderName, callback )
Client-Only

Sets a callback to be called when the slider is moved.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • sliderName [ string ]: The name of the slider.
  • callback [ string ]: The name of the callback function.

setSliderData

guiInterface:setSliderData( sliderName, range, position )
Client-Only

Sets the position and range of a slider.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • sliderName [ string ]: The name of the slider.
  • range [ unsigned_int ]: The range of the slider.
  • position [ unsigned_int ]: The position of the slider.

setSliderPosition

guiInterface:setSliderPosition( sliderName, position )
Client-Only

Sets the position of a slider.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • sliderName [ string ]: The name of the slider.
  • position [ int ]: The position of the slider.

setSliderRange

guiInterface:setSliderRange( sliderName, range )
Client-Only

Sets the range of a slider.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • sliderName [ string ]: The name of the slider.
  • range [ int ]: The range of the slider.

setSliderRangeLimit

guiInterface:setSliderRangeLimit( sliderName, limit )
Client-Only

Sets the range limit of a slider.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • sliderName [ string ]: The name of the slider.
  • limit [ int ]: The range limit of the slider.

setText

guiInterface:setText( widget, text )
Client-Only

Sets text on a widget that supports it.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • text [ string ]: The text to set.

setTextAcceptedCallback

guiInterface:setTextAcceptedCallback( editBoxName, callback )
Client-Only

Sets a callback to be called when a user submits
text into an EditBox widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • editBoxName [ string ]: The name of the EditBox.
  • callback [ string ]: The name of the callback function.

setTextChangedCallback

guiInterface:setTextChangedCallback( editBoxName, callback )
Client-Only

Sets a callback to be called when the text in an EditBox widget changes.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • editBoxName [ string ]: The name of the EditBox.
  • callback [ string ]: The name of the callback function.

setVisible

guiInterface:setVisible( widget, state )
Client-Only

Sets whether a widget is visible or not.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • state [ bool ]: Whether the widget is visible or not.

setWorldPosition

guiInterface:setWorldPosition( pos, world )
Client-Only

Sets the world position for a world GUI.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • pos [ Vec3 ]: The position.
  • world [ World ]: The world, defaults to same as the script.

stopEffect

guiInterface:stopEffect( widget, effect, immediate )
Client-Only

Stops an effect playing at a widget.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • widget [ string ]: The name of the widget.
  • effect [ string ]: The name of the effect.
  • immediate [ bool ]: Whether the effect should stop immediately or not.

stopGridEffect

guiInterface:stopGridEffect( gridName, index, effectName )
Client-Only

Stops an effect playing inside a grid.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • gridName [ string ]: The name of the grid.
  • index [ int ]: The grid index.
  • effect [ string ]: The name of the effect.

trackQuest

guiInterface:trackQuest( name, title, mainQuest, questTasks )
Client-Only

Adds a quest to the quest tracker.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • name [ string ]: The name of the quest.
  • title [ string ]: The quest title to be displayed in the tracker.
  • mainQuest [ bool ]: Whether the quest is a main quest (displayed on top in the tracker) or not.
  • questTasks [ table ]: The table of quest tasks to display in the log task. See structure below.
questTasks Table Structure
{
name = string,
text = string,
count = number,
target = number,
complete = bool
}

untrackQuest

guiInterface:untrackQuest( name )
Client-Only

Removes a quest from the quest tracker.

Arguments:
  • guiInterface [ GuiInterface ]: The guiInterface.
  • name [ string ]: The name of the quest.