messages.base module

Provides user messages.

class messages.base.AttrDict[source]

Bases: dict

A dictionary that redirects __getattr__ and __setattr__.

class messages.base.Fade(duration, hold_time, color=Color(255, 255, 255, 255), flags=_messages.FadeFlags.IN)[source]

Bases: messages.base.UserMessageCreator

Create a Fade.

__init__(duration, hold_time, color=Color(255, 255, 255, 255), flags=_messages.FadeFlags.IN)[source]

Initialize the Fade instance.

bitbuf(buffer, kwargs)[source]

Send the Fade with bitbuf.

protobuf(buffer, kwargs)[source]

Send the Fade with protobuf.

message_name = 'Fade'
moved_frac_bits = 512
translatable_fields = []
class messages.base.HintText(message)[source]

Bases: messages.base.UserMessageCreator

Create a HintText.

__init__(message)[source]

Initialize the HintText instance.

bitbuf(buffer, kwargs)[source]

Send the HintText with bitbuf.

protobuf(buffer, kwargs)[source]

Send the HintText with protobuf.

message_name = 'HintText'
translatable_fields = ['message']
class messages.base.HudMsg(message, x=-1, y=-1, color1=Color(255, 255, 255, 255), color2=Color(255, 255, 255, 255), effect=0, fade_in=0, fade_out=0, hold_time=4, fx_time=0, channel=0)[source]

Bases: messages.base.UserMessageCreator

Create a HudMsg.

__init__(message, x=-1, y=-1, color1=Color(255, 255, 255, 255), color2=Color(255, 255, 255, 255), effect=0, fade_in=0, fade_out=0, hold_time=4, fx_time=0, channel=0)[source]

Initialize the HudMsg instance.

bitbuf(buffer, kwargs)[source]

Send the HudMsg with bitbuf.

protobuf(buffer, kwargs)[source]

Send the HudMsg with protobuf.

message_name = 'HudMsg'
translatable_fields = ['message']
class messages.base.KeyHintText(*hints)[source]

Bases: messages.base.UserMessageCreator

Create a KeyHintText.

__init__(*hints)[source]

Initialize the KeyHintText instance.

bitbuf(buffer, kwargs)[source]

Send the KeyHintText with bitbuf.

protobuf(buffer, kwargs)[source]

Send the KeyHintText with protobuf.

message_name = 'KeyHintText'
class messages.base.ResetHUD(reset=True)[source]

Bases: messages.base.UserMessageCreator

Create a ResetHUD.

__init__(reset=True)[source]

Initialize the ResetHUD instance.

bitbuf(buffer, kwargs)[source]

Send the ResetHUD with bitbuf.

protobuf(buffer, kwargs)[source]

Send the ResetHUD with protobuf.

message_name = 'ResetHud'
translatable_fields = []
class messages.base.SayText(message, index=0, chat=False, color='x01')[source]

Bases: messages.base.UserMessageCreator

Create a SayText.

__init__(message, index=0, chat=False, color='\x01')[source]

Initialize the SayText instance.

bitbuf(buffer, kwargs)[source]

Send the SayText with bitbuf.

protobuf(buffer, kwargs)[source]

Send the SayText with protobuf.

message_name = 'SayText'
reliable = True
translatable_fields = ['message']
class messages.base.SayText2(message, index=0, chat=False, param1='', param2='', param3='', param4='', color='x01')[source]

Bases: messages.base.UserMessageCreator

Create a SayText2.

__init__(message, index=0, chat=False, param1='', param2='', param3='', param4='', color='\x01')[source]

Initialize the SayText2 instance.

bitbuf(buffer, kwargs)[source]

Send the SayText2 with bitbuf.

protobuf(buffer, kwargs)[source]

Send the SayText2 with protobuf.

message_name = 'SayText2'
reliable = True
translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']
class messages.base.Shake(amplitude, duration, frequency=1, shake_command=_messages.ShakeCommand.START)[source]

Bases: messages.base.UserMessageCreator

Create a Shake.

__init__(amplitude, duration, frequency=1, shake_command=_messages.ShakeCommand.START)[source]

Initialize the Shake instance.

bitbuf(buffer, kwargs)[source]

Send the Shake with bitbuf.

protobuf(buffer, kwargs)[source]

Send the Shake with protobuf.

message_name = 'Shake'
translatable_fields = []
class messages.base.ShowMenu(menu_string, valid_slots=1023, display_time=4)[source]

Bases: messages.base.UserMessageCreator

Create a radio menu.

__init__(menu_string, valid_slots=1023, display_time=4)[source]

Initialize the radio menu.

bitbuf(player_indexes, kwargs)[source]

Send the ShowMenu with bitbuf.

protobuf(buffer, kwargs)[source]

Send the ShowMenu with protobuf.

send(*player_indexes)[source]

Send the user message.

chunk_size = 62
message_name = 'ShowMenu'
translatable_fields = []
class messages.base.TextMsg(message, destination=_messages.HudDestination.CENTER, param1='', param2='', param3='', param4='')[source]

Bases: messages.base.UserMessageCreator

Create a TextMsg.

__init__(message, destination=_messages.HudDestination.CENTER, param1='', param2='', param3='', param4='')[source]

Initialize the TextMsg instance.

bitbuf(buffer, kwargs)[source]

Send the TextMsg with bitbuf.

protobuf(buffer, kwargs)[source]

Send the TextMsg with protobuf.

message_name = 'TextMsg'
reliable = True
translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']
class messages.base.UserMessageCreator(**kwargs)[source]

Bases: messages.base.AttrDict

Provide an easy interface to create user messages.

Attr bool reliable:
 Whether to send message using reliable channel.
__init__(**kwargs)[source]

Initialize the usermessage creator.

Parameters:kwargs (dict) – All valid fields.
bitbuf(buffer, translated_kwargs)[source]

Bitbuf implementation of this user message.

protobuf(buffer, translated_kwargs)[source]

Protobuf implementation of this user message.

send(*player_indexes, **tokens)[source]

Send the user message.

message_name

Return the user message name.

reliable = False
translatable_fields

Return a list of translatable fields.

class messages.base.VGUIMenu(name, subkeys=None, show=True)[source]

Bases: messages.base.UserMessageCreator

Create a VGUIMenu.

__init__(name, subkeys=None, show=True)[source]

Initialize the VGUI menu.

Parameters:
  • name (str) – Name of the menu.
  • subkeys (dict) – Additional menu data.
  • show (bool) – If True the menu will be shown, else it will be hidden.
bitbuf(buffer, kwargs)[source]

Send the VGUIMenu with bitbuf.

protobuf(buffer, kwargs)[source]

Send the VGUIMenu with protobuf.

message_name = 'VGUIMenu'
translatable_fields = []