Colour embedding goes wrong again... -
leong124 - 30.11.2010
hello,
I found that the colour embedding for 16-bit characters is still misaligned.
Код:
new string[128] = "";
strcat(string," 輸入{FF0000}/racestart{00BF8A}可以開始");
strcat(string,RaceName[CurrentCP[playerid] - CP_BLRACE]);
strcat(string,".");
SendClientMessage(playerid, COLOR_BLUEISHGREEN, string);
Result:
![](/imageshack/img3/6254/bug2ai.png)
Adding spaces are useless.
BTW,other problems I mentioned before are fixed
Re: Colour embedding goes wrong again... -
cessil - 30.11.2010
could it be a problem with strcat? try just using format.
new string[128];
format(string,sizeof(string)," 輸入{FF0000}/racestart{00BF8A}可以開始%s.",RaceName[CurrentCP[playerid] - CP_BLRACE]);
SendClientMessage(playerid, COLOR_BLUEISHGREEN, string);
Re: Colour embedding goes wrong again... -
leong124 - 30.11.2010
No.The problem still exists.
Re: Colour embedding goes wrong again... -
Kalcor - 30.11.2010
I'm not fully understanding this problem yet. I think it might be caused by the space: strcat(string," <- at the start of the string, since the colour is 2 characters off. But without the space pawn won't properly do the UTF-8 conversion, correct? The characters wouldn't display properly.
If you could show some more examples that would be helpful.
Re: Colour embedding goes wrong again... -
leong124 - 30.11.2010
I tried to remove that space and the whole message successfully displayed,
but that bug still occurs.
The same problem occurs in number plates. Here's an example:
Код:
SetVehicleNumberPlate(vid,"{FF0000}管理員車輛");
Result:
Код:
SetVehicleNumberPlate(vid,"{FF0000}管{000000}理員車輛");
Result:
Changing the colour of the whole text is okay, but doesn't for embedding two or more colours.
Some more example:
Код:
SetVehicleNumberPlate(vid,"{FF0000}管理{000000}員車輛");
Only the last character is black.
Код:
SetVehicleNumberPlate(vid,"{FF0000}管理員{000000}車輛");
or
Код:
SetVehicleNumberPlate(vid,"{FF0000}管理員車{000000}輛");
and even
Код:
SetVehicleNumberPlate(vid,"{FF0000}{000000}管理員車輛");
are all red for all of the characters.
Hope it will be useful.
EDIT:
Finally I think I found the offset sequence.
I use this to find that:
Код:
SendClientMessageToAll(0xFFFFFFFF,"{FF0000}一{000000}二三四五六七八九十一二三四五六七八九十");
Just ignore the first color FF0000 (because it works fine).
When a colour is added after the 1st character, it will have an offset of 1 character, i.e. it actually takes effect after the 2nd character.
Код:
SendClientMessageToAll(0xFFFFFFFF,"{FF0000}一二三四五六七八{000000}九十一二三四五六七八九十");
This time the colour is added after the 8th character, and have an offset of 8 characters,i.e. it takes effect after the 16th character.
The same for this:
Код:
SendClientMessageToAll(0xFFFFFFFF,"一{000000}01234567890123456789");
No matter the characters are 8-bit or 16-bit, when there's a 16-bit character, the bug occurs.
Re: Colour embedding goes wrong again... -
Kalcor - 01.12.2010
Thanks for posting that info. The problem is much easier to understand. If 1 character in a string is 16 bit, it seems all characters are converted to 16 bit.
I'll try to get this fixed for the next version.
Re: Colour embedding goes wrong again... -
leong124 - 01.12.2010
Thanks and I'm looking forward to that.
It is a pretty good feature