Skip to content

Player Instance

Player instances can be retrieved from the Player Manager and are also frequently passed to callbacks.

Member Variables

Variable Type Description
admin If the player is promoted or the host of the game. Read only.
blindfolded If the player is blindfolded.
color The player's Player Color. Read only.
host If the player is the host. Read only.
lift_height The lift height for the player. This is how far an object is raised when held in a player's hand. Value is ranged 0 to 1.
If the current player is promoted.
seated If a player is currently seated at this color. Read only.
steam_id The Steam ID of the player. This is unique to each player's Steam account. Read only.
steam_name The Steam name of the player. Read only.
team The team of the player.
Options: "None", "Clubs", "Diamonds", "Hearts", "Spades", "Jokers".

Function Summary

Function Name Return Description  
attachCameraToObject( parameters) Makes a Player's camera follow an Object.
broadcast( message, message_color) Print message on Player's screen and their game chat log.
changeColor( player_color) Changes player to this Player Color.
clearSelectedObjects()
clearSelectedObjects()
Clears a player's current selection.
copy( objects) Makes the Player take the Copy action with the specified Objects.
getHandCount()
getHandCount()
Number of hand zones owned by this color.
getHandObjects( hand_index) Objects that are in this hand zone.
getHandTransform( hand_index) Returns a Table of data on this hand zone.
getHoldingObjects()
getHoldingObjects()
Objects a Player is holding in their hand.
getHoverObject()
getHoverObject()
Object that the Player's pointer is hovering over.
getPointerPosition()
getPointerPosition()
Player's pointer coordinates.
getPointerRotation()
getPointerRotation()
Player's pointer rotation on Y axis.
getSelectedObjects()
getSelectedObjects()
Objects that the Player has selected with an area selection.
kick()
kick()
Kicks Player out of the room.
lookAt( parameters) Moves a Player's camera, forcing 3'rd person camera mode.
mute()
mute()
Mutes or unmutes Player, preventing/allowing voice chat.
paste( position) Makes the Player take the Paste action at the specified position
pingTable(
pingTable(...)
position)
Emulates the player using the ping tool at the given position (tapping Tab).
print( message, message_color) Prints a message into the Player's game chat.
promote()
promote()
Promotes/demotes a Player. Promoted players have access to most host privileges.
setCameraMode( camera_mode) Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown".
setHandTransform( parameters, hand_index) Sets transform elements of a hand zone.
setUITheme( theme) Sets the UI theme for the player.
showInfoDialog( info) Displays info string to player in the message box dialog.
showConfirmDialog( info, callback) Displays info string to player in the message box dialog, and executes callback if they click OK.
showInputDialog( description, default_text, callback) Shows the text input dialog to the player, and executes callback if they click OK.
showMemoDialog( description, default_text, callback) Shows the memo input dialog (large text input) to the player, and executes callback if they click OK.
showOptionsDialog( description, options, default_value, callback) Shows the dropdown options dialog to the player, and executes callback if they click OK.
showColorDialog( default_color, callback) Shows the color picker dialog to the player with optional default_color, and executes callback if they click OK.

Function Details

attachCameraToObject(...)

Makes a Player's camera follow an Object.

attachCameraToObject(parameters)

  • parameters: A Table with parameters which guide the function.
    • parameters.object: The Object to attach the camera to.
    • parameters.offset: A Vector to offset the camera by.
      • Optional, defaults to {x=0, y=0, z=0}.
self.attachCameraToObject({object=self})

broadcast(...)

Print message on Player's screen and their game chat log.

broadcast(message, message_color)

  • message: The message to be displayed.
  • message_color: Tint of the message text.
    • Optional, defaults to {r=1, g=1, b=1}.

changeColor(...)

Changes player to this Player Color (seat).

changeColor(player_color)

  • player_color: The Player Color seat to move the Player to.
Player["White"].changeColor("Red")

copy(...)

Makes the Player take the Copy action with the specified Objects.

copy(objects)

  • objects: A Table of Objects.
Player.Green.copy({the_dice, the_deck})

getHandObjects(...)

Returns a Table of Objects that are in this hand zone.

getHandObjects(hand_index)

  • hand_index: An index, representing which hand zone to return Objects for.
    • Optional, defaults to 1.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.


getHandTransform(...)

Returns a Table of data on this hand zone.

getHandTransform(hand_index)

  • hand_index: An index, representing which hand zone to return data on.
    • Optional, defaults to 1.

Return Data Table

  • data: The Table the data is returned in.
    • data.position: Position of the hand zone.
    • data.rotation: Rotation of the hand zone.
    • data.scale: Scale of the hand zone.
    • data.forward: Forward direction of the hand zone.
    • data.right: Right direction of the hand zone.
    • data.up: Up direction of the hand zone.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.


lookAt(...)

Moves a Player's camera, forcing 3'rd person camera mode.

