1. #1
    High Overlord Litterbox's Avatar
    10+ Year Old Account
    Join Date
    Mar 2011
    Location
    Copenhagen, Denmark
    Posts
    199

    Question lua question; target's target text

    I've tried to find this little block of code everywhere, but without luck.
    What I want it to do is something similar to the following:
    if target = player (me) display (insert text -ex. "you")
    else display none

    Is this even possible?
    If so, how?

  2. #2
    High Overlord
    10+ Year Old Account
    Join Date
    Dec 2010
    Location
    Kiev, Ukraine
    Posts
    141
    Can't tell exactly the answer, too long w/o practice, but you can look at TipTac addon, it surely has the "<<<You>>>" string in tooltip when someone is targeting you

  3. #3
    Deleted
    Perhaps take a look at any of the tooltip addons such as TipTac or check out the code in the TukUI tooltip.

  4. #4
    Deleted
    Where? In the tooltip? Need more info.
    The basic code is as follows:
    Code:
    if UnitIsUnit("player", "target") then
        -- do stuff
    end

  5. #5
    I know you didn't want the "else" section to not display anything, but this will explicitly print out "none" so you can learn how it's done:
    Code:
    /run if GetUnitName("player") == GetUnitName("target") then print("you") else print("none") end
    This one only prints out when you're your own target:
    Code:
    /run if GetUnitName("player") == GetUnitName("target") then print("you") end
    edit: meh, the master replied before me, and his is more streamlined

  6. #6
    High Overlord Litterbox's Avatar
    10+ Year Old Account
    Join Date
    Mar 2011
    Location
    Copenhagen, Denmark
    Posts
    199
    Quote Originally Posted by Treeston View Post
    Where? In the tooltip? Need more info.
    - It was actually for Pitbull. So instead of the target's target's name, then it would be blank, or say "you" instead if I was the target.

    Thanks a bunch, all of you.
    Got it to work with this:

    Code:
    if UnitIsUnit("player", "target") 
       then return ("you")
    end
    Fiddled around with it a bit to make it print stuff in the chatlog and there's definitely room for some more practice (fun) there.
    Thanks again guys.
    Last edited by Litterbox; 2011-03-11 at 04:12 PM.

Posting Permissions

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