1. #1

    Help with my Pitbull DogTag code for Unitlevel/name, code inside

    I use following code for Unitname+level. Names will be truncated if they are too long which is the really cool part here.

    An example: Whenever my target is tagged by someone, the unitname color will turn into grey and get a (*) after it's name. When target is indicated as a rare mob, it has a pink 'R' added before the actual name.

    Over to my problem... My problem here is that whenever a mob is tagged (not by me) and is a RARE, the targetname is completely ignored. So it will be truncated like normally, but shown as: <level> R *. I don't really get what's wrong in the code. Missing parantheses or whatever, or just need to add some small check, just guesses. The code is quite messy, but works for everything else that I want.

    Code:
    [Name = Name('player') ? '<<<You!>>>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Elite' ? '+' ! Classification = 'Rare' ? 'R':Color("EEA2AD") ! Classification = 'Boss' ? '+')) ' ' (((((not IsTapped & Name:Contains(' ') & Length(Name) > 11) ? ClassColor Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ") Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil) ! not IsTapped & Name:Truncate(11, nil):ClassColor))) ((((IsTapped & Name:Truncate(11, nil):Gray) or IsTapped) & Name:Contains(' ') & Length(Name) > 11) ? Gray Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ") Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil))) or ((IsTapped & not IsPlayer & Length(Name)) < 11 ? Name)) [IsTapped & not IsPlayer ? '*':Gray]]
    Need help!

  2. #2
    Deleted
    I'm pretty sure that should throw an error as soon as you try to load it. Question mark syntax is a thing in some languages (PHP, for example), but Lua isn't one of them.

  3. #3
    Quote Originally Posted by Treeston View Post
    I'm pretty sure that should throw an error as soon as you try to load it. Question mark syntax is a thing in some languages (PHP, for example), but Lua isn't one of them.
    This works perfectly. It's DogTags, not LUA code. DogTags are used for CowTip addon, and Pitbull 3(4), probably for more addons, but these I know of. I am sorry for not making it more clear. If you check out either CowTip (if that still works) or Pitbull, and then you can see how DogTag codes work. They are a bit odd.

  4. #4
    Deleted
    Oh, sorry, I didn't read the DogTag part.

  5. #5
    Quote Originally Posted by Treeston View Post
    Oh, sorry, I didn't read the DogTag part.
    It is possible to do this in LUA too, but I don't have a clue how to do that though.

  6. #6
    Deleted
    Well this was outright traumatic to try to parse.

    I could be wrong since I haven't used DogTags in ages, but I believe the issue is that in "(IsTapped & not IsPlayer & Length(Name)) < 11 ? Name", near the end, you have the "< 11" outside the last parenthesis when it should be inside.

  7. #7
    Quote Originally Posted by Constie View Post
    Well this was outright traumatic to try to parse.

    I could be wrong since I haven't used DogTags in ages, but I believe the issue is that in "(IsTapped & not IsPlayer & Length(Name)) < 11 ? Name", near the end, you have the "< 11" outside the last parenthesis when it should be inside.
    Thanks for your answer. When I read about it it seems to make sense, but like I said (and you noticed) the code is very messy and I almost get a headache when reading and trying to focus on the code.
    I will try out your way and see if that's indeed the problem. Thanks again!

    Edit: It did not help at all. I am really confused with all parantheses. Thanks for trying though.

    - - - Updated - - -

    Anyone else want to get a headache trying to fix this?
    Last edited by skmzarn; 2013-11-26 at 08:28 PM.

  8. #8
    Deleted
    So I don't have a convenient rare mob to test this on that I know of, but I'm noticing that if I use your code and switch the places of "Boss" and "Rare" and then target a tapped Raider's Training Dummy then it correctly shows up as "??R RT. Dummy*". That seems to suggest that the code is fine, but something goes wrong with the "Classification = 'Rare'" part - possibly you're encountering a DogTags bug. If you remove the whole truncation part, does it work properly then?

    Code:
    [Name = Name('player') ? '<<<You!>>>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Elite' ? '+' ! Classification = 'Rare' ? 'R':Color("EEA2AD") ! Classification = 'Boss' ? '+')) ' ' Name)]

    If not, keep removing parts until you find the simplest version of your text that doesn't work properly, and post that.

    (Of course, the best thing to do would be to rewrite this whole thing with LuaTexts, since that's better and easier to debug...)

  9. #9
    The truncation part is what's so screwed up and it's very well possible that the error is there somewhere. I have tried to change the parantheses around, and I just can't get it to show other than "*" on a tagged rare mob, everything else works fine. The annoying part is to always have a rare mob handy. Guess it's possible to change the classification to something else meanwhile, just don't know to what just for testing.

    You're right. The absolutely best thing would be to rewrite the whole code to LuaTexts, but I have no clue about that coding at all and I cannot really ask someone to do it for me unless it could be a very good code to use for anyone, since I do think it's a really handy and good function we have here that can be modified as well.

    Gonna do some tests and see if I can find what's causing this. See if I actually get the first code you pasted without errors for rares. Going to the Timeless Isle to test. Thanks so much for replying and helping out though. It's very appreciated!

    Edit: I've noticed that the Timeless Isle rares doesn't count as rares for some reason, atleast Pitbull can't recognize them as being Rares.

    Anyways, after an hour or so trying to track the error, it seems that whenever a mob has a short name and is tagged by someone (not me), the name won't show, and only the level will be shown, with the "*" in the end. So I don't think it has anything to do with the mob being a Rare, because that part seems bugged, and shouldn't screw this up.

    Edit 2: Maybe I actually solved it, atleast it looks good. Gonna give it a day or two and see if it fucks up, here's the code:

    Code:
    [(Name = Name('player') ? '<<<You!>>>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Elite' ? '+' ! Classification = 'Rare' ? 'R':Color("EEA2AD") ! Classification = 'Boss' ? '+')) ' ' (((((not IsTapped & Name:Contains(' ') & Length(Name) > 11) ? ClassColor Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ") Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil) ! not IsTapped & Name:Truncate(11, nil):ClassColor))) ((((IsTapped & Name:Truncate(11, nil):Gray) or IsTapped) & Name:Contains(' ') & Length(Name) > 11) ? Gray Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ") Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil)) or (IsTapped & Length(Name) < 11) Name:Gray))) (IsTapped & not IsPlayer ? '*':Gray)]

    I don't know what I did really, but I switched around the parentheses and removed some parts. You can just compare the codes. But the Rare classification seems bugged for Timeless Isle rares for some reason. Maybe they have new codes?
    Last edited by skmzarn; 2013-12-02 at 06:54 PM. Reason: Stupid.

  10. #10
    High Overlord Pelf's Avatar
    15+ Year Old Account
    Join Date
    Mar 2008
    Location
    US-Sargeras
    Posts
    108
    Sometimes, taking some time to indent something that complex can help to see what's going on:
    Code:
    [
        (
            Name = Name('player')
                ? '<<<You!>>>'
                ! (
                    (AFK or DND) ' ' DifficultyColor (
                        Level (
                              Classification = 'Elite'
                            ? '+' ! Classification = 'Rare'
                            ? 'R':Color("EEA2AD")
                            ! Classification = 'Boss'
                            ? '+'
                        )
                    )
                    ' '
                    (
                        (
                            (
                                (
                                      (not IsTapped & Name:Contains(' ') & Length(Name) > 11)
                                    ? ClassColor Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ")
                                        Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil)
                                    ! not IsTapped & Name:Truncate(11, nil):ClassColor
                                )
                            )
                        ) (
                            (
                                (
                                      (IsTapped & Name:Truncate(11, nil):Gray) or IsTapped) & Name:Contains(' ') & Length(Name) > 11)
                                    ? Gray Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ")
                                      Name:Substring(-15, -1):Replace(" ", "                       "):Substring(-15, -1):Replace(" ", ""):Truncate(11, nil))
                                        or
                                      (IsTapped & Length(Name) < 11) Name:Gray
                    )
                )
        ) (
              IsTapped & not IsPlayer
            ? '*':Gray
        )
    ]

    I am not totally sure I remember DogTag syntax properly, but "_ ? _ ! _" is "this or this else this", right? If so, that bit I highlighted in red is "this or this or this else this or this". Something like that (which might work, I'm just using it as an example) can be difficult to read without knowing the proper order of operations. Is it "(this or this or this) else (this or this)" or is it "(this or this or this else this) or (this)"? Anyway, glad you got it working .
    Shiboomi of <Riot> on US-Sargeras

  11. #11
    Deleted
    Quote Originally Posted by skmzarn View Post
    But the Rare classification seems bugged for Timeless Isle rares for some reason. Maybe they have new codes?
    Are they rare elites? If so they might be getting classified as "Rare-Elite" instead.

    Quote Originally Posted by Pelf View Post
    I am not totally sure I remember DogTag syntax properly, but "_ ? _ ! _" is "this or this else this", right? If so, that bit I highlighted in red is "this or this or this else this or this". Something like that (which might work, I'm just using it as an example) can be difficult to read without knowing the proper order of operations. Is it "(this or this or this) else (this or this)" or is it "(this or this or this else this) or (this)"? Anyway, glad you got it working .
    "a ? b ! c" is "if a then b else c", so the red part should be "else if (Classification == 'Boss') then '+'".

  12. #12
    Cool, Pelf. That looks much better. Constie is right with the syntax. Dogtags is kind of confusing and messy in general.

    That's a really good question though if they are counted as Rare-Elite. But is there even a code for that in Dogtags? I mean, there are rare-elites in Pandaria in general afaik, and I think they show as 90R. No indication that they are elite AND rare though, just rare or elite. Gotta check up on this. Thanks guys.

Posting Permissions

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