Chinesization problem really need help.

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Chinesization problem really need help.

Post by flamewing »

Greetings.
Sorry for my bad English and really don't where to ask.

I have a question about unifont texts in Chinese Characters or You can call it 'Chinesization'
I want to make in-game-language full use Chinese.
Only because My friend want to play UO in Chinese.

I'm now use Latest distro script to make my own shard.
But In game,the texts in sysmessage or item name cannot show Chinese and I know that Chinese fonts are all used unicode and unifont.mul because in game we all chatting in Chinese.
And I found the broadcasts,sysmessages,names,printabove,all used ASCII font.
In Sphere and Runuo only change texts to UTF-8 to translated or write a little scripts to change texts to Chinese.
And I tried many many ways in POL scripts,but I really cannot figure out how to do.

Could you please teach me about this in details?

Thanks a lot!
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Chinesization problem really need help.

Post by DevGIB »

http://docs.polserver.com/pol099/fullfu ... =unicodeem

Maybe this might help?

Basically all those functions you mentioned but supporting unicode.
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

DevGIB wrote: Sat May 27, 2017 5:29 am http://docs.polserver.com/pol099/fullfu ... =unicodeem

Maybe this might help?

Basically all those functions you mentioned but supporting unicode.
yes,i've tried this on login.src like
use uo;
use os;
use unicode;

include "include/packets";

program Logon( mobile )

SysLog( "IP: "+mobile.ip+" Account: "+mobile.acctname+" Character: "+mobile.name+" logged on." );

var acct := mobile.acct;
if( !acct.GetProp( "SignupIP" ))
acct.SetProp( "SignupIP", mobile.ip );
endif

if( mobile.cmdlevel <= 1 )
Broadcast( "Character ["+mobile.name+"] has entered", 3, 40 );
else
mobile.SetLightLevel( 0, -1 );
endif

GrantPrivilege( mobile, "seeghosts" );
mobile.Enable( "seeghosts" );
EraseObjProperty( mobile, "#AuthCodeGiven" );
EraseObjProperty( mobile, "#SpeedBoost" );
mobile.Deaf(0);

var num_players := GetGlobalProperty( "#Bots" ).Size();
foreach player in EnumerateOnlineCharacters()
if( !player.cmdlevel && player != mobile )
num_players += 1;
endif
SleepMS(5);
endforeach

SendSysMessageUC( mobile, "您好!Greetings", "CHT",3, 55 );

RemoveLogoff( mobile );

return 1;
endprogram

function RemoveLogoff( mobile )

var shrink_serial := GetObjProperty( mobile, "ShrinkLogoff" );
if( shrink_serial.errortext )
return 0;
endif

var shrink_mobile := SystemFindObjectBySerial( shrink_serial );
if( shrink_mobile )
DestroyItem( shrink_mobile );
endif

return 1;
endfunction
but in-game Chinese shows nothing.
Only can see "Greetings".also in journal shows ASCII symbols.
and i already change game language to CHT by uo.cfg.
It makes me confused.
could you make a sample for me,please?
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Chinesization problem really need help.

Post by DevGIB »

You may have missed the description for how the UC works.
uc_text MUST be an array of integers representing unicode characters.
So I assume it would have to be something like this:

Code: Select all

var uctext := array{0XB0A4,0XF6B0,0x0000};
SendSysMessageUC( mobile, uctext+"!Greetings", "CHT",3, 55 );
You'll have to excuse if those characters i've selected don't actually mean anything or don't point to a correct character I've just selected random characters from the character map.
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

DevGIB wrote: Sat May 27, 2017 11:22 pm You may have missed the description for how the UC works.
uc_text MUST be an array of integers representing unicode characters.
So I assume it would have to be something like this:

Code: Select all

var uctext := array{0XB0A4,0XF6B0,0x0000};
SendSysMessageUC( mobile, uctext+"!Greetings", "CHT",3, 55 );
You'll have to excuse if those characters i've selected don't actually mean anything or don't point to a correct character I've just selected random characters from the character map.
First,Thanks a alot,DevGIB!
It works!
And how about gump text and item_names?
the same way to do? that's means every script need to put character arrays code in them.
That's a hard word. :o

Maybe offical distro think about to make this simpler.


Because not everyone could be a programmer. :D
I'll try this way.
Anyway,THANK TOU VERY MUCH!
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Chinesization problem really need help.

Post by DevGIB »

You'll have to excuse my ignorance as i don't know a lot about the Chinese language.

My recommendation would be to create an include file with a function that will take a string of text and convert it to your array for you.

