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.
Functions:
- addGridItem
- addGridItemsFromFile
- addListItem
- addToPickupDisplay
- clearGrid
- clearList
- clearOnCloseCallback
- close
- compassAddIcon
- compassPingMarker
- compassRemoveIcon
- compassSetIconHost
- compassSetIconHost
- compassSetIconStacking
- compassSetIconWorldPosition
- createDropDown
- createGridFromJson
- createHorizontalSlider
- createVerticalSlider
- destroy
- getWorldPosition
- isActive
- open
- playEffect
- playGridEffect
- removeFromPickupDisplay
- setButtonCallback
- setButtonEnabled
- setButtonState
- setColor
- setContainer
- setContainers
- setData
- setDressbotUnlockCallback
- setFadeRange
- setFocus
- setGridButtonCallback
- setGridItem
- setGridItemChangedCallback
- setGridItemClickedCallback
- setGridMouseFocusCallback
- setGridSize
- setHost
- setHost
- setIconImage
- setImage
- setItemIcon
- setListSelectionCallback
- setMaxRenderDistance
- setMeshPreview
- setOnCloseCallback
- setOnOpenCallback
- setOpenCloseEffect
- setRequireLineOfSight
- setSelectedDropDownItem
- setSelectedListItem
- setSliderCallback
- setSliderData
- setSliderPosition
- setSliderRange
- setSliderRangeLimit
- setText
- setTextAcceptedCallback
- setTextChangedCallback
- setVisible
- setWidgetState
- setWorldPosition
- stopEffect
- stopGridEffect
- trackQuest
- untrackQuest
Operations:
| Operation | Return type | Description |
|---|---|---|
| GuiInterface == GuiInterface | boolean | Checks if two instances of GuiInterface refer to the same GuiInterface. |
addGridItem(gui, gridName, item)
Client only
Adds an item to a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| table | item | The item |
addGridItemsFromFile(gui, gridName, jsonPath, additionalData?)
Client only
Adds items to a grid from json
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| string | jsonPath | Json file path |
| table | additionalData? | Additional data to the json (Optional) |
addListItem(gui, listName, itemName, data)
Client only
Appends an item to a list
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | listName | The name of the list |
| string | itemName | The name of the item |
| table | data | Table of data to store |
addToPickupDisplay(gui, uuid, amount)
Client only
Adds an item to the item pickup display
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The players survival hud interface |
| Uuid | uuid | The item uuid |
| number | amount | Quantity of items picked up |
clearGrid(gui, gridName)
Client only
Clears a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid to clear |
clearList(gui, listName)
Client only
Clears a list
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | listName | The name of the list |
clearOnCloseCallback(gui)
Client only
Clears the close callback so it will not be called when the gui is closed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
close(gui)
Client only
Close a gui interface
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface to close |
compassAddIcon(compassHud, iconName, image?, showDistance?, width?, height?)
Client only
Add an icon to the compass.
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | compassHud | The compass hud GUI. |
| string | iconName | Name of the new compass icon. |
| string | image? | The name or path of the image. (Optional) |
| string | showDistance? | If the icon should display distance. (Optional) |
| string | width? | The width of the icon, defaults to 22. (Optional) |
| string | height? | The height of the icon, defaults to 22. (Optional) |
compassPingMarker()
Client only
compassRemoveIcon(compassHud, iconName)
Client only
Remove an icon from the compass.
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | compassHud | The compass hud GUI. |
| string | iconName | Name of a compass icon. |
compassSetIconHost(gui, host, joint?)
Client only
Sets a Character as host for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| Character | host | The host of the icon |
| string | joint? | The joint/bone name (Optional) |
compassSetIconHost(compassHud, iconName, host, joint?)
Client only
Sets a Shape as host for a compass icon
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | compassHud | The compass hud GUI. |
| string | iconName | Name of a compass icon. |
| Shape | host | The host of the icon |
| string | joint? | The host joint/bone name (Optional) |
compassSetIconStacking(compassHud, iconName, stacking)
Client only
Sets whether the icon should be stacked on top of other icons.
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | compassHud | The compass hud GUI. |
| string | iconName | Name of a compass icon. |
| boolean | stacking | The stacking setting. |
compassSetIconWorldPosition(compassHud, iconName, worldPosition, world?)
Client only
Sets the world position for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | compassHud | The compass hud GUI. |
| string | iconName | Name of a compass icon. |
| Vec3 | worldPosition | The position to set. |
| World | world? | The world, defaults to same as the script |
createDropDown(gui, widgetName, functionName, options)
Client only
Creates a dropdown at the specified widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| string | functionName | The name of the function |
| table | options | The options in the dropdown menu |
createGridFromJson(gui, gridName, index)
Client only
Creats a grid from a table/json
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| table | index | Grid data table { type=string, layout=string, itemWidth=integer, itemHeight=integer, itemCount=integer } |
createHorizontalSlider(gui, widgetName, range, value, functionName, numbered?, inverted?)
Client only
Creates a slider at the specified widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| number | range | The range of the slider |
| number | value | The start value on the slider |
| string | functionName | Slider change callback function name |
| boolean | numbered? | Enable numbered steps (Defaults to false) |
| boolean | inverted? | Invert slider direction (Defaults to false) |
createVerticalSlider(gui, widgetName, range, value, functionName)
Client only
Creates a slider at the specified widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| number | range | The range of the slider |
| number | value | The start value on the slider |
| string | functionName | Slider change callback function name |
destroy(gui)
Client only
Destroy a gui interface
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The interface to destroy |
getWorldPosition(gui)
Client only
Gets the current world position of a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
Returns:
| Type | Description |
|---|---|
| Vec3 The in world position of the gui |
isActive(gui)
Client only
Checks if a gui interface is active
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
Returns:
| Type | Description |
|---|---|
| boolean | True if gui is active |
open(gui)
Client only
Open a gui interface
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface to open |
playEffect(gui, widgetName, effectName, restart?, useHistory?)
Client only
Plays an effect at a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| string | effectName | The name of the effect |
| boolean | restart? | If the effect should restart if its already playing (Defaults to true) |
| boolean | useHistory? | If the effect should use call history (Defaults to false) |
playGridEffect(gui, gridName, index, effectName, restart?)
Client only
Plays an effect at widget inside a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| integer | index | The index in the grid |
| string | effectName | The name of the effect |
| boolean | restart? | If the effect should restart if its already palying (Defaults to true) |
removeFromPickupDisplay(gui, uuid, amount)
Client only
Removes an item from the item pickup display
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The players survival hud interface |
| Uuid | uuid | The item uuid |
| number | amount | Quantity of items to remove |
setButtonCallback(gui, buttonName, callback)
Client only
Sets a button callback to be called when the button is pressed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | buttonName | The button name |
| string | callback | Function to be called when button is pressed |
setButtonEnabled(gui, widgetName, enabled)
Client only
Sets the enabled state of a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| boolean | enabled | True if the widget should be enabled |
setButtonState(gui, buttonName, state)
Client only
Sets the button state
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | buttonName | The name of the button |
| boolean | state | The state of the button |
setColor(gui, widgetName, Color)
Client only
Sets the color of a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| Color | Color | The color |
setContainer(gui, gridName, container)
Client only
Sets a container to a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| Container | container | The container |
setContainers(gui, gridName, containers)
Client only
Sets multiple containers to a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| table | containers | Table of containers. {Container, ..} |
setData(gui, widgetName, data)
Client only
Sets data to a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| table | data | The data |
setDressbotUnlockCallback(gui, function)
Client only
Sets the Lua callback for when the DressbotGui unlocks something. The callback will receive the uuid of the unlocked customization item.
/
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The DressbotGui interface. |
| string | function | The name function. |
setFadeRange(gui, range)
Client only
Sets the fade range for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| number | range | The fade range |
setFocus(gui, widgetName)
Client only
Sets a widget to receive key focus
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget that needs focus |
setGridButtonCallback(gui, buttonName, callback)
Client only
Sets a callback to be called when a button inside a grid is pressed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | buttonName | The button name |
| string | callback | Function to be called when button is pressed |
setGridItem(gui, gridName, index, item)
Client only
Sets an item in a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| integer | index | The item index |
| table | item | The item |
setGridItemChangedCallback(gui, gridName, callback)
Client only
Sets a callback to be called when a grid item is changed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The grid name |
| string | callback | Function to be called when button is pressed |
setGridItemClickedCallback(gui, gridName, callback)
Client only
Sets a callback to be called when a grid item is changed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The grid name |
| string | callback | Function to be called when button is pressed |
setGridMouseFocusCallback(gui, buttonName, callback)
Client only
Sets a callback to be called when a grid widget gets mouse focus
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | buttonName | The button name |
| string | callback | Function to be called when button is pressed |
setGridSize(gui, gridName, index)
Client only
Sets the size of a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| integer | index | The size |
setHost(gui, character, joint?)
Client only
Sets a Character as host for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| Character | character | The character to host the gui |
| string | joint? | The joint (Optional) |
setHost(gui, shape, joint?)
Client only
Sets a Shape as host for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| Shape | shape | The shape to host the gui |
| string | joint? | The joint (Optional) |
setIconImage(gui, itembox, uuid)
Client only
Sets the icon image to a shape from an uuid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | itembox | The name of the itembox |
| Uuid | uuid | The item uuid |
setImage(gui, imagebox, image)
Client only
Sets the image of an imagebox
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | imagebox | The name of the imagebox widget |
| string | image | The name or path of the image |
setItemIcon(gui, imagebox, itemResource, itemGroup, itemName)
Client only
Sets the resource, group and item name on an imagebox widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | imagebox | The name of the imagebox |
| string | itemResource | The item resource |
| string | itemGroup | The item group |
| string | itemName | The item name |
setListSelectionCallback(gui, listName, callback)
Client only
Sets a callback to be called when a list selection is changed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | listName | The list name |
| string | callback | Function to be called when list is selected |
setMaxRenderDistance(gui, distance)
Client only
Sets the maximum render distance for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| number | distance | The max render distance |
setMeshPreview(gui, widgetName, uuid)
Client only
Sets a mesh preview to display an item from uuid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| Uuid | uuid | The item uuid to display |
setOnCloseCallback(gui, callback)
Client only
Sets a callback to be called when the gui is closed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | callback | Function to be called when gui is closed |
setOnOpenCallback(gui, callback)
Client only
Sets a callback to be called when the gui is opened
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | callback | Function to be called when gui is opened |
setOpenCloseEffect(gui, openEffectName, closEffectName)
Client only
Overwrites default gui effects with specified open and close effects
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | openEffectName | The name of the open effect |
| string | closEffectName | The name of the close effect |
setRequireLineOfSight(gui, required)
Client only
Sets if a world gui requires line of sight to be shown
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| boolean | required | True if gui requires line of sight to render |
setSelectedDropDownItem()
Client only
setSelectedListItem(gui, listName, itemName)
Client only
Selects an item in a list
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | listName | The name of the list |
| string | itemName | The name of the item |
setSliderCallback(gui, sliderName, callback)
Client only
Sets a callback to be called when the slider is moved
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | sliderName | The button name |
| string | callback | Function to be called when slider is moved |
setSliderData(gui, sliderName, range, position)
Client only
Sets the position and range of a slider
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | sliderName | The name of the slider |
| unsigned | range | The slider range |
| unsigned | position | The slider position |
setSliderPosition(gui, sliderName, position)
Client only
Sets the position of a slider
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | sliderName | The name of the slider |
| integer | position | The slider position |
setSliderRange(gui, sliderName, range)
Client only
Sets the slider range of a slider.
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | sliderName | The name of the slider |
| integer | range | The slider range |
setSliderRangeLimit(gui, sliderName, limit)
Client only
Sets the range limit of a slider
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | sliderName | The name of the slider |
| integer | limit | The slider range limit |
setText(gui, textbox, text)
Client only
Sets the text caption of a textbox widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | textbox | The name of the textbox widget |
| string | text | The text |
setTextAcceptedCallback(gui, editBoxName, callback)
Client only
Sets a callback to be called when the text change is accepted
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | editBoxName | The edit box name |
| string | callback | Function to be called when text is committed |
setTextChangedCallback(gui, editBoxName, callback)
Client only
Sets a callback to be called when the text is changed
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | editBoxName | The edit box name |
| string | callback | Function to be called when text is edited |
setVisible(gui, widgetName, visible)
Client only
Sets a widget to be visible or not
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| boolean | visible | True if visible |
setWidgetState(gui, widgetName, state)
Client only
Sets the state of a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| integer | state | The widget state sm.gui.widgetStates |
setWorldPosition(gui, worldPosition, world?)
Client only
Sets the world position for a world gui
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| Vec3 | worldPosition | The position to set. |
| World | world? | The world, defaults to same as the script |
stopEffect(gui, widgetName, effectName, immediate?, useHistory?)
Client only
Stops an effect playing at a widget
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | widgetName | The name of the widget |
| string | effectName | The name of the effect |
| boolean | immediate? | When true, the effect stops immediately (Defaults to false) |
| boolean | useHistory? | If the effect should use call history (Defaults to false) |
stopGridEffect(gui, gridName, index, effectName)
Client only
Stopts an effect playing inside a grid
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The Gui interface |
| string | gridName | The name of the grid |
| integer | index | The index in the grid |
| string | effectName | The name of the effect |
trackQuest(gui, name, title, mainQuest, questTasks, icon?)
Client only
Adds a quest to the quest tracker
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The QuestGui interface |
| string | name | The name of quest |
| string | title | The quest title to be displayed in the tracker |
| boolean | mainQuest | If the quest is a main quest (Displayed on top in the tracker) |
| table | questTasks | The table of quest tasks to display in the log Task{ name = string, text = string, count = number, target = number, complete = boolean } |
| string | icon? | The icon to display in the tracker (Optional) |
untrackQuest(gui, questName)
Client only
Removes a quest from the quest tracker
/
Parameters:
| Type | Name | Description |
|---|---|---|
| GuiInterface | gui | The QuestGui interface |
| string | questName | The name of quest |