Forum

> > CS2D > Scripts > HUDTXT only appearing locally
Forums overviewCS2D overview Scripts overviewLog in to reply

English HUDTXT only appearing locally

4 replies
To the start Previous 1 Next To the start

old HUDTXT only appearing locally

Mami Tomoe
User Off Offline

Quote
Hey! I have a problem with the HUDTXT2 command.

In new game, it works perfectly fine for me but when I try it in the CS2D_Dedicated it appears to not show up.

There are no differences in between CS2D and CS2D_Dedicated, they use the exact same CS2D folder.

The problem seems to be caused by the string that I try to show in the HUDTXT but I'm unsure what is the exact problem in it, since it works in New Game just fine!

I even tried printing the string to the console, or using tostring or brackets and many other weird things but the problem persists only in the dedicated server!

I even went as far to manually call the HUDTXT2 function and making sure the parse is being called for the command and everything is 100% working except for the fact the HUDTXT only shows if I'm not adding the string to it:

"Controls:" - Works.
"Controls: ' .. string" - Doesn't work.

The string:
1
Controls: (©255255255Turn Right©255220000 -> ©255255255D©255220000) (©255255255Gear Up©255220000 -> ©255255255W©255220000) (©255255255Turn Left©255220000 -> ©255255255A©255220000) (©255255255Horn©255220000 -> ©255255255G©255220000) (©255255255Gear Down©255220000 -> ©255255255S©255220000) (©255255255Headlights©255220000 -> ©255255255H©255220000)

Could this be because of the huge amounts of colors? Is there a limit to how many colors the dedicated can show as compared to the local host?


Edit: It appears that the problem was caused by the colors, too many of them made it so only the local Server can view them.

Will this be fixed?
edited 1×, last 06.07.19 08:59:25 pm

old Re: HUDTXT only appearing locally

DC
Admin Off Offline

Quote
You might also hit a simple length limit or something (all the color tags make the string quite long). Not sure. Will check.

Edit: Yep, that string is way too long.
It was switched to UTF8 encoding in 1.0.0.6 and because of the used method the length is limited to 255 chars. Your string has over 300 chars.

Because of additional implementation bugs using longer strings at that point may lead to severe issues...
edited 1×, last 06.07.19 09:18:07 pm

old Re: HUDTXT only appearing locally

Mami Tomoe
User Off Offline

Quote
I once had a problem in a "loop" for a string to display in a HUDTXT, the loop was broken so the string was so long I actually dropped to 5-15 FPS in-game.

I don't really think length is a problem to the local host, but it might be for anyone that joins it (SERVER-player in new game has no problems).

Maybe because you actually have to send it to the player? And there's a limit to how big a string can be sent? Because I used the ALWAYS hook to refresh that HUDTXT.

old Re: HUDTXT only appearing locally

DC
Admin Off Offline

Quote
× Using the always hook to refresh something (especially a long string) is a VERY VERY VERY bad idea and you should not do that. Under no circumstances. It will cause MASSIVE traffic!

Like mentioned in my post above there is a severe bug when exceeding the length of 255 chars. This only occurs in a networked environment. It doesn't happen when you use "new game" and don't play with others.

Will try to fix that for the next update.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview