Monday, February 19, 2007

UIObject_Tooltip_DisplayTooltipString

UIObject_Tooltip_DisplayTooltipString takes up to 9 parameters, but only the first four parameters are required.

Parameter list:
Message = The literal string to display in the tooltip

XLoc = The X origin for where the tooltip should appear. This can be a pixel location, or you can use the following two strings to make it relative: MOUSE_X will place the X origin of the tooltip near where the mouse is. OBJECT_X will place the tooltip next to the UIObject that is being moused over, if any. At first, it will try to place the tooltip to the right side of the UIObject. But if there is not enough screen space to fit the tooltip there, it will place it on the left side of the UIObject.

YLoc = The Y origin for where the tooltip should appear. This can be a pixel location, or you can use the following two strings to make it relative: MOUSE_Y will place the Y origin of the tooltip near where the mouse is. OBJECT_Y will place the tooltip next to the UIObject that is being moused over, if any. At first, it will try to place the tooltip on top of the UIObject. But if there is not enough screen space to fit the tooltip there, it will place it on the bottom of the UIObject.

Screen Tag = The Screen Tag for the XML file to be used for the tooltip

XAlignment = This parameter can be used to quickly position a tooltip relative to the full-screen space. The valid arguments are: ALIGN_NONE(default), ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT

YAlignment = This parameter can be used to quickly position a tooltip relative to the full-screen space. The valid arguments are: ALIGN_NONE(default), ALIGN_CENTER, ALIGN_TOP, ALIGN_BOTTOM

XPadding = This is used along with XAlign to quickly position the tooltip. It controls how far in the tooltip should be pushed from the left or right border of the screen space. For example, setting XAlignment to ALIGN_RIGHT and XPadding to 10 will result in the tooltip appearing on the right side of the screen, with a space of 10 pixels between the right edge of the tooltip scene and the edge of the screen.

YPadding = This is used along with YAlign to quickly position the tooltip. It controls how far in the tootip should be pushed from the top or bottom border of the screen space. For example, setting YAlignment to ALIGN_BOTTOM and YPadding to 10 will result in the tooltip appearing on the bottom of the screen with a space of 10 pixels between the bottom edge of the tooltip scene and the edge of the screen.

TextAlignment = How the text should be aligned in the tooltip. The options are: ALIGN_NONE(default), ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TOP, ALIGN_BOTTOM

4 comments:

Heed said...

Hi Rich.

There appears to be something wrong with the way this function takes the string parameter from the .xml. You can't use a string that contains any spaces in it. The scene will refuse to load if the tooltip string has a space.

Apparently, setting the text via nwscript will allow the tooltip to display text with spaces:

http://nwn2forums.bioware.com/forums/viewtopic.html?topic=551065&forum=119&sp=0#4843040

Thanks.

Rich Taylor said...

Okay, looks like there was a bug with the quote parsing for callback syntax.

If you do " marks around the whole callback and ' marks around each of the arguments of the callback, it wouldn't work right. I've fixed the bug for 1.06.

However, you should be able to place ' marks around the whole callback and use " marks for the arguments. For example:

'UIObject_Tooltip_DisplayTooltipString("Test String","OBJECT_X","OBJECT_Y","SCREEN_TOOLTIP_2")'

should work with your current version of the game. In 1.06, you'll be able to swap the ' and " marks above and still have it work correctly.

Heed said...

Yep, that works great. Thanks again. :)

Anonymous said...

ozp d uww n, free sex. ikg b, xfq lhulyp! hyzm a luj qt.