Skip to content

ChatMessage ​

Inherits: RefCounted

One line of the message manager: the channel it was posted to, the text, and the data it was made from (the item, the amount, the entity ...). A message is plain data: it holds ids and numbers, never objects, so it converts to a dictionary and back (what a network would carry).

Variables ​

intsequence0
Stringchannel_id""
PackedStringArrayextra_channelsPackedStringArray()
Stringtext""
Dictionarydata{}
floatgame_hours0.0

Methods ​

PackedStringArrayget_channels()
boolis_in_any( channel_ids: PackedStringArray )
Dictionaryto_dict()
ChatMessagefrom_dict( source: Dictionary ) static

Variable descriptions ​

int sequence = 0 ​

The number of the message in the order they were posted (every message has its own)

String channel_id = "" ​

The key of the channel (ChatChannel.id). When a line belongs to several channels this is the first, the most specific one

PackedStringArray extra_channels = PackedStringArray() ​

The other channels the line belongs to (a line about the player is also a party line and a friendly line). A viewer that shows several of them shows the line once

String text = "" ​

The text, finished: the language and the names are those of the moment it was posted

Dictionary data = ​

What the line was made from: ids and numbers (a viewer may use them: a toast shows data["level"])

float game_hours = 0.0 ​

The game time it was posted at (ChronoManager.total_game_hours)

Method descriptions ​

PackedStringArray get_channels() ​

Every channel the line belongs to, the first one first

bool is_in_any( channel_ids: PackedStringArray ) ​

Does the line belong to one of these channels? (An empty list = any)

Dictionary to_dict() ​

The message as a dictionary (a save, a network)

ChatMessage from_dict( source: Dictionary ) ​

A message from a dictionary