Thread Tools Display Modes
09-14-10, 12:05 PM   #1
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
Lua Help Needed*

Hey guys, I'm sure you've seen a few posts like these but I'm looking for some help converting dogtags that I like in to lua in Pitbull 4.0, for better performance. I left the game for a couple months, I'm now back and completely stumped when it comes to lua.

The dogtags I know I wish to convert are:

[(Status or HP) Outline]

[(Status or PercentHP:Hide(100):Truncate(2, nil)) Outline]

[Name:ClassColor] [(AFK or DND):Angle] [Level] [Outline]

Any help would be awesome!

Any other funky or cool lua codes that you guys just love would also be awesome to try out.

Last edited by thefrogi : 09-15-10 at 08:16 AM. Reason: Mistakes
  Reply With Quote
09-15-10, 06:14 AM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
What do you mean by "convert DogTags to Lua"? DogTag is a tagging syntax used by a library written to work in conjunction with addons, most commonly the PitBull unit frame addon. Lua is an entire programming language. Are you looking for a way to display arbitrary text objects on the screen without PitBull (or another DogTag-using addon)? Are you trying to use the LuaTexts library within PitBull instead of the DogTag library?

(By the way, Lua is a word, not an acronym, so it shouldn't be typed in uppercase.)
  Reply With Quote
09-15-10, 06:18 AM   #3
sylvanaar
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 92
He means LuaTexts (i think thats what they are called)
  Reply With Quote
09-15-10, 08:15 AM   #4
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
Originally Posted by Phanx View Post
Are you trying to use the LuaTexts library within PitBull instead of the DogTag library?
Yes. Like I said I'm stumped when it comes to lua and the likes.

Originally Posted by sylvanaar View Post
He means LuaTexts (i think thats what they are called)
Yes and thanks.
  Reply With Quote
09-15-10, 08:43 AM   #5
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Have you checked WoWAce Forums- LuaTexts Official Thread?
  Reply With Quote
09-15-10, 08:47 AM   #6
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
Originally Posted by jeffy162 View Post
I've gone through some of the posts trying different things, cutting and copying some bits of code but it fails in the end as I have no idea what should go where. Just asking on here as a if I knew what the answer was then I could work out how it was done hopefully.
  Reply With Quote
09-15-10, 10:43 AM   #7
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Take a look at this: PB4 LuaTexts Explained.

I knew I saw this somewhere, and it was driving me crazy (admittedly, a short trip) until I finally found it!

Hope it helps you, and watch out for the "Events" drop down. If that isn't set correctly, your code can be perfect but it will still error out because you're "watching" for the wrong events. One other thing: Don't edit the pre-formatted code. You can, but I think it might cause problems later. Rather, use the "Custom" option in the "Code" drop down. You might already be doing that, but someone else might not realize it's there.

Last edited by jeffy162 : 09-15-10 at 10:49 AM.
  Reply With Quote
09-15-10, 10:44 AM   #8
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
Thanks jeffy162! Will give it a shoot, hopefully with the other thread you linked I can get something going.
  Reply With Quote
09-15-10, 10:52 AM   #9
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
Good luck!! And I hope you get it straightened out.
  Reply With Quote
09-15-10, 11:56 AM   #10
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
After a bit if reading and c&p'ing. I've came up with these:

[(Status or HP) Outline]

Outline()
local s = Status(unit)
if s then
return s
end
return "%s",HP(unit)


[(Status or PercentHP:Hide(100):Truncate(2, nil)) Outline]

Outline()
return "%s",Percent(HP(unit),MaxHP(unit))


[Name:ClassColor] [(AFK or DND):Angle] [Level] [Outline]

Outline()
local r,g,b = ClassColor(unit)
return '|cff%02x%02x%02x%s|r %s%s %s%s',r,g,b,Name(unit),Level(unit),Angle(AFK(unit) or DND(unit))


I still haven't seen or found a way to hide the percentHP when max though. If anyone could help with that, it would be awesome.
  Reply With Quote
09-15-10, 12:27 PM   #11
thefrogi
A Murloc Raider
Join Date: Apr 2009
Posts: 7
I managed to find this bit of code:

local cur,max = HP(unit),MaxHP(unit)
local r,g,b = HPColor(cur,max)
if cur < max then
return "|cff%02x%02x%02x%s%%|r",r,g,b,Percent(cur,max)
end


Which hides my percentage HP if max and then as an added bonus colours it too! Now I only need to know how to set it to 2 numbers only as in 99 and not 99.9. Any ideas please?

Last edited by thefrogi : 09-15-10 at 12:27 PM. Reason: Schpelling.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » LUA Help Needed


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off