 |
| Welcome to Elitist Jerks |
We're testing some new features on the site regarding OpenID registration and coordination with gamerDNA. If you experience any issues with registering an account, please take the time to fill out a report and send it to this e-mail address. We would appreciate any assistance you could provide in making sure everything is functioning as intended. Thanks!
If this is your first visit, please be sure to check out the FAQ and the forum rules. Users must register to post and new registrations are subject to a one day "mute" period to get acquainted with the community.
|
06/17/09, 6:04 PM
|
#26
|
|
Von Kaiser
|
Originally Posted by Dankz
and I get | Interfaceiconsicon_arcbrill:0
Also I'd for a Mage I only care if they have one of the 4 types of Intellect buffs, not if they don't have all 4.
|
You need |T to start the icon, followed by the path and then a : and then a number for the size and then |t to end it.
You can just use one variable. This is probably what you want:
local i = 1
local int = true
while true do
local name = UnitAura(unit,i,"HELPFUL")
if not name then
break
elseif name == "Arcane Intellect" then
int = false
break
elseif name == "Arcane Brilliance" then
int = false
break
elseif name == "Dalaran Brilliance" then
int = false
break
end
i = i + 1
end
if int then
return "|T\\interface\\icons\\icon_int:0|t"
end
The breaks stop the loop as soon as it finds one of the buffs. Since you only care if any of them are there. Also note you need to use two \\ to mean one since \ is an escape character in Lua.
|
|
|
|
|
|
06/17/09, 6:07 PM
|
#27
|
|
Von Kaiser
|
Originally Posted by Zeelian
I know im asking a lot, but since i can't seem to learn lua properly myself you guys are my only chance to get all of this working.
Huge thanks with optional hugs for whatever help you guys can give with this!
|
I'll try to get through these later. Some of those are gonna take me a bit to go through and "unparse". So I can write them as LuaTexts.
|
|
|
|
|
|
06/18/09, 1:54 AM
|
#28
|
|
Don Flamenco
Gnome Warlock
Alterac Mountains
|
A) Thanks for the continued work on pitbull
B) How much memory would I be looking at saving by switching to luatexts from dogtags, I have a MASSIVE amount of tags that I run at the moment and the idea of having to try and swap some of these over to LUA is incredibly daunting as some of them took me multiple hours just to figure out in dogtags (and I would go so far as to say I am very good at using dog tags) and I'm wondering just how memory saving will this be?
|
|
The character linked in your profile appears to be below level 10. This may account for your poor Patchwerk DPS.
|
|
|
|
|
06/18/09, 2:54 AM
|
#29
|
|
Von Kaiser
|
Originally Posted by supplicium
A) Thanks for the continued work on pitbull
B) How much memory would I be looking at saving by switching to luatexts from dogtags, I have a MASSIVE amount of tags that I run at the moment and the idea of having to try and swap some of these over to LUA is incredibly daunting as some of them took me multiple hours just to figure out in dogtags (and I would go so far as to say I am very good at using dog tags) and I'm wondering just how memory saving will this be?
|
A) Sure thing.
B) Hmm I haven't paid that much attention to the memory savings lately but it's likely to be fairly significant if you actually top running LibDogTag-3.0 and LibDogTag-Unit-3.0 entirely. In my experience LuaTexts nominally increases PB4's memory usage and you eliminate all of those library usages. I'd figure on LuaTexts adding 200k or so to PB4. Might be more or less depending on your tags. Then just subtract out whatever those libraries are using.
If you're using DogTags in something else like CowTip then you won't be able to eliminate these libraries and you won't probably see any memory reduction since they'll still be running.
|
|
|
|
|
|
06/18/09, 10:48 AM
|
#30
|
|
Glass Joe
|
from "Class: Standard"
local dr,dg,db = DifficultyColor(unit)
local form = DruidForm(unit)
if UnitIsPlayer(unit) or (not UnitIsFriend(unit,"player") and not IsPet(unit)) then
local cr,cg,cb = ClassColor(unit)
if form then
return "%s |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r (%s) %s",Classification(unit) or '',dr,dg,db,Level(unit),cr,cg,cb,Class(unit),form,SmartRace(unit) or ''
else
return "%s |cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s",Classification(unit) or '',dr,dg,db,Level(unit),cr,cg,cb,Class(unit),SmartRace(unit) or ''
end
else
if form then
return "%s |cff%02x%02x%02x%s|r (%s) %s",Classification(unit) or '',dr,dg,db,Level(unit),form,SmartRace(unit) or ''
else
return "%s |cff%02x%02x%02x%s|r %s",Classification(unit) or '',dr,dg,db,Level(unit),SmartRace(unit) or ''
end
end
the Classification(unit) or '' sill leaves a space at the beginning of the string "%s |cff%..." i wonder how to get rid of that... Append(' ') somewhere?
thanks
Last edited by rakkarage : 06/18/09 at 1:31 PM.
|
|
|
|
|
|
06/18/09, 2:31 PM
|
#31
|
|
Piston Honda
|
Rakkaragee: I'm now sure what exactly you mean. Care to give us an example?
|
correlation =/= causation
|
|
|
|
06/18/09, 2:39 PM
|
#32
|
|
Glass Joe
|
i got 2 lines of text on left side of frame name and class like so
that extra space comes from the space after the classification text for any unit that does not have a classification... could it be something like
Classification(unit)+' ' or ''
edit: i think this is not noticed because usually class right aligned?
Last edited by rakkarage : 06/18/09 at 2:47 PM.
|
|
|
|
|
|
06/18/09, 5:51 PM
|
#33
|
|
Don Flamenco
Gnome Warlock
Alterac Mountains
|
Allright I'll bight and ask for a conversion or 2 of the larger tags.
[(if IsMouseOver then
HP:White
else
(if ~IsMaxHP and InCombat then
(if HP = 0 then
Dead
elseif HP > 999999 then
(HP:Round(1) * (10 ^ -6)):Round(1)
elseif HP > 999 then
(HP:Round(-2) * (10 ^ -3))
elseif HP > 0 then
HP
end):White
end) (if ~IsMouseOver and ~IsMaxHP and InCombat then
(if HP <= 999 then
nil
elseif HP > 999999 then
"M":White
elseif HP > 999 then
"k":White
end)
end)
end)]
|
|
The character linked in your profile appears to be below level 10. This may account for your poor Patchwerk DPS.
|
|
|
|
|
06/18/09, 6:15 PM
|
#34
|
|
Piston Honda
|
local cur,max = HP(unit),MaxHP(unit)
if IsMouseOver() then
return "%s",cur
else
if cur~=max and UnitAffectingCombat('player') then
if cur==0 then
return "Dead"
elseif cur>999999 then
return "%sM",floor(cur/1000000)
elseif cur>999 then
return "%sK",floor(cur/1000)
else
return "%s",cur
end
end
end
The only issue lies in there being no Event for IsMouseOver() or UnitAffectingCombat() in LuaText
ps: "Bight" != "Bite"
Last edited by Hotan : 06/18/09 at 6:37 PM.
|
correlation =/= causation
|
|
|
|
06/18/09, 6:33 PM
|
#35
|
|
Von Kaiser
|
Originally Posted by Hotan
The only issue lies in there being no Event for IsMouseOver() or UnitAffectingCombat() in LuaText
|
IsMouseOver() doesn't need an event. Using the function flags the text for update when the mouse enters or leave the frame the text is attached to.
PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED can be setup to work as an event for UnitAffectingCombat("player") (doesn't work for any other unit other than yourself, but then the code you were using was just for yourself anyway). Go to Modules, LuaTexts create new events with the names given above. Check the box for player and uncheck unit.
|
|
|
|
|
|
06/18/09, 6:37 PM
|
#36
|
|
Von Kaiser
|
Originally Posted by rakkarage
i got 2 lines of text on left side of frame name and class like so
that extra space comes from the space after the classification text for any unit that does not have a classification... could it be something like
Classification(unit)+' ' or ''
edit: i think this is not noticed because usually class right aligned?
|
Yup it's a bug where I got lazy. I'll get it fixed.
|
|
|
|
|
|
06/18/09, 6:41 PM
|
#37
|
|
Piston Honda
|
deleted
Last edited by Hotan : 06/19/09 at 8:36 PM.
|
correlation =/= causation
|
|
|
|
06/18/09, 7:45 PM
|
#38
|
|
Von Kaiser
|
Work in progress to convert these...
Some are done... Will work more on this after raid.
Originally Posted by Zeelian
The first bunch of codes are nestled with raidframe name and don't seem to work right for DC.
I cut out the relevant code for each part (hopefully i got all the little things cut properly).
With PB4's way of managing text positions i should be able to have them all as separate texts and let PB4 handle the spaces and such.
|
[(IsLeader ? "!":Color("00FF00")) (IsMasterLooter ? "!":Color("FFFF33")) Name:Truncate(9, nil):Prepend(" ") (~IsMaxLevel ? "*":Color("FFFFFF"):Prepend(" ")) ShortDruidForm:Angle:Color("FFAAAA"):Prepend(" ") " " (~Status ? IsMana ? IsMaxMP ? MaxMP:Short ! PercentMP:Percent) (DeadType ? DeadType = "Ghost" ? "Run! " ! "Rip ") DeadDuration:FormatDuration:Paren (Offline ? "DC ") OfflineDuration:FormatDuration:Paren]
Power: Show mana only, show as X.xk when full and X.x% when not full.
Also when AFK, Dead/Ghost or Offline replace mana display with AFK (AFK:Time), Dead (RIP:Time), Ghost (Run!:Time) and Offline (DC:Time).
|
(~Status ? IsMana ? IsMaxMP ? MaxMP:Short ! PercentMP:Percent) (DeadType ? DeadType = "Ghost" ? "Run! " ! "Rip ") DeadDuration:FormatDuration:Paren (Offline ? "DC ") OfflineDuration:FormatDuration:Paren]
|
ML/RL: Yellow ! for ML, Green ! for Leader
|
Finding out if someone is MasterLooter is kinda a pain might be nice to add a helper for that.
local is_leader = UnitIsPartyLeader(unit)
local is_ml
local name, server = UnitName(unit)
if server and server ~= "" then
name = name .. "-" .. server
end
for i = 1, GetNumRaiderMembers() do
local n, _, _, _, _, _, _, _, _, _, ml = GetRaidRosterInfo(i)
if n == name then
is_ml = ml
break
end
end
if is_leader and ml then
return "|cff00ff00!|r|cffffff33!|r"
elseif is_leader then
return "|cff00ff00!|r"
else
return "|cffffff33!|r"
end
|
Level indicator: A white * if the person is not max level
|
White is the default anyway so pretty straightforward.
if Level(unit) ~= MAX_PLAYER_LEVEL then
return "*"
end
|
Forms: 2 letters indicating druid form and 1 letter ( S ) indicating shadowform (current has druid form only)
|
Hmm apparently I never made a ShortDruidForm but this will work for now:
local form = DruidForm(unit)
if not form then
return
elseif form == "Bear" then
form = "Be"
elseif form == "Cat" then
form = "Ca"
elseif form == "Moonkin" then
form = "Mk"
elseif form == "Aquatic" then
form = "Aq"
elseif form == "Flight" then
form = "Fl"
elseif form == "Travel" then
form = "Tv"
elseif form == "Tree" then
form = "Tr"
end
return "|cffffaaaa<%s>|r",form
|
Name: Player name with 9 letters (this one probably isn't very hard thou, i just can't seem to think straight today)
|
return string.sub(Name(unit),1,9)
|
Next bunch is the target info tag (same as above about being nestled and wanting to make them separate texts)
|
[(~IsPlayerOrPet ? CreatureType:Hide("Unknown", "Not specified"):Append(" ")) (~IsPet ? Level:Hide("??"):DifficultyColor:Append(" ") ! Level) " " (~IsPlayerOrPet ? Classification:Contains("Rare") ? "R":Gray) (~IsPlayerOrPet ? Classification:Contains("Elite") ? "E":Yellow) (~IsPlayerOrPet ? Classification:Contains("Boss") ? "B":Red) Faction:IsIn("Alliance", "Horde"):Truncate(1, ellipses=false):Prepend([~IsFriend ? "player":PvP] ? [PvP ? Red ! Yellow] ! [PvP ? Green ! Blue]) " " (IsPet ? Guild) (IsPlayer ? Class:ClassColor:Prepend(" "))]
|
Creature type: basicly the beast/mechanical and so on and hiding unknown and not specified
|
Unknown was what DogTags used when UnitCreatureType returned nil so we don't have to actually look for it.
if not(UnitIsPlayer(unit) or UnitPlayerControlled(unit) or UnitPlayerOrPetInRaid(unit)) then
local creature_type = UnitCreatureType(unit)
if creature_type and creature_type ~= "Not specified" then
return creature_type
end
end
|
Level: Difficulty colored level (take out the Append(" ") since it won't be needed when each part is a separate text)
|
(~IsPet ? Level:Hide("??"):DifficultyColor:Append(" ") ! Level)
|
Rare, Elite, Boss indicator: Nothing special here.
|
(~IsPlayerOrPet ? Classification:Contains("Rare") ? "R":Gray) (~IsPlayerOrPet ? Classification:Contains("Elite") ? "E":Yellow) (~IsPlayerOrPet ? Classification:Contains("Boss") ? "B":Red)
|
Faction and PvP: A for alliance and H for horde, colored based on PvP flagg (about the same as the default names are colored). My faction green for pvp on, blue for pvp off. Opposite faction depends on my pvp state (yellow if im off and they are on, red if both are on and blue if both are off) Currently i only play alliance and tag might reflect that (i haven't made the tag myself so i don't really know)
|
Faction:IsIn("Alliance", "Horde"):Truncate(1, ellipses=false):Prepend([~IsFriend ? "player":PvP] ? [PvP ? Red ! Yellow] ! [PvP ? Green ! Blue]) " " (IsPet ? Guild) (IsPlayer ? Class:ClassColor:Prepend(" "))
|
And a few for target name tag aswell.
|
[Name:ClassColor " " (IsPlayer ? Guild:Truncate(34, nil):Bracket:Color("eeaaee")) " " (HasAura("Unstable Affliction") ? "UA":Color("Red"):Angle) (HasAura("Shadowform") ? "S":Color("dda0dd"):Angle) ShortDruidForm:Color("dda0dd"):Angle (PvP ? "!":Color("FF0000"):Prepend(" "))]
(IsPlayer ? Guild:Truncate(34, nil):Bracket:Color("eeaaee"))
|
Extra PvP indicator: Red ! if pvp on and remove the Prepend(" ")
|
(PvP ? "!":Color("FF0000"):Prepend(" "))
Last edited by Shefki : 06/18/09 at 8:25 PM.
|
|
|
|
|
|
06/18/09, 7:58 PM
|
#39
|
|
Glass Joe
|
thanks shefki!
"Rare, Elite, Boss indicator: Nothing special here."
i guess u want text... but frame borders work well for this
Last edited by rakkarage : 06/18/09 at 9:25 PM.
|
|
|
|
|
|
06/18/09, 7:58 PM
|
#40
|
|
Piston Honda
|
(~IsPlayerOrPet ? CreatureType:Hide("Unknown", "Not specified")
|
crefam = UnitCreatureFamily(unit)
if crefam=="Unkown" or crefam=="Not Specified" then
return ""
else
return "%s",crefam
end
|
correlation =/= causation
|
|
|
|
06/18/09, 8:13 PM
|
#41
|
|
Von Kaiser
|
Originally Posted by Hotan
crefam = UnitCreatureFamily(unit)
if crefam=="Unkown" or crefam=="Not Specified" then
return ""
else
return "%s",crefam
end
|
See my tag above. WoW API never actually returns Unknown that's a DogTag thing. Don't bother to return "" LuaTexts already handles that for you. Makes the code cleaner to just return nothing.
|
|
|
|
|
|
06/18/09, 9:19 PM
|
#42
|
|
Glass Joe
Night Elf Priest
Azjol-Nerub (EU)
|
Originally Posted by rakkarage
thanks shefki!
edit: can anyone tell me how to append a space to a %s value?
"Rare, Elite, Boss indicator: Nothing special here."
i guess u want text... but frame borders work well for this
|
Aye, want it as text since i use Roth border texture, and that won't take colors to well.
Shefki, huge thanks! I will test these out right away!
Did some digging and managed to get the class color in there, seems this old dog can actually learn some minor tricks still.
local r,g,b = ClassColor(unit)
return '|cff%02x%02x%02x%s|r ',r,g,b,string.sub(Name(unit),1,9)
One more, how would i do to make a missing HP text?
Raid health text showing X.xk when full, missing amount when not full, hidden when dead or offline.
Guessing i need some maths done with HP(unit) and MaxHP(unit).
Last edited by Zeelian : 06/18/09 at 10:45 PM.
|
|
|
|
|
|
06/18/09, 10:23 PM
|
#43
|
|
Von Kaiser
|
Well they're not all done yet. Still got some more stuuff to work on.
|
|
|
|
|
|
06/18/09, 10:49 PM
|
#44
|
|
Glass Joe
Night Elf Priest
Azjol-Nerub (EU)
|
Originally Posted by Shefki
Well they're not all done yet. Still got some more stuuff to work on.
|
Has given me a more familiar base to start figuring out the code around. Its hard for me to try to figure it out from tags i don't use my self, but with familiar tags im starting to understand some of the basics.
|
|
|
|
|
|
06/18/09, 11:18 PM
|
#45
|
|
Piston Honda
|

Originally Posted by Hotan
thanks Shefki,
Hex/base10 ARRRGHG. To be clear %02x means you are giving it numbers and 0xFF means you are giving it hex?? I'm not quite clear with how to input it as hex, although it isn't hard to input as base10.
I know I need two loops for HARMFUL and HELPFUL. There is only going to be one loop, HARMFUL in the final version. In the test form it just won't find some things it is looking for because they aren't relevant.
For people who are interested (prevent further questions) here is an image of the tag in action, and the code I am ending up using:

if not UnitIsFriend(unit,'player') then
local i = 1
local ttw,dam,hit,crit,wisdom= false,false,false,false,false
local tr,tg,tb = 255,00,00
local dr,dg,db = 255,00,00
local hr,hg,hb = 255,00,00
local cr,cg,cb = 255,00,00
local wr,wg,wb = 255,00,00
while true do
local name,_,icon = UnitAura(unit,i,"HARMFUL")
if not name then
break
elseif name == "Thunder Clap" then
ttw = true
elseif name == "Infected Wounds" then
ttw = true
elseif name == "Icy Touch" then
ttw = true
elseif name == "Earth and Moon" then
dam = true
elseif name == "Ebon Plague" then
dam = true
elseif name == "Curse of Elements" then
dam = true
elseif name == "Misery" then
hit = true
elseif name == "Faerie Fire" then
hit = true
elseif name == "Totem of Wrath" then
crit = true
elseif name == "Master Poisoner" then
crit = true
elseif name == "Heart of the Crusader" then
crit = true
elseif name == "Judgment of Wisdom" then
wisdom = true
end
i = i + 1
end
if ttw then
tr,tg,tb = 00,255,00
end
if dam then
dr,dg,db = 00,255,00
end
if hit then
hr,hg,hb = 00,255,00
end
if crit then
cr,cg,cb = 00,255,00
end
if wisdom then
wr,wg,wb = 00,255,00
end
return "|cff%02x%02x%02xT|r |n|cff%02x%02x%02xD|r |n|cff%02x%02x%02xH|r |n|cff%02x%02x%02xC|r |n|cff%02x%02x%02xW|r "
,tr,tg,tb,dr,dg,db,hr,hg,hb,cr,cg,cb,wr,wg,wb
end
PS: Hidden debuffs are evil (ie Judgment of the Just)
|
What would be the trick to make this horizontal instead of vertical?
And some of the Text is wrong is should be Improved Faerie Fire instead of Faerie Fire and Curse of the Elements not Curse of Elements.
|
|
|
|
|
|
06/19/09, 12:26 AM
|
#46
|
|
Glass Joe
Blood Elf Paladin
Firetree
|
Originally Posted by Dankz
What would be the trick to make this horizontal instead of vertical?
|
Remove the '|n's from the return string so that it looks like:
return "|cff%02x%02x%02xT|r|cff%02x%02x%02xD|r|cff%02x%02x%02xH|r|cff%02x%02x%02xC|r|cff%02x%02x%02xW|r" ,tr,tg,tb,dr,dg,db,hr,hg,hb,cr,cg,cb,wr,wg,wb
More useful information about escape codes can be found at the wowwiki page.
Edit: Chances are you can remove all but the last |r as well, no point in resetting the colour if you're just going to change it again.
|
|
|
|
|
|
06/19/09, 5:05 AM
|
#47
|
|
Glass Joe
|
Two simple questions:
How do you get power color? PowerColor(unit) doesn't seem to work.
How do you format numbers to be separated by commas? E.g. 2000000 -> 2,000,000.
|
|
|
|
|
|
06/19/09, 2:07 PM
|
#48
|
|
Glass Joe
|
|
Classification(unit)+' ' or ''
|
does not work...
|
Classification(unit) and ' ' or ''
|
seems to work but not if i reverse it?
|
' ' and Classification(unit) or ''
|
ya idk what i am doing... i guess the [or ''] is for error handling not formatting?
is there some kinda append or prepend or trim methods i can use
thanks
|
|
|
|
|
|
06/19/09, 4:18 PM
|
#49
|
|
Glass Joe
Blood Elf Death Knight
Eonar
|
Ok I am a beginner and I want to learn how to do this....my question is I enabled the LuaText module but where do I actually put in the code, in the interface or in the LUA files outside the game?
Nevermind I figured it out.
Last edited by effexor : 06/19/09 at 5:23 PM.
|
|
|
|
|
|
06/19/09, 5:35 PM
|
#50
|
|
Von Kaiser
|
Originally Posted by rakkarage
does not work...
seems to work but not if i reverse it?
ya idk what i am doing... i guess the [or ''] is for error handling not formatting?
is there some kinda append or prepend or trim methods i can use
thanks
|
+ is an mathematical operator, it's not useful on strings in Lua.
Lua doesn't have a proper ternary operator. You can get away with:
something and value_for_true or value_for_false
But if value_for_true actually evaluates to false then that won't work either. e.g.
something and false or true
Has to be written:
not something and true or false
You can do concatenation with .. e.g.
x = ' '..' '
Would set x to two spaces.
However, I'd suggestion that you avoid doing this. Consider the following expression:
a = a .. b
This is adding the string b onto the end of the a string. Lua doesn't just expand the a string and add the contents of b. Rather it makes new string consisting of a followed by b and replaces the old a. This means the old a has to be garbage collected and causes memory churn.
Now I'm not suggesting that you never ever do something like this. Sometimes there's just no good way to achieve what you want without doint a concatenation. For the purposes of formatting I'd suggest you put your spaces in format strings.
local classification = Classification(unit)
if classification then
return "%s %s",foo(unit),classification
else
return "%s",classification
end
Alternatively you can do something like this:
local classification = Classification(unit)
return "%s%s%s",foo(unit),classification and ' ' or '',classification
By returning the strings separated out like this and letting the Blizzard code put them together you actually save a lot of memory churn. This is why LuaTexts doesn't just expect you to provide a single completed string but rather the format string and arguments to pass through to SetFormattedText().
|
|
|
|
|
|
|