Page 1 of 1

Tooltip packet

Posted: Thu Mar 12, 2009 2:05 am
by aktor
Hi,

I hooked the 0xD6 packet in order to do custom tooltips, like so:

Code: Select all

Packet 0xD6
{
	Length 		variable
	SendFunction	toolTips:MegaCliloc
}
I specifically did it to change the colour of the item's name in the tooltip, according to its quality. And this works great in 2D and 3D. However, in 3D, the vendor shopping lists display the items, but with the code used to recolor them. In other words, in 2D the item's display correctly in the shopping list WITH their right colors, but in 3D they look like this:
<BASEFONT COLOR=#FFFFFF><C>Kite Shield
However, once you buy it, the tooltip is fine in the bag. It's just the shopping list that's stuffed-up. (see reply post for a screenshot).

Here is how I change the colour of the name, at the moment:

Code: Select all

use uo;
use cfgfile;

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

program Install()

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

endprogram

exported function MegaCliloc( who, byref packet )

	var xObject := SystemFindObjectBySerial(packet.GetInt32(OFFSET_OBJECT_SERIAL));
	
	if ( xObject )
	
		packet.SetSize(15);
		var Text_Color;
		var Object_Name;
		
		Object_Name := xObject.desc;
		Text_Color := "FFFFFF";
		
		Object_Name := CAscZ("<BASEFONT COLOR=#" + Text_Color + "><C>" + Object_Name);
		
		packet.SetInt32(OFFSET_CLILOC_ID, 1042971);
		packet.SetUnicodeString(OFFSET_UNICODE_TEXT, Object_Name, 1);		
		packet.SetInt16(OFFSET_LENGTH_ID, Object_Name.Size() * 2);
		packet.SetInt32(packet.GetSize(), 0);
		
	endif

	return 0;
	
endfunction	
(Obviously I removed all the specific case statements etc from the above example)

Re: Tooltip packet

Posted: Thu Mar 12, 2009 2:21 am
by aktor
In 2D: (Tooltips are white, which is good. Dont know why the shopping list names are also white, but I don't really mind):

Image

In 3D: (Tooltips are still white, which is good. But the shopping list names are completely messed up):

Image

Re: Tooltip packet

Posted: Thu Mar 12, 2009 6:38 am
by MuadDib
Tooltips are wonderful are they not?

Vendored items must have normal name for the tooltip in buy/sell windows. Client controlled.

Re: Tooltip packet

Posted: Thu Mar 12, 2009 7:20 am
by aktor
Any way to set it back to normal if it's in a buy/sell window, specifically? Or what now?

What puzzles me is that it works in 2D. I don't mind the white names in the buy/sell window there - in fact, I prefer it. It's just in 3D that it outputs the basefont stuff. No way to stop that, is there? :/