Skip to main content

GUI

Helper for showing chat messages, alerts, creating translated GUIs, and displaying interactive text.


Functions​

chatMessage​

sm.scrapcomputers.gui:chatMessage( message, ... )

Shows a chat message with language manager applied.

Arguments:

  • message [ string ] The message to send.
  • ... [ any? ] Optional arguments forwarded to the language manager.

alert​

sm.scrapcomputers.gui:alert( message, ... )

Shows an alert with language manager applied. The message is prefixed with the ScrapComputers tag and stays on screen for 5 seconds.

Arguments:

  • message [ string ] The message to alert.
  • ... [ any? ] Additional arguments for the language manager.

createGuiFromLayout​

sm.scrapcomputers.gui:createGuiFromLayout( layout, destroyOnClose, settings )

Creates a GUI from a layout file with translation support.

If you want to directly set text, then call setTextRaw as setText goes through the translation.

Arguments:

Returns:

  • [ GuiInterface ] A translated GUI interface wrapper.

translationsForGUIInterface​

sm.scrapcomputers.gui:translationsForGUIInterface( gui )

Creates a fake GuiInterface that applies translations automatically to certain functions.

Arguments:

  • gui [ GuiInterface ] The GUI to wrap.

Returns:

  • [ GuiInterface ] A wrapped GuiInterface with translation support.

showCustomInteractiveText​

sm.scrapcomputers.gui:showCustomInteractiveText( top, bottom )

Displays custom interactive text on screen with translation, icons, keybind substitution, and color formatting.

  • Supports icon embedding via #[(path)].
  • Supports keybinds via #{(binding)}.
  • Supports color presets via #(ERROR|WARN|SUCCESS).

Arguments:

  • top [ (string|any[])[] ] Top text entries (supports nested tables for translated entries).
  • bottom [ (string|any[])[]? ] Optional bottom text entries.
tip

An empty table ({}) as an entry is allowed and will show as blank space. Handy for spacing out your text.


showInteractTextBasic​

sm.scrapcomputers.gui:showInteractTextBasic( shapeUuid )

Shows the default "Use" interaction text for a shape, using the shape's title. Any [tags] in the title (like [ScrapComputers]) are removed.

This is called for you automatically for components that have a client_onInteract function but no client_canInteract function, so most of the time you don't need to call it yourself.

Arguments:

  • shapeUuid [ Uuid ] The uuid of the shape to get the title from.