Page 1 of 2

SayText() not working in CS:GO?

Posted: Thu Sep 04, 2014 3:55 pm
by stonedegg
I'm trying so send messages in CS:GO. I used the following example code:


Code: Select all

from messages import SayText

def load():
    SayText(message="plugin loaded").send()


It works in CS:S, but in CS:GO I just hear the click sound, nothing is printed.

Posted: Thu Sep 04, 2014 6:02 pm
by Tuck
Try

Syntax: Select all

from messages import SayText2


instead of

Syntax: Select all

from messages import SayText


remember to change the method's name also.

Posted: Thu Sep 04, 2014 7:13 pm
by stonedegg
Yea that works, thanks.
But now I have another problem: there is always printed a white square infront of every message.
Also colors have a weird behavior. It prints the text in the right color, but it still displays the hex code of it. Any idea how to fix that?

Code: Select all

from messages import SayText2
from basetypes import Color

color = Color(55, 155, 255)


def load():
    SayText2(message="{0}plugin loaded".format(color)).send()

Posted: Fri Sep 05, 2014 12:52 am
by satoon101
I am fairly certain that while \x07 and \x08 provide colors to messages in CS:GO, they do not except hex values. I don't believe the hex values were ever added to CS:GO. I could be wrong, haven't tested in a while, but the last time I remember testing, this was true.

Posted: Fri Sep 05, 2014 12:28 pm
by stonedegg
So how do I use colors in CS:GO and how do I get rid of this white square?

Posted: Fri Sep 05, 2014 7:20 pm
by Ayuto
If I remember correctly there are 8 colors in CS:GO: \x01 - \x08

The square could be caused by our "fix" we implemented earlier to properly show colors. Maybe Valve has fixed that bug. I will test that tomorrow.

Posted: Fri Sep 05, 2014 7:29 pm
by satoon101
And, just like all other games, afaik, \x03 will be the team color for the provided index in SayText2.

Posted: Fri Sep 05, 2014 8:10 pm
by stonedegg
Okay, please fix it <3

Posted: Fri Sep 05, 2014 9:34 pm
by L'In20Cible
Remove the \xB1 from the file ../data/source-python/messages/games/csgo.ini

Posted: Sat Sep 06, 2014 1:42 am
by satoon101

Posted: Sat Sep 06, 2014 12:10 pm
by stonedegg
Yea, that fixes the white square, thanks.
But now colors do not work at all. I tried everything from \x01-\x08, but the text stays on default color (white).
When using \x07 or \x08 the hex code is still printed, but it's not colored anymore.

Posted: Sat Sep 06, 2014 12:27 pm
by L'In20Cible
Try putting your color in the middle of your message for example: "this is a \x02a test message". If that works, that means we have to leave the \xB1 and remove the \x01 from the _message_prefix.

Posted: Sat Sep 06, 2014 12:33 pm
by Ayuto
Works fine for me.

Syntax: Select all

from messages import SayText2
from events import Event

@Event
def player_jump(event):
SayText2(message='\x01a\x02a\x03a\x04a\x05a\x06a\x06a\x07a\x08a').send()
The attachment de_dust20000.jpg is no longer available

Posted: Sat Sep 06, 2014 1:46 pm
by L'In20Cible
Great, thanks for testing!

Posted: Sat Sep 06, 2014 1:48 pm
by satoon101
Yeah, I tested almost exactly what Ayuto posted before committing the fix to verify it still works.

Posted: Sat Sep 06, 2014 1:49 pm
by stonedegg
Yea, looks like the first letter of the message may have no custom color. If I start the message with a custom color, the whole text will be white.
I fixed it by just printing a whitespace in front.
I hope there will be a workaround for hex colors (e.g. \x07FFFFFFtext), the text is colored, but it still prints the hex code (in this case FFFFFFtext).

Posted: Sat Sep 06, 2014 1:51 pm
by Ayuto
It's not our fault that we cannot use hex colors. It's the engine that doesn't allow this. There is nothing we can do.

Posted: Sat Sep 06, 2014 1:52 pm
by satoon101
Again, there are no custom hex codes implemented in CS:GO, so that won't work anyway.

Posted: Sat Sep 06, 2014 1:59 pm
by stonedegg
Oh my bad, I just tested the color red (FF0000) and the text was red, because \x07 is red :D Too bad that it's not implemented :/

Posted: Mon Sep 08, 2014 1:33 am
by satoon101
I just fixed SayText for CS:GO. We had the wrong field_name set for the message attribute. However, it also suffers from the small box at the start of the message. If we remove the \x1B from the prefix, the first characters prior to another color change will use the team color of the index given (same with SayText2). We will continue to look into fixing that issue.

*Edit: I should also note that CS:GO can use all of the following to change message colors in SayText and SayText2 (I might be missing more, but I have tested others that did not work):

  • \x01 - White
  • \x02 - Red
  • \x03 - Team (based on "index" attribute) - Pale Blue for CTs - Pale Yellow for Ts - White for non-team
  • \x04 - Bright Green
  • \x05 - Pale Green
  • \x06 - Green
  • \x07 - Pale Red
  • \x08 - Grey
  • \x09 - Yellow
  • \x0A - Light Blue
  • \x0B - Blue
  • \x0C - Dark Blue
  • \x0D - Light Blue for SayText2 and Purple for SayText
  • \x0E - Pink
  • \x0F - Dull Red
  • \x10 - Orange

And from my testing, both SayText and SayText2 allow for a team color for \x03. The only difference between the two seems to be \x0D being different colors.

**Edit2: it seems that '\x20' and '\xA0' both "work" as they put a space at the front of the message. I'm not sure if that is the proper fix, but it seems to be the best we know for now.