Page 1 of 1

Tooltip - Megacliloc - capital letters

Posted: Tue Oct 23, 2018 4:37 am
by Ciechu
Hi!

There is any solution to make a toolstip desc without capital letters on each word? I use a modif. script, linked below. Also image with my problem.

Image

See that? All first letters are capital. I was good in escript about 10 years ago, but packethooks got me crazy :)

Code: Select all


const OFFSET_OBJECT_SERIAL := 0x05;
const OFFSET_CLILOC_ID     := 0x0F;
const OFFSET_LENGTH_ID     := 0x13;
const OFFSET_UNICODE_TEXT  := 0x14;

use basic;
use uo;
use cfgfile;
use polsys;

var Weapon_Cfg := ReadConfigFile(":combat:itemdesc");
var Itemdesc_Cfg := ReadConfigFile("itemdesc");


program Install()

	 Print("INSTALLING: Outgoing Tooltip PH...");
	 return 1;

endprogram

exported function MegaCliloc( who, byref packet )
        
	var xObject := SystemFindObjectBySerial(packet.GetInt32(OFFSET_OBJECT_SERIAL));
        who := who;
        
	if ( xObject )
		packet.SetSize(15);

		var Object_Name;
		var Dice_Dmg := Weapon_Cfg[xObject.objtype].Damage;


		if( xObject.IsA(POLCLASS_MOBILE) )
			Object_Name := CAscZ(xObject.name);
		elseif ( xObject.IsA(POLCLASS_ITEM) )
			//Object_Name := CAscZ("<BASEFONT COLOR=#FFFFFF><C>" + xObject.desc);
			Object_Name := CAscZ(xObject.desc);
		endif

		packet.SetInt32(OFFSET_CLILOC_ID, 1042971);
		packet.SetUnicodeString(OFFSET_UNICODE_TEXT, Object_Name, 1);
		packet.SetInt16(OFFSET_LENGTH_ID, Object_Name.Size() * 2);

		var xDesc := "";

                if( xObject.IsA(POLCLASS_MOBILE) )
										if( xObject.title_guild )
												xDesc := xDesc + "<BASEFONT COLOR=#ffcc33><C>[" + xObject.title_guild + "]" + "<BASEFONT COLOR=#FFFFFF><C><br>";
										endif
										if( !xObject.cmdlevel && !xObject.npctemplate)
												xDesc := xDesc + Cint(GetObjProperty(xObject, "lata")) + " Lat<br>";
										else
												if(!xObject.npctemplate)
														xDesc := xDesc + "<BASEFONT COLOR=#00FF00>[Ekipa serwera]<br></BASEFONT>";
												endif
										endif
								elseif( xObject.IsA(POLCLASS_ITEM))
									var typ := GetObjProperty(xObject, "typ");
									var israre := GetObjProperty(xObject, "IsRare");
							
							
										if (xObject.objtype == 0x8900)  // startstone
											
												xDesc := xDesc + "Uzyj aby rozdac statystyki i wybrac rase.";
												
										endif

		xDesc := CAscZ(xDesc);
		if ( xDesc.Size() > 0 )
			packet.SetInt32(packet.GetSize() - 1, 1070722);
			var Length_ID := packet.GetSize();
			packet.SetUnicodeString(packet.GetSize() + 1, xDesc, 1);
			packet.SetInt16(Length_ID, xDesc.Size() * 2);
		endif

		packet.SetInt32(packet.GetSize(), 0);
	endif

		if( xObject.IsA(POLCLASS_MOBILE) )
						IncRevision(xObject);
		endif

	return 0;

endfunction



Re: Tooltip - Megacliloc - capital letters

Posted: Tue Oct 23, 2018 9:05 pm
by guialtran
It's the client that does this, I have no idea how to turn it off.

my suggestion is, after you have used the SetUnicodeString () ...
try to find out what the Unicodes are of the spaces, and try to change them by some character that has space and is invisible.

example Unicode 8193 or 8199 or 65440

PS: from what I remember it is
packet.SetUnicodeStringFlipped (..., ..., 0);
not
packet.SetUnicodeString (..., ..., 1);
I would have to test to make sure. :deadhorse:

Re: Tooltip - Megacliloc - capital letters

Posted: Tue Oct 23, 2018 9:59 pm
by Ciechu
Ok, so the problem is that, client change first character capital after space... I will try to change that.

Thank you for your time ;)

Re: Tooltip - Megacliloc - capital letters

Posted: Tue Oct 23, 2018 10:35 pm
by guialtran
I tested it here, and it did not work to put an empty unicode, I tested it with some, and found nothing. :( :deadhorse:

Re: Tooltip - Megacliloc - capital letters

Posted: Wed Oct 24, 2018 12:29 am
by Ciechu
It is not a big problem, just for cosmetic... thank you for your time.

Re: Tooltip - Megacliloc - capital letters

Posted: Wed Oct 24, 2018 11:19 am
by Ciechu
Sorry for double post, but I found solution... creepy solution... :)

I've tried diffrent things, and I use <c> tag in string value...

like this...

Code: Select all

		if (xObject.objtype == 0x8900)  // startstone
											
													
				xDesc := "Uzyj <c>mnie <c>aby <c>wybrac <c>staty <c> i <c>rase.";
												
			endif
it's works!

Re: Tooltip - Megacliloc - capital letters

Posted: Thu Oct 25, 2018 5:52 am
by guialtran
:| spooky

that makes sense.
the client ignores the case of the first letter because of this tag