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:

Operations:

OperationReturn typeDescription
GuiInterface == GuiInterfacebooleanChecks if two instances of GuiInterface refer to the same GuiInterface.

addGridItem(gui, gridName, item)

Client only

Adds an item to a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
tableitemThe item

addGridItemsFromFile(gui, gridName, jsonPath, additionalData?)

Client only

Adds items to a grid from json

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
stringjsonPathJson file path
tableadditionalData?Additional data to the json (Optional)

addListItem(gui, listName, itemName, data)

Client only

Appends an item to a list

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringlistNameThe name of the list
stringitemNameThe name of the item
tabledataTable of data to store

addToPickupDisplay(gui, uuid, amount)

Client only

Adds an item to the item pickup display

Parameters:

TypeNameDescription
GuiInterfaceguiThe players survival hud interface
UuiduuidThe item uuid
numberamountQuantity of items picked up

clearGrid(gui, gridName)

Client only

Clears a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid to clear

clearList(gui, listName)

Client only

Clears a list

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringlistNameThe name of the list

clearOnCloseCallback(gui)

Client only

Clears the close callback so it will not be called when the gui is closed

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface

close(gui)

Client only

Close a gui interface

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface to close

compassAddIcon(compassHud, iconName, image?, showDistance?, width?, height?)

Client only

Add an icon to the compass.

Parameters:

TypeNameDescription
GuiInterfacecompassHudThe compass hud GUI.
stringiconNameName of the new compass icon.
stringimage?The name or path of the image. (Optional)
stringshowDistance?If the icon should display distance. (Optional)
stringwidth?The width of the icon, defaults to 22. (Optional)
stringheight?The height of the icon, defaults to 22. (Optional)

compassPingMarker()

Client only


compassRemoveIcon(compassHud, iconName)

Client only

Remove an icon from the compass.

Parameters:

TypeNameDescription
GuiInterfacecompassHudThe compass hud GUI.
stringiconNameName of a compass icon.

compassSetIconHost(gui, host, joint?)

Client only

Sets a Character as host for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
CharacterhostThe host of the icon
stringjoint?The joint/bone name (Optional)

compassSetIconHost(compassHud, iconName, host, joint?)

Client only

Sets a Shape as host for a compass icon

Parameters:

TypeNameDescription
GuiInterfacecompassHudThe compass hud GUI.
stringiconNameName of a compass icon.
ShapehostThe host of the icon
stringjoint?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:

TypeNameDescription
GuiInterfacecompassHudThe compass hud GUI.
stringiconNameName of a compass icon.
booleanstackingThe stacking setting.

compassSetIconWorldPosition(compassHud, iconName, worldPosition, world?)

Client only

Sets the world position for a world gui

Parameters:

TypeNameDescription
GuiInterfacecompassHudThe compass hud GUI.
stringiconNameName of a compass icon.
Vec3worldPositionThe position to set.
Worldworld?The world, defaults to same as the script

createDropDown(gui, widgetName, functionName, options)

Client only

Creates a dropdown at the specified widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
stringfunctionNameThe name of the function
tableoptionsThe options in the dropdown menu

createGridFromJson(gui, gridName, index)

Client only

Creats a grid from a table/json

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
tableindexGrid 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
numberrangeThe range of the slider
numbervalueThe start value on the slider
stringfunctionNameSlider change callback function name
booleannumbered?Enable numbered steps (Defaults to false)
booleaninverted?Invert slider direction (Defaults to false)

createVerticalSlider(gui, widgetName, range, value, functionName)

Client only

Creates a slider at the specified widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
numberrangeThe range of the slider
numbervalueThe start value on the slider
stringfunctionNameSlider change callback function name

destroy(gui)

Client only

Destroy a gui interface

Parameters:

TypeNameDescription
GuiInterfaceguiThe interface to destroy

getWorldPosition(gui)

Client only

Gets the current world position of a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface

Returns:

TypeDescription
Vec3 The in world position of the gui

isActive(gui)

Client only

Checks if a gui interface is active

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface

Returns:

TypeDescription
booleanTrue if gui is active

open(gui)

Client only

Open a gui interface

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface to open

playEffect(gui, widgetName, effectName, restart?, useHistory?)

Client only

Plays an effect at a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
stringeffectNameThe name of the effect
booleanrestart?If the effect should restart if its already playing (Defaults to true)
booleanuseHistory?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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
integerindexThe index in the grid
stringeffectNameThe name of the effect
booleanrestart?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:

TypeNameDescription
GuiInterfaceguiThe players survival hud interface
UuiduuidThe item uuid
numberamountQuantity of items to remove

setButtonCallback(gui, buttonName, callback)

Client only

Sets a button callback to be called when the button is pressed

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringbuttonNameThe button name
stringcallbackFunction to be called when button is pressed

setButtonEnabled(gui, widgetName, enabled)

Client only

Sets the enabled state of a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
booleanenabledTrue if the widget should be enabled

setButtonState(gui, buttonName, state)

Client only

Sets the button state

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringbuttonNameThe name of the button
booleanstateThe state of the button

setColor(gui, widgetName, Color)

Client only

Sets the color of a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
ColorColorThe color

setContainer(gui, gridName, container)

Client only

Sets a container to a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
ContainercontainerThe container

setContainers(gui, gridName, containers)

Client only

Sets multiple containers to a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
tablecontainersTable of containers. {Container, ..}

setData(gui, widgetName, data)

Client only

Sets data to a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
tabledataThe 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:

TypeNameDescription
GuiInterfaceguiThe DressbotGui interface.
stringfunctionThe name function.

setFadeRange(gui, range)

Client only

