1. #1

    Stuf pattern tag help.

    As the title says, i am in need of some help here.
    I got the text below from here a couple of months ago and what it does is that it shortens the name down, so Lunar Festival Herald becomes L.F.Herald but now i would like to change it to this "L.F.Herald | 100".
    The "100" is the percent HP, i dont want the "%" sign tho.
    So, is there any kind soul here that knows how to edit the current text to get "name-space-|-space-perhp"? I might add that it's going to be used for my pet.
    Thanks in advance and here's the pattern tag that i currently have

    Code:
    local name = UnitName(unit) or unit
    name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
    return name
    end
    Last edited by Rusk; 2013-02-09 at 07:57 PM.

  2. #2
    Quote Originally Posted by Rusk View Post
    As the title says, i am in need of some help here.
    I got the text below from here a couple of months ago and what it does is that it shortens the name down, so Lunar Festival Herald becomes L.F.Herald but now i would like to change it to this "L.F.Herald | 100".
    The "100" is the percent HP, i dont want the "%" sign tho.
    So, is there any kind soul here that knows how to edit the current text to get "name-space-|-space-perhp"? I might add that it's going to be used for my pet.
    Thanks in advance and here's the pattern tag that i currently have

    Code:
    local name = UnitName(unit) or unit
    name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
    return name
    end
    You have to use two tags. One for the name and H justify it right. Second tag use "| [perhp]" and H justify that left. Then place them where you would like them. Should look how you want it.

  3. #3
    Quote Originally Posted by bOOURNS View Post
    You have to use two tags. One for the name and H justify it right. Second tag use "| [perhp]" and H justify that left. Then place them where you would like them. Should look how you want it.
    Ah okay, thought i could have both in one but this works just as well, thanks!
    And another question regarding stuf while im at it, can i in some way make buffs that are on me not being highlighted?
    Can't seem to find any option for it:/

  4. #4
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    You can totally do it in one tag, by the way. This is just yours with the perchp added in:
    Code:
    local perchp = UnitHealth(unit) / UnitHealthMax(unit) * 100
    local name = UnitName(unit) or unit
    name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
    return "%s | %.0f",name,perchp
    end
    Sadly, I know of no way to do the buff highlighting you want in StUF.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  5. #5
    Quote Originally Posted by Taryble View Post
    You can totally do it in one tag, by the way. This is just yours with the perchp added in:
    Code:
    local perchp = UnitHealth(unit) / UnitHealthMax(unit) * 100
    local name = UnitName(unit) or unit
    name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
    return "%s | %.0f",name,perchp
    end
    Sadly, I know of no way to do the buff highlighting you want in StUF.
    Thanks mate but it doesn't seem to work =/

  6. #6
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    Stupidity on my part seems to have been the issue here - I forgot that | is a control code to WoW's text displays, and therefore to display it, I need to use two - just one and then leaving out the rest of a control code causes a silent error.

    Try this one (tested and working while sitting around in Ironforge on my bankguild-alt)
    Code:
    function(unit, cache, textframe)
      local name = UnitName(unit) or unit
      name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
      local perchp = 100 * UnitHealth(unit) / UnitHealthMax(unit)
      return "%s || %.0f%%",name,perchp
    end
    Last edited by Taryble; 2013-02-15 at 04:18 PM.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  7. #7
    Quote Originally Posted by Taryble View Post
    Stupidity on my part seems to have been the issue here - I forgot that | is a control code to WoW's text displays, and therefore to display it, I need to use two - just one and then leaving out the rest of a control code causes a silent error.

    Try this one (tested and working while sitting around in Ironforge on my bankguild-alt)
    Code:
    function(unit, cache, textframe)
      local name = UnitName(unit) or unit
      name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
      local perchp = 100 * UnitHealth(unit) / UnitHealthMax(unit)
      return "%s || %.0f%%",name,perchp
    end
    Awesome mate, thanks alot!

  8. #8
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    Just realized, you didn't want the "%" sign on the end. Just delete the last 2 "%" from the line that starts "return" so that it reads return "%s || %.0f",name,perchp
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

  9. #9
    Quote Originally Posted by Taryble View Post
    Just realized, you didn't want the "%" sign on the end. Just delete the last 2 "%" from the line that starts "return" so that it reads return "%s || %.0f",name,perchp
    Thanks mate, a question tho, how do i do so boss names don't become Garaja... | 100?
    There's also a "." behind the "|" in my text, so atm it looks like Garaja... |.100%.
    Is there a way to make the name work like the one i posted above so that Fenq the accursed becomes F.T. Accursed | 100?
    Saw that i missed a line in the code above so here's the real one ->

    Code:
    function(unit)
    	local name = UnitName(unit) or unit
    	name = name:gsub('(%S+) ',function(t) return t:sub(1,1)..'.' end)
    	return name
    end

  10. #10
    Scarab Lord Taryble's Avatar
    Join Date
    Aug 2008
    Location
    Texas
    Posts
    4,038
    Not really sure. Try making the text area wider in StUF?

    And my last post included the parts you'd forgotten - I tested it in StUF on my end and just copy/pasted exactly what I had working.
    We have done the impossible, and that makes us mighty. - Sgt. Malcolm "Mal" Reynolds, Battle of Serenity Valley

Posting Permissions

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