Skip to main content

Players and props

Accessing players

read:players

After identifying a player, you can access the underlying player object using Talo.current_player. For the current player alias, you can use Talo.current_alias.

You can also find a player by their ID using Talo.players.find(). Players retrieved this way are read-only: you can only modify or take actions on behalf of a player that was previously identified.

Searching for players

read:players

You can use Talo.players.search() to query players. This function accepts a single query parameter that will search your playerbase for matching player IDs, alias identifiers or prop values. You can use this function to find players by their username, their ID or if they have a prop with a specific value.

var search_page := await Talo.players.search("bob")
if search_page.count == 0:
print("No players found")
return

var identifiers = []
for player in search_page.players:
identifiers.append(player.get_alias().identifier)

print("Found %s results: %s" % [search_page.count, ", ".join(identifiers)])

Getting and setting props

Players can have a list of arbitrary properties that are persisted across all of their aliases. These props are identified by their unique key and can have any string value.

Getting props

You can retrieve the current player's props using Talo.current_player.props. To retrieve a single prop use Talo.current_player.get_prop() (where you can also specify a fallback).

Setting props

write:players

You can set props using Talo.current_player.set_prop(). If a prop with specified key doesn't exist it'll be created, otherwise the existing prop with the same key will be updated.

warning

Player props are not linearisable - simultaneous requests may be applied out of order. You should avoid setting or deleting props in _process() functions.

Deleting props

write:players

Props can be deleted with Talo.current_player.delete_prop() or by using Talo.current_player.set_prop() and setting the value to null.