Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Label

An label that shows text on the table. Can be placed and modified by players

Hierarchy

  • Label

Index

Methods

destroy

  • destroy(): void

getColor

getFontFileName

  • getFontFileName(): string
  • Return the filename for the custom TrueType font used for the label. Returns an empty string if no custom font is used.

    Returns string

getFontPackage

  • getFontPackage(): string
  • Return the package id for the package containing the TrueType font used for the label. Returns an empty string if no custom font is used.

    Returns string

getId

  • getId(): string

getPlayerSlot

  • getPlayerSlot(): number
  • Return the label's player slot. If no player slot is set, returns -1. If a player slot is set, the label text will be the player's name in that slot, or the slot name if there is no player in the slot.

    Returns number

getPosition

getRotation

getScale

  • getScale(): number

getText

  • getText(): string

isValid

  • isValid(): boolean
  • Return whether the label is valid. A label becomes invalid after it has been destroyed or deleted by a player

    Returns boolean

setColor

  • setColor(color: Color | [r: number, g: number, b: number, a: number]): void
  • Set the label's color

    Parameters

    • color: Color | [r: number, g: number, b: number, a: number]

      The new color

    Returns void

setFont

  • setFont(fontFilename: string, packageId?: string): void
  • Set the TrueType font file used for the label. Place your font files in the "Fonts" folder of your package.

    Parameters

    • fontFilename: string

      The filename of the TTF file to load. Set to empty string to use the standard font.

    • Optional packageId: string

      The id of the package that contains the TTF file (in the Fonts folder). Can usually be empty when used from scripts to use the same package that contains the script file, but you need to explicitly pass refPackageId for the current package or a package id when you use it in a callback. You can find package ids in the manifest.json file in package folders. Usually you won't use this parameter, unless you have a specific reason to load a font from a different package than where the script is located.

    Returns void

setId

  • setId(iD: string): boolean
  • Set the label's unique id. Returns whether the id was changed successfully. Fails if the id is already used by another label.

    Parameters

    • iD: string

    Returns boolean

setPlayerSlot

  • setPlayerSlot(slot: number): void
  • Set the label's player slot. Set to -1 to remove association to a slot. If a player slot is set, the label text will be the player's name in that slot, or the slot name if there is no player in the slot.

    Parameters

    • slot: number

    Returns void

setPosition

  • setPosition(position: Vector | [x: number, y: number, z: number]): void
  • Set the label's position.

    Parameters

    • position: Vector | [x: number, y: number, z: number]

      The new position

    Returns void

setRotation

  • setRotation(rotation: Rotator | [pitch: number, yaw: number, roll: number]): void
  • Set the label's rotation.

    Parameters

    • rotation: Rotator | [pitch: number, yaw: number, roll: number]

      The new rotation

    Returns void

setScale

  • setScale(scale: number): void
  • Set the label's scale.

    Parameters

    • scale: number

      The new scale

    Returns void

setText

  • setText(text: string): void
  • Set the label's text

    Parameters

    • text: string

      The new text

    Returns void