Thread: Pitbull help

  1. #1

    Pitbull help

    Im trying to shorten the name of my target. I've tried using the LUA code that abbreviates names but from my understanding it will only shorten Blood Elf to BE. So in photo form, here is my problem.

    http://i.imgur.com/O5dsbWC.png

    I used to run without names and im leaning towards doing that again if I cannot find a solution to shorten it.

  2. #2
    You could use something like this:

    Code:
    return strsub(UnitName(unit), 1, 10)
    This will cut off the name after the first 10 characters if it is longer than that. If you want something a little different, post what you currently have for the name display and I can tweak it the way you want it.

  3. #3
    Quote Originally Posted by Riokou View Post
    You could use something like this:

    Code:
    return strsub(UnitName(unit), 1, 10)
    This will cut off the name after the first 10 characters if it is longer than that. If you want something a little different, post what you currently have for the name display and I can tweak it the way you want it.
    http://i.imgur.com/EmAoEo8.png

    That is what I had ended up with. Is it possible to make it so that if a name has a space in it (Lieutenant Thorn) it would only read the second word? So if I targeted her it would just say "Thorn"?

  4. #4
    http://lua-users.org/wiki/PatternsTutorial will provide some nice guidance, but for that case you want:

    Code:
    return string.gsub(UnitName(unit), ".* ", "")

  5. #5
    Quote Originally Posted by SlippyCheeze View Post
    http://lua-users.org/wiki/PatternsTutorial will provide some nice guidance, but for that case you want:

    Code:
    return string.gsub(UnitName(unit), ".* ", "")
    That is so much! This works perfectly! I will take a look at that site you linked from now on and see if I can make heads or tails =)

Posting Permissions

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