Topic
Pitbull Dogtag to replace ToT's name with You.
|
Edited by Shouji on 03/12/10 10:18 (GMT)
I am using this wonderful code below for Target's target, and all I want is this code to be ignored if the target's target is ME. Then I want it to be shown as '<You!>' instead. I can't for the love of god figure out how to get such code into this code below. Thanks!
[(AFK or DND) " " (Level (if Classification:Contains("Boss") then |
|
|
Edited by Zhaena on 03/12/10 16:53 (GMT)
Aloha!
I'm not sure what your'e trying to do with your names there, so I cut that short. But apart from that the follwoing code should do what you want: [Name = 'Shouji' ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+'):DifficultyColor) ' ' Name:ClassColor)] |
|
Thanks for your code. Unfortunately this will make another Name into the whole code. And if it is possible I'd like to have the name Shouji as var, incase I am playing on another char.
I tried [Name = 'Shouji' ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+'):DifficultyColor) ' ' Name:ClassColor)] And if I use another char, it will print that name instead. I want the whole code to be used, so if I am this target, the name and level will turn into "<You!>", but if this target is NOT me, nomatter what char I am on, if it's another player, a pet, a npc, whatsoever, the level and name will work as usual, and use the followup code as shown. All that stuff will shorten down the name into L. Deathwhisper, TL. King, etc, and I love that code, and want to use it. But that one is not needed if the target is ME, which then it should be ignored. Sorry if I make things complicated, I love that you are trying to help me. Hope you are still interested in doing so. :) |
|
|
Edited by Zhaena on 03/12/10 18:00 (GMT)
Let's see...
1. Here's a version with your char's name as a var: [Name=Name('player') ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+'):DifficultyColor) ' ' Name:ClassColor)] 2. As I said, I cut your code for names short, which means you'll have to replace my "Name:Classcolor" with whatever you want instead (inside the brackets!). 3. I'm sorry to disapoint you, but the code you're using for names does not shorten them in the way you describe. Using it "Chris Miller" becomes "C. ChrisMiller" "Stormwind Fisherman" becomes "S. mwindFisher" and so on. As far as my knowledge / available documentation of DogTogs goes, it's not possible to do what your'e trying, because all names are a single string and there is no function to get the postition of a certain value inside the string. Or in simpler words: we can't tell dogtags where the first name ends and the surname beginns. (And if I'm wrong here and somebody knows a way, please tell us!) |
|
Edited by Shouji on 03/12/10 22:46 (GMT)
It is indeed very odd. Because all long names I have tried works perfectly as I have described it. I have tested it several times on both double names, and triple names. Long as short ones.
They fit perfectly, and work the way I want it and described it. Atleast those names I have tested. You tested these dogtag codes with Luatext 3.0 with Pitbull 4 or even 3? Because I am sure they won't work at all with Pitbull 4 and Luatext 4.0. I am myself using Pitbull 4 with Luatext 3.0, and it works flawlessly. Great with the var for my name, thanks! Do you mind showing me your code with everything included that should replace the Name:Classcolor and include my code to short down the text? I really suck coding. So I apologize for being dumb and so. Going to log in now and see if I understood your point. Otherwise I thank you for all your time you have put into this to help me. It is very much appreciated. :) EDIT: With your code, the first one that makes the "<You!>" and then include my code after, will make the name work like you said. F-cked up. Not sure what causes it exactly. But try without your first code, and it will work perfectly. So it's something wrong in your first code that does something to the below code for shorten down the name correctly. EDIT 2: This code below will work perfectly so the names will not get f-cked up. Have to start from there somehow.. [(AFK or DND) " " (Level (if Classification:Contains("Boss") then |
|
Edited by Milq on 03/12/10 22:30 (GMT)
I got a question tough it might not be in topic and it might be kinda stupid but I've been looking for an answer and never really found it :p. Anyway here goes:
How can I get 2 lines below my target frame as folowed: |__________| Milq 80 Mage Every time I try it, it puts the class NEXT to the name, or in front of it, how can I make sure it gets on the second line :p Thanks! |
|
Edited by Shouji on 03/12/10 23:45 (GMT)
I think I made this almost work. This seems to make the npc names correctly shortened down, but if Player is the target it will say: "<You!>" followed by the actual name, which should be hidden at this stage.
So it is currently: "<You!> Shouji" So all that seems to be needed now is to hide the name after, so it only shows "<You!>". Almost there. :) [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+'))):DifficultyColor] [(if ((Abbreviate(Name) ~= Name) and (Length(Name) > 11)) then EDIT: Somehow we must include the first code into the second one inside the same brackets, I guess.. EDIT 2: Think I solved it. Check this out. [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+' ! Classification = 'Elite' ? '+'))):DifficultyColor] [(if ((Abbreviate(Name) ~= Name) and (Length(Name) > 11)) then This works. Have no idea why it shouldn't work for you. But I could printscreen and show you if you want. Let me know if this worked for you. |
|
|
Edited by Zhaena on 03/12/10 23:55 (GMT)
@ Shouji
I don't know why the code you posted seems to work for you. When I use it (direct copy & paste), I get the botched names. And in all honesty - reading the code I wouldn't understand if it'd result in anything different than it does for me. In any case - I integrated your code into mine and tried to tighten it up a little bit. [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+')) ' ' ((Name:Contains(' ') & Length(Name) > 11) ? ClassColor Abbreviate(Name):Substring(1, (Length(Abbreviate(Name)) - 1)):Append(". ") Name:Substring(-15, -1):Replace(" ", ""):Truncate(11, nil) ! Name:Truncate(11, nil)))] And a direct integration without any changes would be this: [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+')) ' ' (if ((Abbreviate(Name) ~= Name) and (Length(Name) > 11)) then At least for me the result is exactely the same in both cases, but as I said - botched. @ Milq: As far as I know, there is no way of doing that with Pitbull + DogTags. DogTags have no function to start a new line. And Pitbull doesn't allow to align two seperate lines above each other, using the same anchor. It might very well be possible to do what you want using LuaText instead of DogTags, but I can't really help you there... Edit: Shouji, as I said, I have no idea why the code would work the way you described. For me it doesn't and a "Sentinel Hill Guard" still becomes a "SH. inelHillGua" But if for you it does what you want, then there is nothing left for me to say but "grtz" ;D |
|
|
Edited by Zhaena on 04/12/10 01:56 (GMT)
"not IsPlayer" means "show only when it's not a player", so that isn't unexpected. :)
I quoted codes that correctly integrate what you posted in my last answer. For me they still break the names and I wouldn't know why the result should be any different. I'm sorry, but I don't think I can really help you much further without understanding why our addons would behave so differently from each other... |
|
Edited by Shouji on 04/12/10 09:29 (GMT)
Yeah. That was my point to ignore Player totally, so other player's names could be shown.
But like already mentioned, I suck coding, modifying, whatsoever. But I tried your last codes, and they indeed appear the same for me. Wrong. 85 O. OrgrimmarGr etc. But with my last code, they appear correctly. Let me quote it once again. Please try it. [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+' ! Classification = 'Elite' ? '+'))):DifficultyColor] [(if ((Abbreviate(Name) ~= Name) and (Length(Name) > 11)) then |
|
Edited by Milq on 04/12/10 11:15 (GMT)
@ Zhaena:
To start a new line you can use \n I've found! So for example to have 2 times my name under my unit frame in 2 lines you'll have to do return "%s\n%s", Name(unit), Name(unit) Sorry for ninja'ing the topic :p |
|
Edited by Shouji on 04/12/10 11:27 (GMT)
It's fine, Milq. I think we can close this thread anyways, since I solved it.
Zhaena, thank you so very much for your help, I finally made it work. But the key is to first copy the text from the quote, then paste it and modify it to fit on one line. Then you can copy/paste it into Pitbull, and it _should_ work. [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+')) ' ' ((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) ! Name:Truncate(11, nil):ClassColor))] Here's the final one, The Replace(" ", " ") and Replace(" ", "") made it work. With all the spaces. EDIT: Now I can see why it doesn't work for you. Since the Replace code gets different, but when pasting to this forum, it's reset. It should be: Replace(" ", "xxxxxxxxxxxxxxxxxxx") and Replace("x", "") Replace all "x" with empty spaces, then it will work. For some reason.. |
|
|
Edited by Zhaena on 04/12/10 11:54 (GMT)
Hey Milq!
Your screenshot shows the RothUI, which doesn't use Pitbull at all but oUF. That's basically a technical framework for Unitframes where you have to code the actual design by yourself, using Lua. And as I said, with Lua / LuaText it's possible to create the layout you want to use, but not with the combination of DogTags + Pitbull. @ Shouji: Ahaaa, then I get why it works. Nice trick, wouldn't have thought of that. Here's an optimized code of what you did. You don't even have to replace the 'xxxxxxx' :) [Name = Name('player') ? '<You!>' ! ((AFK or DND) ' ' DifficultyColor (Level (Classification = 'Rare' ? 'R' ! Classification = 'Boss' ? '+')) ' ' ((Name:Contains(' ') & Length(Name) > 11) ? ClassColor Abbreviate(Name):Truncate(Length(Abbreviate(Name)) - 1, nil):Append('. ') Name:Replace(' ','xxxxxxxxxxxxxxx'):Substring(-15, -1):Replace('x', ''):Truncate(11, nil) ! Name:Truncate(11, nil)))] |
