sm.gui
The gui library contains various utility functions for handling user interfaces.
This library can only be used on the client.
Functions:
sm.gui.chatMessage(message)
Prints text in the chat gui.
Note:
Will not be sent to other players.
Parameters:
Type | Name | Description |
---|---|---|
string | message | The message. |
sm.gui.createAmmunitionContainerGui(destroyOnClose=false)
Client only
Create a ammunition container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createBagIconGui(destroyOnClose=false)
Deprecated:
use createWorldIconGui
Client only
Create a bag icon GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createBatteryContainerGui(destroyOnClose=false)
Client only
Create a battery container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createBeaconIconGui(destroyOnClose=false)
Deprecated:
use createWorldIconGui
Client only
Create a beacon icon GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createChallengeHUDGui(destroyOnClose=false)
Client only
Create a challenge HUD GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createChallengeMessageGui(destroyOnClose=false)
Client only
Create a challenge message HUD GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createCharacterCustomizationGui(destroyOnClose=false)
Client only
Create a character customization GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createChemicalContainerGui(destroyOnClose=false)
Client only
Create a chemical container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createContainerGui(destroyOnClose=false)
Client only
Create a container GUI, for showing two containers.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createCraftBotGui(destroyOnClose=false)
Client only
Create a craft bot GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createDressBotGui(destroyOnClose=false)
Client only
Create a dress bot GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createEngineGui(destroyOnClose=false)
Client only
Create a engine GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createFertilizerContainerGui(destroyOnClose=false)
Client only
Create a fertilizer container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createGasContainerGui(destroyOnClose=false)
Client only
Create a gas container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createGuiFromLayout(layout, destroyOnClose=false, settings=nil)
Client only
Create a GUI from a layout file.
Parameters:
Type | Name | Description |
---|---|---|
string | layout | Path to the layout file |
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
table | settings=nil | Table with bool settings for: isHud, isInteractive, needsCursor |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createHideoutGui(destroyOnClose=false)
Client only
Create a hideout gui GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createLogbookGui(destroyOnClose=false)
Client only
Create a log book GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createMechanicStationGui(destroyOnClose=false)
Client only
Create a mechanical station GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createNameTagGui(destroyOnClose=false)
Client only
Create a name tag GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createQuestTrackerGui(destroyOnClose=false)
Client only
Create a quest tracker GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createSeatGui(destroyOnClose=false)
Client only
Create a seat GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createSeatUpgradeGui(destroyOnClose=false)
Client only
Create a seat upgrade GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createSeedContainerGui(destroyOnClose=false)
Client only
Create a seed container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createSteeringBearingGui(destroyOnClose=false)
Client only
Create a steering bearing upgrade GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createSurvivalHudGui(destroyOnClose=false)
Client only
Create a survival hud GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createWaterContainerGui(destroyOnClose=false)
Client only
Create a water container GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createWaypointIconGui(destroyOnClose=false)
Deprecated:
use createWorldIconGui
Client only
Create a waypoint icon GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createWidget()
Deprecated:
Removed! Does nothing.
sm.gui.createWorkbenchGui(destroyOnClose=false)
Client only
Create a workbench GUI.
Parameters:
Type | Name | Description |
---|---|---|
boolean | destroyOnClose=false | If true the gui is destroyed when closed, otherwise the gui can be reused. |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.createWorldIconGui(width, height, layout=nil, destroyOnClose=nil)
Client only
Create a world icon GUI from a layout file.
Parameters:
Type | Name | Description |
---|---|---|
integer | width | The width. |
integer | height | The height. |
string | layout=nil | Path to the layout file (Defaults to "$GAME_DATA/Gui/Layouts/Hud/Hud_WorldIcon.layout") |
boolean | destroyOnClose=nil | If true the gui is destroyed when closed, otherwise the gui can be reused. (Defaults to false) |
Returns:
Type | Description |
---|---|
GuiInterface | The gui interface to the created gui. |
sm.gui.displayAlertText(text, duration=4)
Client only
Displays an alert message at the top of the screen for a set duration.
Parameters:
Type | Name | Description |
---|---|---|
string | text | The message to be displayed |
number | duration=4 | The time in seconds during which the message is shown. Defaults to 4 seconds |
sm.gui.endFadeToBlack(duration)
Client only
Fades the screen back from a fade to black.
Parameters:
Type | Name | Description |
---|---|---|
number | duration | Animation duration |
sm.gui.exitToMenu()
Client only
Exits the current game and returns to the main menu
Note:
Can only be used in the Challenge Mode
sm.gui.getCurrentLanguage()
Client only
Returns the current users language setting.
Returns:
Type | Description |
---|---|
string | The language setting ex. "English". |
sm.gui.getKeyBinding(action, hyper=false)
Client only
Returns the set binding for an action as a string
Parameters:
Type | Name | Description |
---|---|---|
string | action | The action |
boolean | hyper=false | If the string should contain hyper text |
Returns:
Type | Description |
---|---|
string | The key binding |
sm.gui.getScreenSize()
Client only
Returns the size of the screen.
Returns:
Type | Description |
---|---|
integer,integer | The screen size as width and height. |
sm.gui.hideGui(visible)
Client only
Set gui visibility.
Parameters:
Type | Name | Description |
---|---|---|
boolean | visible | The gui visibility |
sm.gui.setCenterIcon(iconName)
Client only
Set the icon displayed at the center.
Parameters:
Type | Name | Description |
---|---|---|
string | iconName | The icon. |
sm.gui.setCharacterDebugText(character, text, clear=true)
Client only
Set a text for the character that will be displayed above its head.
Parameters:
Type | Name | Description |
---|---|---|
Character | character | The character. |
string | text | The debug text. |
boolean | clear=true | If true the previous text will be overwritten. |
sm.gui.setInteractionText(text1, binding1=nil, text2=nil, binding2=nil, text3=nil)
Client only
Set the binding text displayed at the center.
Parameters:
Type | Name | Description |
---|---|---|
string | text1 | The leftmost segment. |
string | binding1=nil | The left white segment. |
string | text2=nil | The mid or end segment. |
string | binding2=nil | The right white segment. |
string | text3=nil | The rightmost segment. |
sm.gui.setProgressFraction(progress)
Client only
Set the progress fraction filling the circle icon displayed at the center.
Parameters:
Type | Name | Description |
---|---|---|
number | progress | The fraction that determines how much of the circle is filled. |
sm.gui.startFadeToBlack(duration, timeout)
Client only
Fades the screen to black and back after timeout.
Parameters:
Type | Name | Description |
---|---|---|
number | duration | Animation duration |
number | timeout | Seconds until the fade fades back |
sm.gui.ticksToTimeString(ticks)
Client only
Converts ticks to a HH:MM:SS string representation.
Parameters:
Type | Name | Description |
---|---|---|
integer | ticks | Game ticks |
Returns:
Type | Description |
---|---|
string | time Human time formatted string |
sm.gui.translateLocalizationTags(text)
Client only
Translates all localization tags in a text using the current language.
Parameters:
Type | Name | Description |
---|---|---|
string | text | The text containing localization tags |
Returns:
Type | Description |
---|---|
string | The text with translated tags |