[(Level (if Classification then
'+'
end)):DifficultyColor] [ShortRace]
So I was trying to adapt to Lua.text but there is no ShortRace with text.lua and I get an error each time I try to use Short.
Yeah I probably need to give you ShortRace because there's really no good way to do that atm. Short() is for numbers btw. Does nothing to text. I'd be interested in the error messages you were getting. I should probably protect it from throwing errors if you're using wrong or at least throw an error saying that you're using it wrong.
maybe we should make a "interresting LuaText's" forum thread like the dogtag one. I would love to see what other people come up with, I were pretty good with dogtags, but I have not coded anything besides that, so this is a bit challenging.
maybe we should make a "interresting LuaText's" forum thread like the dogtag one. I would love to see what other people come up with, I were pretty good with dogtags, but I have not coded anything besides that, so this is a bit challenging.
It would probably be ideal to move the LuaText stuff off this thread. I think it'll probably clutter things up quite a bit.
maybe we should make a "interresting LuaText's" forum thread like the dogtag one. I would love to see what other people come up with, I were pretty good with dogtags, but I have not coded anything besides that, so this is a bit challenging.
Sounds like a great idea to me, gief some more advanced stuff i can "steal" for now since i just can't seem to find any material for studying .lua properly :p
Sounds like a great idea to me, gief some more advanced stuff i can "steal" for now since i just can't seem to find any material for studying .lua properly :p
dunno if its advanced, but I'm making a text for:
(current power)/(max power) (power type)
hidden if (power type)=rage/runic and (current power)=0
hidden if (power type)=mana/energy and (current power)=(max power)
Ugh. I've been trying for hours now to recreate the [TalentTree] dogtag. Each time I think I've got it something messes it up. This is what I have atm:
local dr,dg,db = DifficultyColor(unit)
local cr,cg,cb = ClassColor(unit)
if UnitIsPlayer(unit) then
if CanInspect(unit) then
local current = {}
local tree , _ = 1
for i = 1, 3 do
_, _, current[i] = GetTalentTabInfo(i,true)
if (current[i] > current[tree]) then
tree = i
end
end
current.talent = GetTalentTabInfo(tree,true)
return "|cff%02x%02x%02x%s|r %s |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit) or '', current.talent or '',cr,cg,cb,Class(unit)
else
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit) or '',cr,cg,cb,Class(unit)
end
end
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s",dr,dg,db,Classification(unit) or '',dr,dg,db,Level(unit),SmartRace(unit) or ''
Atm this works for targets other than myself. However... it seems to show the spec that the player currently isn't... either that or it's pulling some random numbers from somewhere. Can anyone more experienced in lua see what I'm doing wrong?
Yeah I probably need to give you ShortRace because there's really no good way to do that atm. Short() is for numbers btw. Does nothing to text. I'd be interested in the error messages you were getting. I should probably protect it from throwing errors if you're using wrong or at least throw an error saying that you're using it wrong.
[2009/05/29 09:01:22-7-x1]: <string>:"PitBull4_LuaTexts:PICTTARG:Lua:Class":2: attempt to call global 'ShortRace' (a nil value)
PitBull4-r20090528195509\Modules\LuaTexts\LuaTexts.lua:1099: in function `AddFontString'
PitBull4-r20090528195509\ModuleHandling\TextProviderModule.lua:109: in function `UpdateFrame'
PitBull4-r20090528195509\ModuleHandling\Module.lua:271: in function `Update'
PitBull4-r20090528195509\UnitFrame.lua:492: in function `Update'
PitBull4-r20090528195509\UnitFrame.lua:517: in function `UpdateGUID'
PitBull4-r20090528195509\Main.lua:1086: in function `CheckGUIDForUnitID'
PitBull4-r20090528195509\Main.lua:1090: in function `?'
CallbackHandler-1.0-3:146: in function <...ack\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:146>
<string>:"safecall Dispatcher[1]":4: in function <[string "safecall Dispatcher[1]"]:4>
<in C code>: ?
<string>:"safecall Dispatcher[1]":13: in function `?'
CallbackHandler-1.0-3:91: in function `Fire'
AceEvent-3.0-3 (PitBull4):119: in function <...e\AddOns\PitBull4\libs\AceEvent-3.0\AceEvent-3.0.lua:118>
<in C code>: in function `TargetUnit'
<string>:"TARGETSELF":4: in function <[string "TARGETSELF"]:1>
---
---
This is the error code I have if I simply replace on the Target(Unit) the value SmartRace(Unit) by ShortRace(Unit) in that example :
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or '',ShortRace(unit) or ''
I hope this will help you but there is no hurry with that, I understand that you have a lot to do actually.
This was tested with only PB4, and Bugsack/Buggrabber, so I dont get any other addons mixing in the error feedback.
(current power)/(max power) (power type)
hidden if (power type)=rage/runic and (current power)=0
hidden if (power type)=mana/energy and (current power)=(max power)
gotta start somewhere :)
Its something along those lines i need to get done, but with an extra twist.
(i use a PerfectRaid style layout for my raidframes with 3 texts)
Name:
green ! for leader, yellow ! for ML, red ! if pvp on, Name classcolored, Druidform (2 letters)/Shadowform, white * indicating not max level.
(set to left as text 1)
Power/status:
If dead Rip!:time(not released) / Run!:time(released)
If AFK/Offline AFK/DC:time
else power(mana only) as XX.xk when full, and if not full XX.x%
(set to leftas text 2)
HP:
Maxhp short when full, missing HP when not full, hide when dead/DC
(set to right)
these should be pretty east to fix i think from what i have read about lua texts.
However my target ones i dun even know where to start :/
to much to explain so i just post my current dogtags...
Text is white by default, I believe. And those colour codes you have there are for red, not white. :)
Yea, just wasn't sure if it's "correct" to write
return afk
instead of
return "|cffff0000%s|r",afk
The first one is the one I am using now, since it shows white text :) I think I could have added the code for white color as well, but atm I don't have any reference for those colorcodes, perhaps someone could link something like a "color to code" converter/reference table for those alphacolors :)
but atm I don't have any reference for those colorcodes, perhaps someone could link something like a "color to code" converter/reference table for those alphacolors :)
I use this one. A click on the color you want shows the hex code on the left side.
I'm wanting one of my texts to update when I or a party/raid member switch specs. Had a search on WoWWiki and found the PLAYER_TALENT_UPDATE event which suggests this is only possible for the player frame. Is it possible to have this added to the events list in LuaTexts? Any other way to easily check talent updates?
Go to Modules, LuaTexts. You can add it yourself. :) I don't believe that event does not pass which unit it applies to since as you say it's only for the player. So be sure to choose player in the checkboxes when you add it.
You don't have to use a format string if you just want to display a single string that's already ready to be displayed with any formatting. So yeah the code you asked about is just fine.
This is the error code I have if I simply replace on the Target(Unit) the value SmartRace(Unit) by ShortRace(Unit) in that example :
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or '',ShortRace(unit) or ''
I hope this will help you but there is no hurry with that, I understand that you have a lot to do actually.
This was tested with only PB4, and Bugsack/Buggrabber, so I dont get any other addons mixing in the error feedback.
Thank you for doing a so great job for us
Umm yeah ShortRace() doesn't exist. I haven't written it. I was interested in errors with Short(...)
Umm yeah ShortRace() doesn't exist. I haven't written it. I was interested in errors with Short(...)
I guessed that but as you know I am learning LUA to apply and use LUA.text so I may not be for now the best to test something I dont understand very well.
I dont even for now have an idea for what is use Short(...) : numbers probably.
Anyway husband will help me on that to find a way to test that out.
Ugh. I've been trying for hours now to recreate the [TalentTree] dogtag. Each time I think I've got it something messes it up. This is what I have atm:
local dr,dg,db = DifficultyColor(unit)
local cr,cg,cb = ClassColor(unit)
if UnitIsPlayer(unit) then
if CanInspect(unit) then
local current = {}
local tree , _ = 1
for i = 1, 3 do
_, _, current[i] = GetTalentTabInfo(i,true)
if (current[i] > current[tree]) then
tree = i
end
end
current.talent = GetTalentTabInfo(tree,true)
return "|cff%02x%02x%02x%s|r %s |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit) or '', current.talent or '',cr,cg,cb,Class(unit)
else
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r",dr,dg,db,Level(unit) or '',cr,cg,cb,Class(unit)
end
end
return "|cff%02x%02x%02x%s|r |cff%02x%02x%02x%s|r %s",dr,dg,db,Classification(unit) or '',dr,dg,db,Level(unit),SmartRace(unit) or ''
Atm this works for targets other than myself. However... it seems to show the spec that the player currently isn't... either that or it's pulling some random numbers from somewhere. Can anyone more experienced in lua see what I'm doing wrong?
Talent stuff is a pain in the butt because your make a request and then an event responds. Everyone sees the event you're not sure if it's your request or some other addons.
I'll probably need to add some talent stuff for this to work reliably. Since you'll need something else to trigger updates when you actually receive the talent info.
Talent stuff is a pain in the butt because your make a request and then an event responds. Everyone sees the event you're not sure if it's your request or some other addons.
I'll probably need to add some talent stuff for this to work reliably. Since you'll need something else to trigger updates when you actually receive the talent info.
Ah makes sense now. I thought I had it working but then I realized that it was actually my tooltip addon that was making it possible. Explains why it only ever updated if I manually moused over the unit or its frame. Nevermind, shall put the code aside til later.
On another topic, what function do I use to find the name of a pet's owner or NPC 'guilds'? GetGuildInfo() only seems to work for actual guilds.
(current power)/(max power) (power type)
hidden if (power type)=rage/runic and (current power)=0
hidden if (power type)=mana/energy and (current power)=(max power)
gotta start somewhere :)
If it helps I've already made what you're working on. Only issue is when the powertype returns values I haven't included. I'm not sure when they'd be used. Like #5/Runes (when is this used?), #4/Happiness (when is this returned instead of 2/focus when used on hunter pets?), 7, 8 for vehicles.
local cur, max, type = Power(unit), MaxPower(unit), UnitPowerType(unit)
if type == 0 or type == 3 or type == 2 then
if cur == max then
return ''
end
elseif type == 1 or type == 6 then
if cur == 0 then
return ''
end
end
return "%s/%s",Short(cur,true),Short(max,true)
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
Yeah I probably need to give you ShortRace because there's really no good way to do that atm. Short() is for numbers btw. Does nothing to text. I'd be interested in the error messages you were getting. I should probably protect it from throwing errors if you're using wrong or at least throw an error saying that you're using it wrong.
It would probably be ideal to move the LuaText stuff off this thread. I think it'll probably clutter things up quite a bit.
Sounds like a great idea to me, gief some more advanced stuff i can "steal" for now since i just can't seem to find any material for studying .lua properly :p
dunno if its advanced, but I'm making a text for:
(current power)/(max power) (power type)
hidden if (power type)=rage/runic and (current power)=0
hidden if (power type)=mana/energy and (current power)=(max power)
gotta start somewhere :)
Atm this works for targets other than myself. However... it seems to show the spec that the player currently isn't... either that or it's pulling some random numbers from somewhere. Can anyone more experienced in lua see what I'm doing wrong?
This is the error code I have if I simply replace on the Target(Unit) the value SmartRace(Unit) by ShortRace(Unit) in that example :
local dr,dg,db = DifficultyColor(unit)
return "|cff%02x%02x%02x%s%s|r %s",dr,dg,db,Level(unit),Classification(unit) and '+' or '',ShortRace(unit) or ''
I hope this will help you but there is no hurry with that, I understand that you have a lot to do actually.
This was tested with only PB4, and Bugsack/Buggrabber, so I dont get any other addons mixing in the error feedback.
Thank you for doing a so great job for us
instead of this one
?
Or do I HAVE TO use the "|cffff0000%s|r" thing?
Its something along those lines i need to get done, but with an extra twist.
(i use a PerfectRaid style layout for my raidframes with 3 texts)
Name:
green ! for leader, yellow ! for ML, red ! if pvp on, Name classcolored, Druidform (2 letters)/Shadowform, white * indicating not max level.
(set to left as text 1)
Power/status:
If dead Rip!:time(not released) / Run!:time(released)
If AFK/Offline AFK/DC:time
else power(mana only) as XX.xk when full, and if not full XX.x%
(set to leftas text 2)
HP:
Maxhp short when full, missing HP when not full, hide when dead/DC
(set to right)
these should be pretty east to fix i think from what i have read about lua texts.
However my target ones i dun even know where to start :/
to much to explain so i just post my current dogtags...
lvl/class:
Name:
Yea, just wasn't sure if it's "correct" to write
instead of
The first one is the one I am using now, since it shows white text :) I think I could have added the code for white color as well, but atm I don't have any reference for those colorcodes, perhaps someone could link something like a "color to code" converter/reference table for those alphacolors :)
I use this one. A click on the color you want shows the hex code on the left side.
Go to Modules, LuaTexts. You can add it yourself. :) I don't believe that event does not pass which unit it applies to since as you say it's only for the player. So be sure to choose player in the checkboxes when you add it.
You don't have to use a format string if you just want to display a single string that's already ready to be displayed with any formatting. So yeah the code you asked about is just fine.
Umm yeah ShortRace() doesn't exist. I haven't written it. I was interested in errors with Short(...)
I guessed that but as you know I am learning LUA to apply and use LUA.text so I may not be for now the best to test something I dont understand very well.
I dont even for now have an idea for what is use Short(...) : numbers probably.
Anyway husband will help me on that to find a way to test that out.
Talent stuff is a pain in the butt because your make a request and then an event responds. Everyone sees the event you're not sure if it's your request or some other addons.
I'll probably need to add some talent stuff for this to work reliably. Since you'll need something else to trigger updates when you actually receive the talent info.
Ah makes sense now. I thought I had it working but then I realized that it was actually my tooltip addon that was making it possible. Explains why it only ever updated if I manually moused over the unit or its frame. Nevermind, shall put the code aside til later.
On another topic, what function do I use to find the name of a pet's owner or NPC 'guilds'? GetGuildInfo() only seems to work for actual guilds.
If it helps I've already made what you're working on. Only issue is when the powertype returns values I haven't included. I'm not sure when they'd be used. Like #5/Runes (when is this used?), #4/Happiness (when is this returned instead of 2/focus when used on hunter pets?), 7, 8 for vehicles.