STAR TREK 2d20
  1. #1

    Setting a tooltip, works one way, not another...

    For this requirement I need to be able to add a CR\r (return) in the text so it looks something like this.

    Code:
    NPC: do something there.
    PC: do something here.
    So I thought I could just set the string value to this.

    Code:
    <string name="cta_hptotal_tooltip"">NPC: Double click to adjust base HP.\rPC: Open Combat details section to adjust.</string>
    And then just assign it as normal. <tooltip textres="cta_hptotal_tooltip" />.

    But all that did was set the tooltip to the literal value and showed the "\r" instead of added the return/CR. I knew I'd done this (programmatically for another situation) before so I dug around and found it and manually set it this way.

    Code:
              function onInit()
                local aHPTotalTip = {};
                table.insert(aHPTotalTip, Interface.getString("cta_hptotal_npc_tooltip")); 
                table.insert(aHPTotalTip, Interface.getString("cta_hptotal_pc_tooltip"));
                setTooltipText(table.concat(aHPTotalTip, "\r"));
              end
    I split the string into _npc and _pc values then used table concat and it works.



    This seems like odd behavior. Is there some translation going on for \r in the concat im missing?
    Last edited by celestian; November 12th, 2019 at 17:55.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,361
    Quote Originally Posted by celestian View Post
    This seems like odd behavior. Is there some translation going on for \r in the concat im missing?
    Probably in the setTooltipText API call.
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Quote Originally Posted by Trenloe View Post
    Probably in the setTooltipText API call.
    That was mostly what I was getting at tho my wording wasn't so clear. I'm wondering if the way <tooltip textres="cta_hptotal_tooltip" /> pulls in the variable if it automatically escapes characters.... tho im pretty sure I use \t somewhere and it doesn't for that.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    String assets will encode "\\r" as carriage returns ("\r") on load in v3.3.9.

    Regards,
    JPG

  5. #5
    Quote Originally Posted by Moon Wizard View Post
    String assets will encode "\\r" as carriage returns ("\r") on load in v3.3.9.

    Regards,
    JPG
    So, to be clear you mean if I set it to:

    Code:
    <string name="cta_hptotal_tooltip">PC: Do something heret.\\rNPC: Do another thing here..</string>
    It should work in 3.3.9? I tested after updating (im on Test channel, no local CoreRPG folder) and it dropped a \ but otherwise looked the same (no return).
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  6. #6
    No, just leave a \r (single slash). I literally just put it up right after posting.

    Regards,
    JPG

  7. #7
    Quote Originally Posted by Moon Wizard View Post
    No, just leave a \r (single slash). I literally just put it up right after posting.

    Regards,
    JPG
    Got ya, works, thanks My brain couldn't translate that properly I guess.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Character Create Playlist

Log in

Log in