Skip to content

CSGO, SayText2 and the colors module #252

@thetredev

Description

@thetredev

Tested games: CSGO, CS:S

I usually send a prefixed and colored SayText2 message like this:

from colors import WHITE
from colors import ORANGE

SayText2(
    f'{ORANGE}[{WHITE}My Plugin Name{ORANGE}] {WHITE}My message ....
).send(some_index)

This works for CS:S, but it doesn't for CSGO. It shows the following chat message all in red instead: FFA500[FFFFFFMy Plugin NameFFA500] FFFFFFMy message ..... This tells me that these colors simply can only be used on entities in CSGO. I'm not sure if there have been plans to 'fix' this 'issue'.

My question is: Should we separate entity colors and message colors?
A quick and dirty solution could be:

# messages/message_colors.py

from core import GAME_NAME

if GAME_NAME == 'csgo':
    WHITE = '\x01'
    # more...

else:
    from colors import WHITE
    # more...

This could all be done in a much cleaner way using data files etc. so conflicts don't occur, of course. Is something in the works for this? If not, I could try to figure out a way.

I personally think it should be integrated, so scripters don't have to think about how to color their messages, but simply do it in a standard way.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions