SayText() not working in CS:GO?

Please post any questions about developing your plugin here. Please use the search function before posting!
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

SayText() not working in CS:GO?

Postby stonedegg » Thu Sep 04, 2014 3:55 pm

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.
Tuck
Global Moderator
Posts: 205
Joined: Sat Jul 14, 2012 9:35 pm
Location: Copenhagen

Postby Tuck » Thu Sep 04, 2014 6:02 pm

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.
-Tuck
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Thu Sep 04, 2014 7:13 pm

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()
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Sep 05, 2014 12:52 am

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.
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Fri Sep 05, 2014 12:28 pm

So how do I use colors in CS:GO and how do I get rid of this white square?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Fri Sep 05, 2014 7:20 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Fri Sep 05, 2014 7:29 pm

And, just like all other games, afaik, \x03 will be the team color for the provided index in SayText2.
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Fri Sep 05, 2014 8:10 pm

Okay, please fix it <3
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Fri Sep 05, 2014 9:34 pm

Remove the \xB1 from the file ../data/source-python/messages/games/csgo.ini
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Sep 06, 2014 1:42 am

stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Sat Sep 06, 2014 12:10 pm

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat Sep 06, 2014 12:27 pm

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.
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sat Sep 06, 2014 12:33 pm

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
Attachments
de_dust20000.jpg
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Postby L'In20Cible » Sat Sep 06, 2014 1:46 pm

Great, thanks for testing!
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Sep 06, 2014 1:48 pm

Yeah, I tested almost exactly what Ayuto posted before committing the fix to verify it still works.
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Sat Sep 06, 2014 1:49 pm

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).
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Postby Ayuto » Sat Sep 06, 2014 1:51 pm

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.
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Sep 06, 2014 1:52 pm

Again, there are no custom hex codes implemented in CS:GO, so that won't work anyway.
stonedegg
Senior Member
Posts: 141
Joined: Sun Aug 12, 2012 11:45 am

Postby stonedegg » Sat Sep 06, 2014 1:59 pm

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 :/
User avatar
satoon101
Project Leader
Posts: 2697
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Mon Sep 08, 2014 1:33 am

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.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 150 guests