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[ number ]Get: The id of the effect.
Operations:
| Operation | Description |
|---|---|
GuiInterface == GuiInterface | Checks if two instances of GuiInterface refer to the same GuiInterface. |
Functions
addGridItem
guiInterface:addGridItem( gridName, item )
Client-Only
Adds an item to a grid.
Parameters:
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.
Parameters:
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.
Lists are currently not implemented for custom GUI layouts and do not work.
Parameters:
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.
addToPickupDisplay
guiInterface:addToPickupDisplay( uuid, amount )
Client-Only
Adds a block, part or tool to the item pickup display in the bottom right corner.
This function only works on a Survival HUD GUI!
Parameters:
guiInterface(GuiInterface): The SurvivalHud guiInterface.uuid(Uuid): The uuid of the item that was picked up. Must be a block, part or tool.amount(number): The amount of the item that was picked up.
clearGrid
guiInterface:clearGrid( gridName )
Client-Only
Clears a grid.
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.
clearList
guiInterface:clearList( listName )
Client-Only
Clears a list.
Lists are currently not implemented for custom GUI layouts and do not work.
Parameters:
guiInterface(GuiInterface): The guiInterface.listName(string): The name of the list.
close
guiInterface:close()
Client-Only
Closes the GUI.
Parameters:
guiInterface(GuiInterface): The guiInterface.
createDropDown
guiInterface:createDropDown( widgetName, functionName, options )
Client-Only
Creates a dropdown menu at the specified widget.
The given callback function is also called when setSelectedDropDownItem is used!
The callback receives:
self(table): The class instance.option(string): The option that was selected in the dropdown.
Parameters:
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.
Valid grid types are:
processGridmaterialGriditemGrid
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.data(table): The grid data (see table below).
{
type = string,
layout = string,
itemTop = ???,
itemLeft = ???,
itemWidth = int,
itemHeight = int,
itemCount = int
}
createHorizontalSlider
guiInterface:createHorizontalSlider( widget, range, value, callback, enableNumbers )
Client-Only
Creates a horizontal slider with the specified widget.
The callback receives:
self(table): The class instance.newPos(number): The new position of the slider.
Parameters:
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(boolean): 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.
The callback receives:
self(table): The class instance.newPos(number): The new position of the slider.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.
isActive
guiInterface:isActive()
Client-Only
Returns whether the GUI is currently open.
Parameters:
guiInterface(GuiInterface): The guiInterface.
Returns:
- (boolean): Whether the GUI is open or not.
open
guiInterface:open()
Client-Only
Opens the GUI.
Parameters:
guiInterface(GuiInterface): The guiInterface.
playEffect
guiInterface:playEffect( widget, effect, restart )
Client-Only
Plays an effect at a widget.
Parameters:
guiInterface(GuiInterface): The guiInterface.widget(string): The name of the widget.effect(string): The name of the effect.restart(boolean): 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.
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.index(number): The index of the grid.effectName(string): The name of the effect.restart(boolean): 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.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.button(string): The name of the button widget.state(boolean): The state to set.
setColor
guiInterface:setColor( widget, color )
Client-Only
Sets the color of a widget.
Parameters:
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.
Parameters:
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.
Parameters:
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.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.range(number): The fade range.
setFocus
guiInterface:setFocus( widget )
Client-Only
Sets a widget to receive key focus.
Parameters:
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.
The callback receives:
self(table): The class instance.buttonName(string): The name of the button that was clicked.index(number): The grid index of the button.itemData(table): Data set to the grid item usingsetGridItem.gridName(string): The name of the grid containing the button.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.index(number): 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.
Parameters:
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.
Parameters:
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.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 withsetGridItem.isHoverInto(boolean): 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.
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.size(number): The size.
setHost
guiInterface:setHost( host, bone )
Client-Only
Sets the host for a world gui.
Parameters:
guiInterface(GuiInterface): The guiInterface.host(Shape/Character): The GUI host.bone(string): The animation bone to attach to. Optional.
setIconImage
guiInterface:setIconImage( ItemBox, uuid )
Client-Only
Sets the icon image to a shape from a uuid.
Parameters:
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.
Parameters:
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
Parameters:
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.
Lists are currently not implemented for custom GUI layouts and do not work.
Parameters:
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.
Parameters:
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.
Parameters:
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.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.state(boolean): Whether the GUI requires line of sight or not.
setSelectedDropDownItem
guiInterface:setSelectedDropDownItem( name, item )
Client-Only
Selects an option in a dropdown menu.
Using this function will also trigger the given dropdown's callback function.
If used wrong, this can create an infinite loop!
Parameters:
guiInterface(GuiInterface): The guiInterface.name(string): The name of the dropdown menu's host widget.item(string): The dropdown item to select.
setSelectedListItem
guiInterface:setSelectedListItem( listName, itemName )
Client-Only
Selects an item in a list.
Lists are currently not implemented for custom GUI layouts and do not work.
Parameters:
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.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.sliderName(string): The name of the slider.range(number): The range of the slider.position(number): The position of the slider.
setSliderPosition
guiInterface:setSliderPosition( sliderName, position )
Client-Only
Sets the position of a slider.
Parameters:
guiInterface(GuiInterface): The guiInterface.sliderName(string): The name of the slider.position(number): The position of the slider.
setSliderRange
guiInterface:setSliderRange( sliderName, range )
Client-Only
Sets the range of a slider.
Parameters:
guiInterface(GuiInterface): The guiInterface.sliderName(string): The name of the slider.range(number): The range of the slider.
setSliderRangeLimit
guiInterface:setSliderRangeLimit( sliderName, limit )
Client-Only
Sets the range limit of a slider.
Parameters:
guiInterface(GuiInterface): The guiInterface.sliderName(string): The name of the slider.limit(number): The range limit of the slider.
setText
guiInterface:setText( widget, text )
Client-Only
Sets text on a widget that supports it.
Parameters:
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.
The callback receives:
self(table): The class instance.name(string): The name of the TextBox that the text was entered into.text(string): The text that was submitted.
Parameters:
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.
The callback receives:
self(table): The class instance.name(string): The name of the TextBox that the text was entered into.text(string): The new text in the TextBox.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.widget(string): The name of the widget.state(boolean): Whether the widget is visible or not.
setWorldPosition
guiInterface:setWorldPosition( pos, world )
Client-Only
Sets the world position for a world GUI.
Parameters:
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.
Parameters:
guiInterface(GuiInterface): The guiInterface.widget(string): The name of the widget.effect(string): The name of the effect.immediate(boolean): Whether the effect should stop immediately or not.
stopGridEffect
guiInterface:stopGridEffect( gridName, index, effectName )
Client-Only
Stops an effect playing inside a grid.
Parameters:
guiInterface(GuiInterface): The guiInterface.gridName(string): The name of the grid.index(number): 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.
Parameters:
guiInterface(GuiInterface): The guiInterface.name(string): The name of the quest.title(string): The quest title to be displayed in the tracker.mainQuest(boolean): 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.
{
name = string,
text = string,
count = number,
target = number,
complete = bool
}
untrackQuest
guiInterface:untrackQuest( name )
Client-Only
Removes a quest from the quest tracker.
Parameters:
guiInterface(GuiInterface): The guiInterface.name(string): The name of the quest.