I shouldn't have used AFKDuration(unit) and obviously DNDDuration(unit) doesn't exist. Should have used:
IsAFK(unit) and IsDND(unit)
respectively. Sorry.
Haha, no need to say sorry, I wouldn't ever get this worked out without experienced help.
Switching AFKDuration(unit) and DNDDuration(unit) for IsAFK(unit) and IsDND(unit) returns this though..
Message: Interface\AddOns\PitBull4_LuaTexts\ScriptEnv.lua:328: attempt to index global 'dnd_times' (a nil value)
Time: 11/04/10 03:35:48
Count: 5
Stack: Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:752: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:707>
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1272: in function `AddFontString'
...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:118: in function `UpdateFrame'
...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:150: in function `ForceTextUpdate'
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1344: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1340>
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1414: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1410>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
(tail call): ?
...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:797: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:612>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
(tail call): ?
...nterface\AddOns\Aloft\Libs\AceGUI-3.0\AceGUI-3.0.lua:314: in function `Fire'
...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:44: in function <...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:41>
Switching AFKDuration(unit) and DNDDuration(unit) for IsAFK(unit) and IsDND(unit) returns this though..
Message: Interface\AddOns\PitBull4_LuaTexts\ScriptEnv.lua:328: attempt to index global 'dnd_times' (a nil value)
This is a bug in IsDND. Next release will fix it.
Fixed in the latest Alpha now. Kinda makes me mad, that bug is so stupid and so I'm sure someone had to hit it before. So I google for it and find this: http://paste.sc2mapster.com/950/
All he had to do is tell me and it'd be fixed. Instead he does nothing about it and you find it.
I actually found that post when googling in an attempt to see if it had already been reported. Seemed a bit weird that a bug would occur and people wouldn't notice it for 14 months.
Awesome, thanks for the fix and everything.
EDIT: Updated my PB and the bug is gone and at least either AFK or DND will show, but never both. I can control which one displays by changing the order of afk or dnd in this last line
return "%s %s%s%s",HP(unit),Angle(dnd or afk)
but it only shows whichever is displayed first, in the above case, that's <DND>. I can fraps it if you need to see it in action.
I
EDIT: Updated my PB and the bug is gone and at least either AFK or DND will show, but never both. I can control which one displays by changing the order of afk or dnd in this last line
return "%s %s%s%s",HP(unit),Angle(dnd or afk)
but it only shows whichever is displayed first, in the above case, that's <DND>. I can fraps it if you need to see it in action.
Sorry to keep bugging you with this ;(
You can't be DND AND AFK.
[22:29:30] You are now Busy: Busy
[22:29:33] You are no longer marked Busy.
[22:29:33] You are now Away: test
From doing the following two commands:
/dnd
/away test
Didn't understand what you meant but then I realised I had just explained the problem really poorly. What is actually happening is that one of <AFK> or <DND> will NEVER show by itself, I get that you can't be both away and busy. This is controlled by whatever condition comes first in the (afk or dnd) section. Swap them and the one that displays swaps.
Using the line
return "%s %s%s%s",HP(unit),Angle(dnd or afk)
I can type /dnd and the <DND> tag will appear.
After clearing dnd, I can type /afk and the <AFK> tag will not appear.
If I type /dnd and /afk after, the <DND> will disappear and not be replaced by <AFK>.
Didn't understand what you meant but then I realised I had just explained the problem really poorly. What is actually happening is that one of <AFK> or <DND> will NEVER show by itself, I get that you can't be both away and busy. This is controlled by whatever condition comes first in the (afk or dnd) section. Swap them and the one that displays swaps.
Change the or '' on the first two lines to or nil.
Hello. I've been trying for a couple days now to figured this out but without sucess.
Im using this code for level and name.
Outline()
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or
'',Name(unit)
Is there an way to do so the name turns out in class color?
Also how would one go about if i wanted the level and the short classification in a single color?
Hello. I've been trying for a couple days now to figured this out but without sucess.
Im using this code for level and name.
Outline()
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or
'',Name(unit)
Is there an way to do so the name turns out in class color?
[/code]
[code]
Outline()
local dr,dg,db = DifficultyColor(unit)
local cr,cg,cb = ClassColor(unit)
return "|cff%02x%02x%02x%s%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit),Classification(unit) and '+' or '',cr,cg,cb,Name(unit)
[/code]
[quote]
Also how would one go about if i wanted the level and the short classification in a single color?
The code you have already has the level and short classification as the same color.
I am attempting to create a custom LUA text. I have switched over from PB3 to PB4 and used to use a Trunc syntax in Dog Tags for Health.
What I used to have was of the format:
HP / MaxHP
999999/999999
with Trunc set to eg: 8 so that PB would return a maximum of 8 digits:
99999/999..
This worked great because as the mob got low on HP, MaxHP would fill out the other digits.
In PB4 I have come up with the following Lua Text:
local s = Status(unit)
if s then
return s
end
return "%s/%s",string.sub(HP(unit),1,6),string.sub(MaxHP(unit),1,6)
but because HP and Max(HP) are two separate variables I am having to fix the size of each variable. As a result, as HP changes, MaxHP stays fixed at 6 when there is ample room to display more.
Anyone know how I can do this with LUA Texts? Is there any way to treat HP+MaxHP as one string of text and apply the string.sub to the whole thing?
I am attempting to create a custom LUA text. I have switched over from PB3 to PB4 and used to use a Trunc syntax in Dog Tags for Health.
What I used to have was of the format:
HP / MaxHP
999999/999999
with Trunc set to eg: 8 so that PB would return a maximum of 8 digits:
99999/999..
This worked great because as the mob got low on HP, MaxHP would fill out the other digits.
In PB4 I have come up with the following Lua Text:
local s = Status(unit)
if s then
return s
end
return "%s/%s",string.sub(HP(unit),1,6),string.sub(MaxHP(unit),1,6)
but because HP and Max(HP) are two separate variables I am having to fix the size of each variable. As a result, as HP changes, MaxHP stays fixed at 6 when there is ample room to display more.
Anyone know how I can do this with LUA Texts? Is there any way to treat HP+MaxHP as one string of text and apply the string.sub to the whole thing?
Thanks very much in advance.
Woulnt it work better to use a version of "short" or "Very short" ?
Woulnt it work better to use a version of "short" or "Very short" ?
ie showing 99999/99999 as 99,99k or 99.9k
I'm really a bit of a perfectionist and I'm trying to recreate my previous UI as closely as possible. I'm also trying to get my head around LUA a bit better. Dog Tags was much easier but was more resource intensive compared to LUA texts.
I've recently switched to PitBull4 from xperl and I miss a feature that would show on raid units when they were being resed and who was doing the resing. I've been attempting to come up with an luatext for casting that can do something like this but it suffers from two major flaws. First, it displays the name of the res target on the casters cast bar as opposed to showing the name of the reser on the units frame somewhere, and this isn't exactly ideal. Second, if the reser changes to a new target while the res is still casting it doesn't maintain the original target..it just flips over to the new target. I know I like to pick up my next res target while I'm still casting the previous.
Here's a trimmed down version of what I've been trying:
local cast_data = CastData(unit)
local r,g,b = 255,255,255
local reslist = {
"Rebirth",
"Revive",
"Redemption",
"Resurrection",
"Ancestral Spirit",
"Goblin Jumper Cables",
"Goblin Jumper Cables XL",
"Gnomish Army Knife",
}
if cast_data then
local spell,stop_message,target = cast_data.spell,cast_data.stop_message,cast_data.target
local stop_time,stop_duration = cast_data.stop_time
for i=1,#reslist,1 do
if spell == reslist[i] then
return "|cff%02x%02x%02xRes %s|r",r,g,b,UnitName(unit.."-target")
end
end
end
I considered trying to use a global variable to set the target name, but then it occurred to me that id have to make a global variable for each reser in the raid somehow. And I don't want to start making too many global variables. However it would be possible to set a variable during only the first few ms of casting then stop for the rest of the duration of the cast by comparing cast_data.start_time with GetTime().
I've tried googling and searching this thread but haven't found any examples. Any assistance would be very much appreciated, and I apologize if this has already been covered somewhere else.
You'll probably want to use LibResComm to do the work for you. However, due to some limitations with the current LuaTexts setup using a library is troublesome. I haven't gotten around to dealing with this.
I am a bit curious as to why cast_data.target doesn't seem to return anything. The documentation says it returns the target of the spell "if available".
The game in general doesn't provide targeting information for spell casts other than your own. This is largely for PVP balance purposes. It's been requested in the past to expose more info and declined.
I'm trying to make the power text as dynamic as possible.
I have - of course - checked the Pitbull Unit Frames 4.0 pages on WowAce, and various pages on Wowpedia.
My code is as follows:
local cpwr = Power(unit)
local mpwr = MaxPower(unit)
if Power(unit,rage) and Percent(cpwr,mpwr) >= 1 then
return Power(unit)
elseif Power(unit,mana) and Percent(cpwr,mpwr) >= 1 then
return "%s/%s",Power(unit),MaxPower(unit)
end
Neither the rage check nor the mana check works.
They do the opposite of what I want them to do.
The rage check does "return "%s/%s",Power(unit),MaxPower(unit)"
and the mana check does "return Power(unit)".
I'm guessing it's just some pathetic error on my part, but it's annoying me.
Anyone who can give me some insight on what's wrong with my code?
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Haha, no need to say sorry, I wouldn't ever get this worked out without experienced help.
Switching AFKDuration(unit) and DNDDuration(unit) for IsAFK(unit) and IsDND(unit) returns this though..
Message: Interface\AddOns\PitBull4_LuaTexts\ScriptEnv.lua:328: attempt to index global 'dnd_times' (a nil value)
Time: 11/04/10 03:35:48
Count: 5
Stack: Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:752: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:707>
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1272: in function `AddFontString'
...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:118: in function `UpdateFrame'
...ddOns\PitBull4\ModuleHandling\TextProviderModule.lua:150: in function `ForceTextUpdate'
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1344: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1340>
Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1414: in function <Interface\AddOns\PitBull4_LuaTexts\LuaTexts.lua:1410>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[2]"]:9: in function <[string "safecall Dispatcher[2]"]:5>
(tail call): ?
...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:797: in function <...nfig-3.0\AceConfigDialog-3.0\AceConfigDialog-3.0.lua:612>
(tail call): ?
[C]: ?
[string "safecall Dispatcher[3]"]:9: in function <[string "safecall Dispatcher[3]"]:5>
(tail call): ?
...nterface\AddOns\Aloft\Libs\AceGUI-3.0\AceGUI-3.0.lua:314: in function `Fire'
...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:44: in function <...AceGUI-3.0\widgets\AceGUIWidget-MultiLineEditBox.lua:41>
Locals: <none>
This is a bug in IsDND. Next release will fix it.
Fixed in the latest Alpha now. Kinda makes me mad, that bug is so stupid and so I'm sure someone had to hit it before. So I google for it and find this:
http://paste.sc2mapster.com/950/
All he had to do is tell me and it'd be fixed. Instead he does nothing about it and you find it.
Awesome, thanks for the fix and everything.
EDIT: Updated my PB and the bug is gone and at least either AFK or DND will show, but never both. I can control which one displays by changing the order of afk or dnd in this last line
but it only shows whichever is displayed first, in the above case, that's <DND>. I can fraps it if you need to see it in action.
Sorry to keep bugging you with this ;(
You can't be DND AND AFK.
[22:29:30] You are now Busy: Busy
[22:29:33] You are no longer marked Busy.
[22:29:33] You are now Away: test
From doing the following two commands:
/dnd
/away test
The opposite order works as well.
Using the line
I can type /dnd and the <DND> tag will appear.
After clearing dnd, I can type /afk and the <AFK> tag will not appear.
If I type /dnd and /afk after, the <DND> will disappear and not be replaced by <AFK>.
Got screenshots when using the line
I can type /afk and the <AFK> tag will appear. http://i.imgur.com/fK5n2.jpg
After clearing afk, I can type /dnd and the <DND> tag will not appear. http://i.imgur.com/gKpwi.jpg
If I type /afk and /dnd after, the <AFK> will disappear and not be replaced by <DND>.
http://i.imgur.com/7SLCs.jpg
I'm using the PLAYER_FLAGS_CHANGED, UNIT_AURA, UNIT_HEALTH, UNIT_MAXHEALTH, UNIT_NAME_UPDATE events.
Hopefully that clears up what's going on.
Change the or '' on the first two lines to or nil.
Im using this code for level and name.
Outline()
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or
'',Name(unit)
Is there an way to do so the name turns out in class color?
Also how would one go about if i wanted the level and the short classification in a single color?
The code you have already has the level and short classification as the same color.
I am attempting to create a custom LUA text. I have switched over from PB3 to PB4 and used to use a Trunc syntax in Dog Tags for Health.
What I used to have was of the format:
HP / MaxHP
999999/999999
with Trunc set to eg: 8 so that PB would return a maximum of 8 digits:
99999/999..
This worked great because as the mob got low on HP, MaxHP would fill out the other digits.
In PB4 I have come up with the following Lua Text:
local s = Status(unit)
if s then
return s
end
return "%s/%s",string.sub(HP(unit),1,6),string.sub(MaxHP(unit),1,6)
but because HP and Max(HP) are two separate variables I am having to fix the size of each variable. As a result, as HP changes, MaxHP stays fixed at 6 when there is ample room to display more.
Anyone know how I can do this with LUA Texts? Is there any way to treat HP+MaxHP as one string of text and apply the string.sub to the whole thing?
Thanks very much in advance.
Woulnt it work better to use a version of "short" or "Very short" ?
ie showing 99999/99999 as 99,99k or 99.9k
I'm really a bit of a perfectionist and I'm trying to recreate my previous UI as closely as possible. I'm also trying to get my head around LUA a bit better. Dog Tags was much easier but was more resource intensive compared to LUA texts.
(untested)
Wicked! That does the trick. Thanks heapz =)
Here's a trimmed down version of what I've been trying:
I considered trying to use a global variable to set the target name, but then it occurred to me that id have to make a global variable for each reser in the raid somehow. And I don't want to start making too many global variables. However it would be possible to set a variable during only the first few ms of casting then stop for the rest of the duration of the cast by comparing cast_data.start_time with GetTime().
I've tried googling and searching this thread but haven't found any examples. Any assistance would be very much appreciated, and I apologize if this has already been covered somewhere else.
Personally I just use SmartRes2 (http://wow.curse.com/downloads/wow-addons/details/smartres2.aspx).
I have - of course - checked the Pitbull Unit Frames 4.0 pages on WowAce, and various pages on Wowpedia.
My code is as follows:
Neither the rage check nor the mana check works.
They do the opposite of what I want them to do.
The rage check does "return "%s/%s",Power(unit),MaxPower(unit)"
and the mana check does "return Power(unit)".
I'm guessing it's just some pathetic error on my part, but it's annoying me.
Anyone who can give me some insight on what's wrong with my code?