Sets the fade range for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
numberrangeThe fade range

setFocus(gui, widgetName)

Client only

Sets a widget to receive key focus

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringbuttonNameThe button name
stringcallbackFunction to be called when button is pressed

setGridItem(gui, gridName, index, item)

Client only

Sets an item in a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
integerindexThe item index
tableitemThe item

setGridItemChangedCallback(gui, gridName, callback)

Client only

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

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe grid name
stringcallbackFunction 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe grid name
stringcallbackFunction 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringbuttonNameThe button name
stringcallbackFunction to be called when button is pressed

setGridSize(gui, gridName, index)

Client only

Sets the size of a grid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
integerindexThe size

setHost(gui, character, joint?)

Client only

Sets a Character as host for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
CharactercharacterThe character to host the gui
stringjoint?The joint (Optional)

setHost(gui, shape, joint?)

Client only

Sets a Shape as host for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
ShapeshapeThe shape to host the gui
stringjoint?The joint (Optional)

setIconImage(gui, itembox, uuid)

Client only

Sets the icon image to a shape from an uuid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringitemboxThe name of the itembox
UuiduuidThe item uuid

setImage(gui, imagebox, image)

Client only

Sets the image of an imagebox

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringimageboxThe name of the imagebox widget
stringimageThe 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringimageboxThe name of the imagebox
stringitemResourceThe item resource
stringitemGroupThe item group
stringitemNameThe item name

setListSelectionCallback(gui, listName, callback)

Client only

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

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringlistNameThe list name
stringcallbackFunction to be called when list is selected

setMaxRenderDistance(gui, distance)

Client only

Sets the maximum render distance for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
numberdistanceThe max render distance

setMeshPreview(gui, widgetName, uuid)

Client only

Sets a mesh preview to display an item from uuid

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
UuiduuidThe item uuid to display

setOnCloseCallback(gui, callback)

Client only

Sets a callback to be called when the gui is closed

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringcallbackFunction to be called when gui is closed

setOnOpenCallback(gui, callback)

Client only

Sets a callback to be called when the gui is opened

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringcallbackFunction to be called when gui is opened

setOpenCloseEffect(gui, openEffectName, closEffectName)

Client only

Overwrites default gui effects with specified open and close effects

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringopenEffectNameThe name of the open effect
stringclosEffectNameThe name of the close effect

setRequireLineOfSight(gui, required)

Client only

Sets if a world gui requires line of sight to be shown

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
booleanrequiredTrue if gui requires line of sight to render

setSelectedDropDownItem()

Client only


setSelectedListItem(gui, listName, itemName)

Client only

Selects an item in a list

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringlistNameThe name of the list
stringitemNameThe name of the item

setSliderCallback(gui, sliderName, callback)

Client only

Sets a callback to be called when the slider is moved

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringsliderNameThe button name
stringcallbackFunction to be called when slider is moved

setSliderData(gui, sliderName, range, position)

Client only

Sets the position and range of a slider

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringsliderNameThe name of the slider
unsignedrangeThe slider range
unsignedpositionThe slider position

setSliderPosition(gui, sliderName, position)

Client only

Sets the position of a slider

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringsliderNameThe name of the slider
integerpositionThe slider position

setSliderRange(gui, sliderName, range)

Client only

Sets the slider range of a slider.

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringsliderNameThe name of the slider
integerrangeThe slider range

setSliderRangeLimit(gui, sliderName, limit)

Client only

Sets the range limit of a slider

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringsliderNameThe name of the slider
integerlimitThe slider range limit

setText(gui, textbox, text)

Client only

Sets the text caption of a textbox widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringtextboxThe name of the textbox widget
stringtextThe text

setTextAcceptedCallback(gui, editBoxName, callback)

Client only

Sets a callback to be called when the text change is accepted

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringeditBoxNameThe edit box name
stringcallbackFunction 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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringeditBoxNameThe edit box name
stringcallbackFunction to be called when text is edited

setVisible(gui, widgetName, visible)

Client only

Sets a widget to be visible or not

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
booleanvisibleTrue if visible

setWidgetState(gui, widgetName, state)

Client only

Sets the state of a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
integerstateThe widget state sm.gui.widgetStates

setWorldPosition(gui, worldPosition, world?)

Client only

Sets the world position for a world gui

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
Vec3worldPositionThe position to set.
Worldworld?The world, defaults to same as the script

stopEffect(gui, widgetName, effectName, immediate?, useHistory?)

Client only

Stops an effect playing at a widget

Parameters:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringwidgetNameThe name of the widget
stringeffectNameThe name of the effect
booleanimmediate?When true, the effect stops immediately (Defaults to false)
booleanuseHistory?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:

TypeNameDescription
GuiInterfaceguiThe Gui interface
stringgridNameThe name of the grid
integerindexThe index in the grid
stringeffectNameThe name of the effect

trackQuest(gui, name, title, mainQuest, questTasks, icon?)

Client only

Adds a quest to the quest tracker

Parameters:

TypeNameDescription
GuiInterfaceguiThe QuestGui interface
stringnameThe name of quest
stringtitleThe quest title to be displayed in the tracker
booleanmainQuestIf the quest is a main quest (Displayed on top in the tracker)
tablequestTasksThe table of quest tasks to display in the log Task{ name = string, text = string, count = number, target = number, complete = boolean }
stringicon?The icon to display in the tracker (Optional)

untrackQuest(gui, questName)

Client only

Removes a quest from the quest tracker

/

Parameters:

TypeNameDescription
GuiInterfaceguiThe QuestGui interface
stringquestNameThe name of quest