1. #1
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,053

    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 18:55.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Denver, Colorado, USA (for a bit)
    Posts
    24,166
    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.
    FG Con 15 Fantasy Grounds Online RPG Convention - Nov. 8-10, 2019
    Register at www.fg-con.com for all the latest info.

    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
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,053
    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.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

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

    Regards,
    JPG

  5. #5
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,053
    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).
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

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

    Regards,
    JPG

  7. #7
    celestian's Avatar
    Join Date
    Jan 2017
    Location
    DFW, Texas
    Posts
    2,053
    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.
    ---
    Coding the Official AD&D Ruleset
    My Twitch Channel for AD&D and FG related streams (See schedule for live days)
    My YouTube for FG related Tutorials and AD&D Actual Plays

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in