LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   Lua Programming Help (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=50)
-   -   Markup, GetText() and GetTextLength() (https://www.lotrointerface.com/forums/showthread.php?t=3828)

Ivandar 03-07-2021 08:11 PM

Markup, GetText() and GetTextLength()
 
So ... I've found I can use <rgb> commands if I set a label or text box to having markup.

Two questions.

(A) are there any other <> commands that markup activates?

(B) GetText() and GetTextLength() strip the <> commands out ... This makes GetTextLength() inaccurate (because I've found the <> commands contribute to the 'real' length of the label) and make it impossible to get, modify, and re-set the label's text (you lose the <> commands when you do).

I've made a workaround, which is to simply keep a separate copy of the text, but that's space inefficient.

Has Turbine provided a way to get the 'markedup' text and textlength?

Garan 03-07-2021 10:50 PM

From the original release notes for Update 8 (when SetMarkupEnable was added):
Quote:

Added IsMarkupEnabled, SetMarkupEnabled to the Label class. This will allow for a limited set of HTML style tags to be used for formatting text. Tags include<b>, <i>, <u>, <p>, and a custom <rgb=#XXXXXX> tag. Make sure you close them </>.
Unfortunately, only the underline and paragraph tags actually seem to do anything (and the paragraph only adds a linefeed before the text not after it so it's not really a paragraph tag). Bold and italic don't work due to the way fonts are rendered in LotRO (to make bold text, you have to assign a bold font to the entire control and then everything is bold so the tag is irrelevant and there are no italic fonts). I can only guess that Turbine at one time intended to replace their existing font mechanism with actual true type fonts but that would have required significant changes to the UI and must have been scrapped.

Thurallor 03-08-2021 05:10 AM

I think you can use these other undocumented tags, too.

I wouldn't worry too much about memory inefficiency, when your average user has several GB of RAM to spare.

Garan 03-08-2021 06:34 AM

Quote:

Originally Posted by Thurallor (Post 12596)
I think you can use these other undocumented tags, too.

I wouldn't worry too much about memory inefficiency, when your average user has several GB of RAM to spare.

Those are always enabled (not enabled by SetMarkupEnabled). The item examination tags will allow the user to get a popup tooltip when they click the text but not on hover. The character tag (<Select:IID> tag) provides a popup menu on right click. I haven't tried the map note, npc query or quest ref tags either - no idea how you would figure out IDs for them since the lorebook is long gone.

The ExamineItemInstance tag requires encoded data which is a royal pain to encode properly and is of little use
The Examine tag however, uses regular game item IDs and is very useful. The first id is a unique identifier for a stack that is actually in inventory (and will show the correct quantity in the tooltip when clicked), the second is a generic identifier for a generic single representation of the item.
ex:
<Examine:IIDDID:0x030A0007F6CAFC3A:0x70033CA6>Poti ons</Examine> is for a stack of universal morale potions in Garan's inventory; will only work on Landroval because unique ids are server specific
<Examine:IIDDID:0:0x70033CA6>some item</Examine> is for a generic universal morale potion, will work on any server because generic ids are, well, generic.
<Select:IID:0x020A000000041D3A>Garan<\Select> is a character select tag for.... Garan (on Landroval)
Lunarwater experimented quite a bit with these tags and Lotro Compendium (not to be confused with Plugin Compendium) uses some of them


All times are GMT -5. The time now is 11:24 PM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI