messages package¶
Submodules¶
Module contents¶
Provides user message based functionality.
- class messages.DialogAskConnect(title, time=10)[source]¶
Bases:
_DialogBase
Class used to send DialogType.ASKCONNECT messages to players.
DialogType.ASKCONNECT shows a box in-game that requests the player to hit the key they have bound to “askconnect_accept” (default to F3) to connect to a different server, whose address is given as the title value.
- message_type = _messages.DialogType.ASKCONNECT¶
- class messages.DialogEntry(title, msg, command, color=Color(255, 255, 255, 255), time=10)[source]¶
Bases:
_DialogBase
Class used to send DialogType.ENTRY messages to players.
DialogType.ENTRY shows the title while in-game (TopText) in the given color, as well as the msg in a box when the player uses their ESC key and an entry box where they can enter any values they wish.
The values the player enters are then sent as arguments for the given client command name.
- __init__(title, msg, command, color=Color(255, 255, 255, 255), time=10)[source]¶
Set all the base attributes on instantiation.
- Parameters:
title (str) – The title of the entry box and top text.
msg (str) – The message of the entry box.
command (str) – The command to execute on entry. Note that the entered values are arguments of the command on entry.
color (Color) – The color of the toptext notification.
time (int) – The time (in seconds) for the notification to display.
- property command¶
Return the registered command for the Entry box.
- message_type = _messages.DialogType.ENTRY¶
- class messages.DialogMenu(title, msg, command, color=Color(255, 255, 255, 255), time=10, options=None)[source]¶
Bases:
_DialogBase
Class used to send DialogType.MENU messages to players.
DialogType.MENU shows the title while in-game (TopText) in the given color, as well as the msg in a box when the player uses their ESC key and a menu for the player to choose an option from.
The value the player chooses is then sent as an argument for the given client command name.
- __init__(title, msg, command, color=Color(255, 255, 255, 255), time=10, options=None)[source]¶
Set all the base attributes on instantiation.
- Parameters:
title (str) – The title of the menu box and top text.
msg (str) – The message of the menu box.
command (str) – The command to execute on entry. Note that the key/item of the selected option will be the argument.
color (Color) – The color of the toptext notification.
time (int) – The time (in seconds) for the notification to display.
options (iterable) – The options for the menu. If a dictionary is passed, the values will be displayed while the keys will be the argument of the command when selected. If any other iterable is used, the items will be both the displayed text and the argument.
- property command¶
Return the registered command for the Menu.
- message_type = _messages.DialogType.MENU¶
- class messages.DialogMsg(title, color=Color(255, 255, 255, 255), time=10)[source]¶
Bases:
_DialogBase
Class used to send DialogType.MSG messages to players.
DialogType.MSG shows the title while in-game (TopText) in the given color.
- __init__(title, color=Color(255, 255, 255, 255), time=10)[source]¶
Set all the base attributes on instantiation.
- message_type = _messages.DialogType.MSG¶
- class messages.DialogText(title, msg, color=Color(255, 255, 255, 255), time=10)[source]¶
Bases:
_DialogBase
Class used to send DialogType.TEXT messages to players.
DialogType.TEXT shows the title while in-game (TopText) in the given color, as well as the msg in a box when the player uses their ESC key.
- __init__(title, msg, color=Color(255, 255, 255, 255), time=10)[source]¶
Set all the base attributes on instantiation.
- message_type = _messages.DialogType.TEXT¶
- class messages.DialogType¶
Bases:
enum
- ASKCONNECT = _messages.DialogType.ASKCONNECT¶
- ENTRY = _messages.DialogType.ENTRY¶
- MENU = _messages.DialogType.MENU¶
- MSG = _messages.DialogType.MSG¶
- TEXT = _messages.DialogType.TEXT¶
- names = {'ASKCONNECT': _messages.DialogType.ASKCONNECT, 'ENTRY': _messages.DialogType.ENTRY, 'MENU': _messages.DialogType.MENU, 'MSG': _messages.DialogType.MSG, 'TEXT': _messages.DialogType.TEXT}¶
- values = {0: _messages.DialogType.MSG, 1: _messages.DialogType.MENU, 2: _messages.DialogType.TEXT, 3: _messages.DialogType.ENTRY, 4: _messages.DialogType.ASKCONNECT}¶
- class messages.Fade(duration, hold_time, color=Color(255, 255, 255, 255), flags=_messages.FadeFlags.IN)[source]¶
Bases:
UserMessageCreator
Create a Fade.
- __init__(duration, hold_time, color=Color(255, 255, 255, 255), flags=_messages.FadeFlags.IN)[source]¶
Initialize the Fade instance.
- message_name = 'Fade'¶
- moved_frac_bits = 512¶
- translatable_fields = []¶
- class messages.FadeFlags¶
Bases:
enum
- IN = _messages.FadeFlags.IN¶
- MODULATE = _messages.FadeFlags.MODULATE¶
- OUT = _messages.FadeFlags.OUT¶
- PURGE = _messages.FadeFlags.PURGE¶
- STAYOUT = _messages.FadeFlags.STAYOUT¶
- names = {'IN': _messages.FadeFlags.IN, 'MODULATE': _messages.FadeFlags.MODULATE, 'OUT': _messages.FadeFlags.OUT, 'PURGE': _messages.FadeFlags.PURGE, 'STAYOUT': _messages.FadeFlags.STAYOUT}¶
- values = {1: _messages.FadeFlags.IN, 2: _messages.FadeFlags.OUT, 4: _messages.FadeFlags.MODULATE, 8: _messages.FadeFlags.STAYOUT, 16: _messages.FadeFlags.PURGE}¶
- class messages.HintText(message)[source]¶
Bases:
UserMessageCreator
Create a HintText.
- message_name = 'HintText'¶
- translatable_fields = ['message']¶
- class messages.HudDestination¶
Bases:
enum
- CENTER = _messages.HudDestination.CENTER¶
- CONSOLE = _messages.HudDestination.CONSOLE¶
- NOTIFY = _messages.HudDestination.NOTIFY¶
- TALK = _messages.HudDestination.TALK¶
- names = {'CENTER': _messages.HudDestination.CENTER, 'CONSOLE': _messages.HudDestination.CONSOLE, 'NOTIFY': _messages.HudDestination.NOTIFY, 'TALK': _messages.HudDestination.TALK}¶
- values = {1: _messages.HudDestination.NOTIFY, 2: _messages.HudDestination.CONSOLE, 3: _messages.HudDestination.TALK, 4: _messages.HudDestination.CENTER}¶
- class messages.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:
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.
- message_name = 'HudMsg'¶
- translatable_fields = ['message']¶
- class messages.KeyHintText(*hints)[source]¶
Bases:
UserMessageCreator
Create a KeyHintText.
- message_name = 'KeyHintText'¶
- class messages.ResetHUD(reset=True)[source]¶
Bases:
UserMessageCreator
Create a ResetHUD.
- message_name = 'ResetHud'¶
- translatable_fields = []¶
- class messages.SayText(message, index=0, chat=False, color='\x01')[source]¶
Bases:
UserMessageCreator
Create a SayText.
- message_name = 'SayText'¶
- reliable = True¶
- translatable_fields = ['message']¶
- class messages.SayText2(message, index=0, chat=False, param1='', param2='', param3='', param4='', color='\x01')[source]¶
Bases:
UserMessageCreator
Create a SayText2.
- __init__(message, index=0, chat=False, param1='', param2='', param3='', param4='', color='\x01')[source]¶
Initialize the SayText2 instance.
- message_name = 'SayText2'¶
- reliable = True¶
- translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']¶
- class messages.Shake(amplitude, duration, frequency=1, shake_command=_messages.ShakeCommand.START)[source]¶
Bases:
UserMessageCreator
Create a Shake.
- __init__(amplitude, duration, frequency=1, shake_command=_messages.ShakeCommand.START)[source]¶
Initialize the Shake instance.
- message_name = 'Shake'¶
- translatable_fields = []¶
- class messages.ShakeCommand¶
Bases:
enum
- AMPLITUDE = _messages.ShakeCommand.AMPLITUDE¶
- FREQUENCY = _messages.ShakeCommand.FREQUENCY¶
- START = _messages.ShakeCommand.START¶
- START_NORUMBLE = _messages.ShakeCommand.START_NORUMBLE¶
- START_RUMBLEONLY = _messages.ShakeCommand.START_RUMBLEONLY¶
- STOP = _messages.ShakeCommand.STOP¶
- names = {'AMPLITUDE': _messages.ShakeCommand.AMPLITUDE, 'FREQUENCY': _messages.ShakeCommand.FREQUENCY, 'START': _messages.ShakeCommand.START, 'START_NORUMBLE': _messages.ShakeCommand.START_NORUMBLE, 'START_RUMBLEONLY': _messages.ShakeCommand.START_RUMBLEONLY, 'STOP': _messages.ShakeCommand.STOP}¶
- values = {0: _messages.ShakeCommand.START, 1: _messages.ShakeCommand.STOP, 2: _messages.ShakeCommand.AMPLITUDE, 3: _messages.ShakeCommand.FREQUENCY, 4: _messages.ShakeCommand.START_RUMBLEONLY, 5: _messages.ShakeCommand.START_NORUMBLE}¶
- class messages.ShowMenu(menu_string, valid_slots=1023, display_time=4)[source]¶
Bases:
UserMessageCreator
Create a radio menu.
- chunk_size = 62¶
- message_name = 'ShowMenu'¶
- translatable_fields = []¶
- class messages.TextMsg(message, destination=_messages.HudDestination.CENTER, param1='', param2='', param3='', param4='')[source]¶
Bases:
UserMessageCreator
Create a TextMsg.
- __init__(message, destination=_messages.HudDestination.CENTER, param1='', param2='', param3='', param4='')[source]¶
Initialize the TextMsg instance.
- message_name = 'TextMsg'¶
- reliable = True¶
- translatable_fields = ['message', 'param1', 'param2', 'param3', 'param4']¶
- class messages.UserMessage¶
Bases:
instance
- property buffer¶
None( (_messages.UserMessage)arg1) -> _bitbuffers.BitBufferWrite
- property message_index¶
None( (_messages.UserMessage)arg1) -> int
- property message_name¶
None( (_messages.UserMessage)arg1) -> str
- property recipients¶
None( (_messages.UserMessage)arg1) -> object
- class messages.UserMessageCreator(**kwargs)[source]¶
Bases:
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.
- property message_name¶
Return the user message name.
- reliable = False¶
- property translatable_fields¶
Return a list of translatable fields.
- class messages.VGUIMenu(name, subkeys=None, show=True)[source]¶
Bases:
UserMessageCreator
Create a VGUIMenu.
- message_name = 'VGUIMenu'¶
- translatable_fields = []¶
- messages.get_message_index((str)name) int : ¶
Return the index of a user message. Return -1 if the user message wasn’t found.
- messages.get_message_name((_engines._sound.Channel)index) object : ¶
Return the name of the user message. Return None if the user message wasn’t found.
- messages.get_message_size((_engines._sound.Channel)index) object : ¶
Return the size of the user message. Return None if the user message wasn’t found.