lookAt(parameters)

  • parameters: A Table of controlling parameters to point the player camera.
    • parameters.position: Position to center the camera on.
    • parameters.pitch: Pitch angle of the camera. 0 to 90.
      • Optional, defaults to 0.
    • parameters.yaw: Yaw angle of the camera. 0 to 360.
      • Optional, defaults to 0.
    • parameters.distance: Distance the camera is from the position Vector.
      • Optional, defaults to 40.
-- Assuming someone is in the White seat
Player["White"].lookAt({
    position = {x=0,y=0,z=0},
    pitch    = 25,
    yaw      = 180,
    distance = 20,
})

paste(...)

Makes the Player take the Paste action at the specified position.

paste(position)

  • position: The position to paste at.
Player.Green.paste({0, 1, 0})

print(...)

Prints a message into the Player's game chat.

print(message, message_color)

  • message: The text to be displayed.
  • message_color: Color for the message text to be tinted.
    • Optional, defaults to {r=1, g=1, b=1}.

setCameraMode(...)

Sets the player's camera mode. Camera modes available: "ThirdPerson", "FirstPerson", "TopDown".

changeColor(camera_mode)

  • camera_mode: The Camera Mode to set the Player's Camera to.
Player["White"].setCameraMode("FirstPerson")

setHandTransform(...)

Sets transform elements of a hand zone.

setHandTransform(parameters, hand_index)

  • parameters: The Table of data to transform the hand zone with.
    • parameters.position: Position of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
    • parameters.rotation: Rotation of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
    • parameters.scale: Scale of the hand zone.
      • Optional, defaults to {x=0, y=0, z=0}.
  • hand_index: Index, representing which hand zone to modify.
    • Optional, defaults to 1.

Indexing

Hand indexes start at 1 and are numbered in the order of their creation. Each Player color has its own indexes.

-- Example of moving/rotating/scaling hand zone
params = {
    position = {x=0, y=5, z=0},
    rotation = {x=0, y=45, z=0},
    scale    = {x=2, y=2, z=2},
}
Player["White"].setHandTransform(params, 2)

setUITheme(...)

Sets the UI theme for the player.

setUITheme(theme)

  • theme: A string representing a theme.

Theme Format

You can view the expected theme format by in-game going to Menu -> Configuration -> Interface -> Theme. Select a theme then press "Import/Export".

Example

Set the White player's default button background to pink.

Player.white.setUITheme("button_normal #FFC0C0")

showInfoDialog(...)

Shows the info dialog to the player.

showInfoDialog(info)

  • info: Information to display.

Example

Player.white.showInfoDialog("Only active players may floop!")

showConfirmDialog(...)

Shows the confirm dialog to the player and executes the callback if they click OK.

showConfirmDialog(info, callback)

  • info: Information to display.
  • callback: Callback to execute if they click OK. Will be called as callback(player_color)

Example

chosen_player.showConfirmDialog("Really roll the dice?",
    function (player_color)
        dice.roll()
        log(player_color .. " rolled the dice.")
    end
)

showInputDialog(...)

Shows the text input dialog to the player and executes the callback if they click OK.

showInputDialog(description, default_text, callback)

  • description: Optional description of what the player should input.
  • default_text: Optional default value.
  • callback: Callback to execute if they click OK. Will be called as callback(text, player_color)

Example

chosen_player.showInputDialog("Set Name",
    function (text, player_color)
        chosen_object.setName(text)
    end
)

showMemoDialog(...)

Shows the memo input dialog (large text input) to the player and executes the callback if they click OK.

showMemoDialog(description, default_text, callback)

  • description: Optional description of what the player should input.
  • default_text: Optional default value.
  • callback: Callback to execute if they click OK. Will be called as callback(text, player_color)

Example

chosen_player.showMemoDialog("Set Description",
    function (text, player_color)
        chosen_object.setDescription(text)
    end
)

showOptionsDialog(...)

Shows the options dropdown dialog to the player and executes the callback if they click OK.

showOptionsDialog(description, options, default_value, callback)

  • description: Description of what the player is choosing.
  • options: Table of string options.
  • default_value: Optional default value, an integer index into the options table. Note you may alternatively use the option string itself.
  • callback: Callback to execute if they click OK. Will be called as callback(selected_text, selected_index, player_color)

Example

chosen_player.showOptionsDialog("Choose Value", {"1", "2", "3", "4", "5", "6"}, dice.getValue(),
    function (text, index, player_color)
        dice.setValue(index)
    end
)

showColorDialog(...)

Shows the color picker dialog to the player and executes the callback if they click OK.

showColorDialog(default_color, callback)

  • default_color: Optional default color.
  • callback: Callback to execute if they click Apply. Will be called as callback(color, player_color)

Example

chosen_player.showColorDialog(dice.getColorTint(),
    function (color, player_color)
        dice.setColorTint(color)
    end
)