PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Lua Chat System — Client API — ChatBar

Lua Chat System — Client API — ChatBar

Oct 31 2018, 12:08 AM PST 5 min

< Return to Lua Chat System

The ChatBar handles client-side text entry for the Lua Chat System. There are two key components of the ChatBar:

  • ChatBar, a TextBox, where the player inputs messages and commands (highlighted in orange)
  • MessageMode, a TextLabel, which can display information about the message being sent (highlighted in green)

A screenshot of the chat window highlighting the ChatBar TextBox and the MessageMode TextLabel

Methods

GetTextBox

  • Parameters: None
  • Description: Returns the TextBox of the chat bar.
  • Returns: TextBox

GetMessageModeTextLabel

  • Parameters: None
  • Description: Returns the MessageMode TextLabel.
  • Returns: TextLabel

IsFocused

  • Parameters: None
  • Description: Returns whether the chat bar’s TextBox is in focus (player is typing in box). Equivalent to calling TextBox/IsFocused on the result of GetTextBox.
  • Returns: bool

CaptureFocus

  • Parameters: None
  • Description: Forces the client to focus on the TextBox of the chat bar. Equivalent to calling TextBox/CaptureFocus on the rsult of GetTextBox.
  • Returns: void

ReleaseFocus

  • Parameters: bool submitted = false
  • Description: Releases the focus of the chat bar TextBox. If submitted is true, this will behave as if the player pressed Enter to submit the message.
  • Returns: void

ResetText

  • Parameters: None
  • Description: Sets the TextBox/Text|Text of the chat bar TextBox to the empty string.
  • Returns: void

SetTextBoxText

  • Parameters: string text
  • Description: Sets the TextBox/Text|Text of the chat bar TextBox to the given text.
  • Returns: void

GetTextBoxText

  • Parameters: None
  • Description: Returns the text in the chat bar TextBox/Text.
  • Returns: string

SetTextLabelText

  • Parameters: string text
  • Description: Sets the TextLabel/Text|Text of the MessageMode TextLabel to the given text.
  • Returns: void

GetEnabled

  • Parameters: None
  • Description: Returns whether the chat bar is GuiObject/Visible|Visible.
  • Returns: bool

SetEnabled

  • Parameters: bool enabled
  • Description: Sets whether the chat bar is GuiObject/Visible|Visible.
  • Returns: void

SetTextSize

  • Parameters: int textSize
  • Description: Sets the TextLabel/TextSize|TextSize of both the chat bar’s TextBox and MessageMode TextLabel.
  • Returns: void

ResetSize

  • Parameters: None
  • Description: Resets the size of the chat bar to one line of text.
  • Returns: void

SetChannelTarget

  • Parameters: string channelName
  • Description: Sets the target ChatChannelUI given its channelName to which the chat bar should submit messages.
  • Returns: void

FadeOutBackground

  • Parameters: float duration
  • Description: Fades out the background over the given duration in seconds. Note: later calls to control fading in/out will override earlier calls.
  • Returns: void

FadeInBackground

  • Parameters: float duration
  • Description: Fades in the background over the given duration in seconds. Note: later calls to control fading in/out will override earlier calls.
  • Returns: void

FadeOutText

  • Parameters: float duration
  • Description: Fades out the text over the given duration in seconds. Note: later calls to control fading in/out will override earlier calls.
  • Returns: void

FadeInText

  • Parameters: float duration
  • Description: Fades in the text over the given duration in seconds. Note: later calls to control fading in/out will override earlier calls.
  • Returns: void