First have a list of constants defining what the Big Endian hex is for a particular character (i don't know how many characters in the Chinese language/alphabet).

Then have a function which will take a string as a parameter break it down into individual characters, look up those characters against the constants and write an array using the hex values which you can submit to a UC function.

Might be worth waiting to see if anyone has a better way or if there is something written in the core/distro that can help. I'm only a novice.
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

DevGIB wrote: Sun May 28, 2017 4:31 am You'll have to excuse my ignorance as i don't know a lot about the Chinese language.

My recommendation would be to create an include file with a function that will take a string of text and convert it to your array for you.

First have a list of constants defining what the Big Endian hex is for a particular character (i don't know how many characters in the Chinese language/alphabet).

Then have a function which will take a string as a parameter break it down into individual characters, look up those characters against the constants and write an array using the hex values which you can submit to a UC function.

Might be worth waiting to see if anyone has a better way or if there is something written in the core/distro that can help. I'm only a novice.
No,Your replies are very helpful for me.
I already have a big step forward on this "Chinesization" project.
anyway, really really Thank you so much!
Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

Re: Chinesization problem really need help.

Post by Duttones »

I have the same problem in my shard.

PrintTextAboveUC and PrivateTextAboveUC works great, but I never figured out how to make the SendSysMessageUC to work. It only show the message in the journal, but not in the client screen.
Already tried to convert the string using CAscZ, and later added the 0x0000 to the end of the array.

If someone have a code with SendSysMessageUC working, i'll be very happy to see.
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

Duttones wrote: Mon May 29, 2017 7:24 am I have the same problem in my shard.

PrintTextAboveUC and PrivateTextAboveUC works great, but I never figured out how to make the SendSysMessageUC to work. It only show the message in the journal, but not in the client screen.
Already tried to convert the string using CAscZ, and later added the 0x0000 to the end of the array.

If someone have a code with SendSysMessageUC working, i'll be very happy to see.
first,sorry for my bad english.
DevGIB means you do it like this way
1.put "use unicode;" in the script you want to edit.
2.set a array for your text of your language.
3.Edit SendsysmessageUC code what your need.

example:
That in my language Chinese.
use uo;
use os;
use unicode;
program Logon( mobile )
var greetingsinchinesetext :={0x60a8,0x597d};
SendSysMessageUC( mobile, greetingsinchinesetext + CAscZ(mobile.name), "CHT",3, 55 );

endfunction
then you'll see sysmessage show "您好XXX" in unicode

Chinese have millions of characters

So,I still need POL OFFICIAL TEAM make this simpler.
Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

Re: Chinesization problem really need help.

Post by Duttones »

I followed what you said multiple times, but still, doesn't work.
I remember to read somewhere in the forum that the last clients doens't handle the SendSysMessageUNI, but I don't know if it is true. I'm using TOL expansion in my shard.

Pol have the cAscZ function that convert a string to an array of utf-8 unicode characters. Probably will work for you too.

var my_uc := cAscZ("hellow");
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

Duttones wrote: Mon May 29, 2017 10:37 am I followed what you said multiple times, but still, doesn't work.
I remember to read somewhere in the forum that the last clients doens't handle the SendSysMessageUNI, but I don't know if it is true. I'm using TOL expansion in my shard.

Pol have the cAscZ function that convert a string to an array of utf-8 unicode characters. Probably will work for you too.

var my_uc := cAscZ("hellow");

No, CAscZ only used on ASCII Characters,it won't work for Chinese.
in Client there are two kind of fonts.
Font.mul,Unifont.mul
I don't know what language you use,but Chinese/Korean/Japanese maybe some other language use Unifont.mul.
Have you put your langcode in your code?
in my example that "CHT" is my langcode and my Client using.
and as I know that Last Client have no Chinese support. :shame:
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Chinesization problem really need help.

Post by DevGIB »

This may or may not help, it seems like a very poor way to do it and there might be a better method however something like the below might make converting text quicker.

Code: Select all

function ConvertStringToHexArray( text )

	var OutputArray := array{};
	var len_text := Len( text );
	var i;
	
	for( i:=1; i<=len_text; i+=1 )
		sleepms(2);
		var letter := CStr( text[i] );
		
			Case( letter )
			"A": OutputArray.append( 0x41 );
			"B": OutputArray.append( 0x42 );
			"C": OutputArray.append( 0x43 );
			"D": OutputArray.append( 0x44 );
			"E": OutputArray.append( 0x45 );
			"F": OutputArray.append( 0x46 );
			"G": OutputArray.append( 0x47 );
			"H": OutputArray.append( 0x48 );
			"I": OutputArray.append( 0x49 );
			"J": OutputArray.append( 0x4A );
			"K": OutputArray.append( 0x4B );
			"L": OutputArray.append( 0x4C );
			"M": OutputArray.append( 0x4D );
			"N": OutputArray.append( 0x4E );
			"O": OutputArray.append( 0x4F );
			"P": OutputArray.append( 0x50 );
			"Q": OutputArray.append( 0x51 );
			"R": OutputArray.append( 0x52 );
			"S": OutputArray.append( 0x53 );
			"T": OutputArray.append( 0x54 );
			"U": OutputArray.append( 0x55 );
			"V": OutputArray.append( 0x56 );
			"W": OutputArray.append( 0x57 );
			"X": OutputArray.append( 0x58 );
			"Y": OutputArray.append( 0x59 );
			"Z": OutputArray.append( 0x5A );
			"?": OutputArray.append( 0x8146 );
			EndCase
	endfor
	
	return OutputArray;

endfunction
Then from another script you can call the function to convert to a hex array e.g.

Code: Select all

broadcastUC( ConvertStringToHexArray( "HELLO PLAYER?" ), "CHT" );
flamewing
Neophyte Poster
Posts: 31
Joined: Thu Dec 04, 2008 6:10 am

Re: Chinesization problem really need help.

Post by flamewing »

Chinesization in progress.
Thanks bro. :D
Post Reply