hud_saytext_time <value> (Default: 5) is how client determines the amount of seconds a say message will be shown on screen, after <value> seconds have passed, that say message will disappear correctly and then that say message will be send to the console right away.
When a say message get sent to the server it should be displayed to the console right away without depending on hud_saytext_time <value>
Actual behavior:
hud_saytext_time 5 -> say hello -> message on screen for 5 seconds -> 5 seconds have passed -> message get displayed on console.
It should be:
hud_saytext_time 5 -> say hello -> message on screen for 5 seconds and get displayed on console instantly.
Or just create a separate command to address how messages will be sent to the console without depending on hud_saytext_time <value>.
To get an instant say message on console, right now we need to set hud_saytext_time to 0 which will make any say message to disappear from screen.
Lol, for what?
It's work's fine. As expected.
Close the game between this 5 seconds and you gonna get console spam.
Better - to add colorized console.
Little part from ExtraMirror source's.
DWORD Original_SomeColorConsolePointer;
uintptr_t ptr2 = pModule2->FindFirstUseOfString("hud_saytext_time");
ptr2 = pModule2->SearchDownForBinaryPattern(ptr2, BinaryPattern("66 39 1D ?? ?? ?? ?? 55"));
Original_SomeColorConsolePointer = ptr2+0x3;
#include "main.h"
#include "ValveSDK/tier1/UtlVector.h"
#include <clocale>
#include <locale>
#include <codecvt>
#define MAX_LINES 5
#define MAX_CHARS_PER_LINE 256
struct TextRange
{
int start;
int end;
float *color;
};
struct SayTextLine
{
wchar_t m_line[MAX_CHARS_PER_LINE];
CUtlVector<TextRange> m_textRanges;
int m_clientIndex;
float *m_teamColor;
};
#define g_sayTextLine (*pg_sayTextLine)
SayTextLine g_sayTextLine[MAX_LINES + 1];
std::string ws2s(const std::wstring &wstr)
{
if (wstr.empty()) return std::string();
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
std::string strTo(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
return strTo;
}
#define F2B(f) ((f) >= 1.0f ? 255 : (int)((f)*256.f))
void ColorChatConsolePrint(char string[512])
{
int rangeIndex;
TextRange *range;
int total_length = 0;
static auto pCvarColor = g_Engine.pfnGetCvarPointer("con_color");
char *pszColor = pCvarColor->string;
BYTE Cvar_R, Cvar_G, Cvar_B;
BYTE R, G, B;
sscanf_s(pszColor, "%hhi %hhi %hhi", &Cvar_R, &Cvar_G, &Cvar_B);
if (g_sayTextLine[0].m_textRanges.Count()) {
if (g_sayTextLine[0].m_textRanges.Count() != 0)
{
for (rangeIndex = 0; rangeIndex < g_sayTextLine[0].m_textRanges.Count(); rangeIndex++)
{
range = &g_sayTextLine[0].m_textRanges[rangeIndex];
if (range->color) {
R = F2B(range->color[0]);
G = F2B(range->color[1]);
B = F2B(range->color[2]);
}
else {
R = Cvar_R; G = Cvar_G; B = Cvar_B;
}
ConsolePrintColor(R, G, B, ws2s(wstring(&g_sayTextLine[0].m_line[range->start], range->end - range->start)).c_str());
}
// Print newline char if needed
std::string check_string(&string[0], total_length);
if (check_string.find("\n") == string::npos)
{
g_Engine.pfnConsolePrint("\n");
}
}
}
}
void SearchPrintConsole()
{
DWORD PatternAddress = offset.FindPattern("\xFF\x15\xFF\xFF\xFF\xFF\x83\xC4\xFF\x66\x89\x1D\xFF\xFF\xFF\xFF", "xx????xx?xxx????", offset.ClBase, offset.ClEnd, 0x1);
if (PatternAddress)
{
pg_sayTextLine = reinterpret_cast<decltype(pg_sayTextLine)>(*(DWORD*)Original_SomeColorConsolePointer);
DWORD oldProt;
VirtualProtect(LPVOID(PatternAddress - 1), 6, PAGE_EXECUTE_READWRITE, &oldProt);
*(uint8_t *)(PatternAddress - 1) = 0x90; // NOP
*(uint8_t *)PatternAddress = 0xe8; // CALL
*(intptr_t *)(PatternAddress + 1) = (uintptr_t)ColorChatConsolePrint - (PatternAddress + 5); // ADDRESS
VirtualProtect(LPVOID(PatternAddress - 1), 6, oldProt, &oldProt);
}
}

P.s скриншот - первый попавшийся, так что я не виноват что он бреет себе что-то.
Better - to add colorized console.
This is where it's moving the text into the console now:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/saytext.cpp#L83
This is where it needs to be added:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/saytext.cpp#L176-L235
You can see at the beginning of the method that it's already going straight to console when say text isn't allowed on-screen. You can move the ConsolePrint call to the very start of the method, and just leave the return in the if statement.
Lol, for what?
It's work's fine. As expected.
Close the game between this 5 seconds and you gonna get console spam.Better - to add colorized console.
Adding a colored console is not mutually exclusive with this request, and i don't see anything wrong with printing to console immediately, in fact i've wondered why it doesn't do this already myself.
All this request would do is print to console when it receives a new message, rather than when the message is shunted out of the buffer. It won't cause any spam.
queue is queue, and work as expected.
So, mikela could add cvar (default: 0) like hud_print_immediately or something like this.
queue is queue, and work as expected.
So, mikela could add cvar (default: 0) like hud_print_immediately or something like this.
Obviously it is working as "expected" its fine at it is right now but should be improved.
As I said in the main post, rework hud_saytext_time or add a new command related to print any say message to the console the exact time it get sent.
Off-topic: @afwn90cj93201nixr2e1re You have been posting on several threads down-voting reports or feature-request because you are not understanding at all what people is trying to explain, as an advice you should work on your English because you are just making people confuse.
Some annoying stuff. After disconnect all chat messages disappear instead of push to console.
Lol. I get what 'r talking 'bout.
But your 'improvment's' sometimes is stupid as f8ck and break old engine logic.
@Mistrick Yup, that is an annoying feature that belongs to hud_saytext_time <value>.
If you disconnect before the 5 seconds (default value from hud_saytext_time) any say message that get sent won't be printed on console because your client won't process that message correctly and this is intended based on what hud_saytext_time is doing at the moment.
say hello!

Disconnecting from the server before the 5 second window.

Yup, that is an annoying feature that belongs to hud_saytext_time
.
Is that your issue? Or here something else?
On server leave.
For fix it, we should check if there anyting in vector queue and print it into console.
Or just call
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/saytext.cpp#L81
@IgorMenshinin That's one of the issues.
What else are there? Describe.
@IgorMenshinin Feel free to read the main post again, thanks. I won't explain this anymore as this is already clear.
I don't think there's a callback for disconnecting from a server so pushing all queued messages to the console on disconnect might not be an option.
There's nothing there except that you're proposing to change the behavior of the cvar.
If these are the only two things that get in your way, it's best to fix them. A bug with a missing out when disconnected with https://github.com/ValveSoftware/halflife/issues/2613#issuecomment-513889631.
And for changing the order of transfer of messages to the console - add a new cvar.
Although I don't see the reasons for that, because the only problem you've described here is missing messages when player disconnect from the server.
So, @SamVanheer is right, but there net stuctures and threads. Where we can add additional check's.
What do net structures and threads have to do with this?
Here many thread's which using net status. We could add clearing into one of them.
When you say threads do you mean methods? Because GoldSource is largely single-threaded, and there is no threading code involved in UI code.
It seems a little overkill to me to query the engine every frame considering the solution that was proposed solves the problem just fine without any additional overhead.
It also has the benefit of immediately showing new chat text in the console which lets you respond more quickly, for instance when you get an AMX help message telling you how to use a command you can immediately copy paste it in the console instead of having to wait.
But then we must remove queue printing, that's not a good idea.
I think you can come up with something about creating callback for disconnect. You've worked a lot on the reverse engine.
Yeah, i know that this is very overkill, but we already have one thread which doing connections check's. So, i think it must be a separate cvar. And maybe it's should be disabled by default. And we can add checkbox into settings.
You mean remove this:
https://github.com/ValveSoftware/halflife/blob/c7240b965743a53a29491dd49320c88eecf6257b/cl_dll/saytext.cpp#L83
That's not exactly a big deal. You're just moving the print call to occur when the message is received, rather than when the message has been shunted out of the buffer.
Also i don't see any way for the client to be informed about disconnects. There is nothing calling client code when that happens except for code exclusive to Counter-Strike's VGUI2 code, and that gets called for more than just disconnects so that isn't reliable either.
That's not exactly a big deal.
Maybe for someones - sure, but for other players?
Then we could just leave the hud_saytext_time intention.
Can you give an example as to how making this change would be a big deal?
The purpose of hud_saytext_time is to control how long it takes for text to scroll up on-screen, not to control how long it takes for text to be printed in the console.
It's just an endless conversation. Some will argue for it, others will be against it. Therefore, it is always better to leave as is, and add a cvar, which is disabled by default.
Can you give an example as to how making this change would be a big deal?
For example, i don't wanna see messages instanly at console. So, there a cvar for me, which transfer server/player messages into console by default.
The purpose of hud_saytext_time is to control how long it takes for text to scroll up on-screen, not to control how long it takes for text to be printed in the console.
Yes, that's why we should add additional cvar, and don't change the intention of stable.
chat messages should be printed on console instantly.
Many people (including me) don't understand why isn't like this.
Some annoying stuff. After disconnect all chat messages disappear instead of push to console.
And that problem will be solved too.
@mikela-valve Any insight if there is an option to address this? This could be a very well welcomed QoL feature if implemented into the game and there is not issues if implemented correctly, this would help a lot.
Any workaround will be welcomed.
@mikela-valve Any insight if there is an option to address this? This could be a very well welcomed QoL feature if implemented into the game and there is not issues if implemented correctly, this would help a lot.
Any workaround will be welcomed.
con_notifytime ?
Most helpful comment
Some annoying stuff. After disconnect all chat messages disappear instead of push to console.