Thread Tools Display Modes
09-19-11, 10:53 PM   #1
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Lua Help - Pitbull

Once again I am here to ask for help with lua texts for my pitbull frames. I have no real clue when it comes to this sort of thing but usually I can pick away at some code I find to get my desired result. I have been searching for 2 days to try and find what I am after this time but to no avail! =(

I'm lookign for a way to do the following:

If 'missing' any priest buff, Foritude, Shadow Protection or Vampiric Embrace to show letters (i.e. F, SP or VE) on my player frame.

I was hoping aswell if I could find/copy a similar code I could also make it work to show when I am missing other auras, such as Inner Will/Fire and also auras for my Paladin.

I would be so grateful if some nice person was to help me with this, has me totally banging my head on the desk =(

Thanks in advance!
  Reply With Quote
09-19-11, 11:12 PM   #2
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Talisia View Post
Once again I am here to ask for help with lua texts for my pitbull frames. I have no real clue when it comes to this sort of thing but usually I can pick away at some code I find to get my desired result. I have been searching for 2 days to try and find what I am after this time but to no avail! =(

I'm lookign for a way to do the following:

If 'missing' any priest buff, Foritude, Shadow Protection or Vampiric Embrace to show letters (i.e. F, SP or VE) on my player frame.

I was hoping aswell if I could find/copy a similar code I could also make it work to show when I am missing other auras, such as Inner Will/Fire and also auras for my Paladin.

I would be so grateful if some nice person was to help me with this, has me totally banging my head on the desk =(

Thanks in advance!
This is untested, but maybe something like this:
Code:
local AL = {"Fortitude", "Shadow Protection"}
local AS = {"F", "SP"}
local AR, cnt = "", 0
for k,v in pairs(AL) do
  if not UnitAura(unit, v) then
    cnt = cnt + 1
    AR = (cnt > 1) and (AR .. " " .. AS[k]) or AS[k]
  end
end
return AR
Don't forget to select UNIT_AURA event on that Lua Text.

Last edited by Nibelheim : 09-20-11 at 12:01 AM.
  Reply With Quote
09-19-11, 11:45 PM   #3
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Thanks for such a quick reply! Unfortunately this is not working. Just tested and it only showed the 'SP' and only when I gave myself the buff not when it was missing.

Appreciate any and all help though! =)
  Reply With Quote
09-20-11, 12:02 AM   #4
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Talisia View Post
Thanks for such a quick reply! Unfortunately this is not working. Just tested and it only showed the 'SP' and only when I gave myself the buff not when it was missing.

Appreciate any and all help though! =)
Woops, fixed up the code.

You'll need to replace the buff names with their exact, full names. Fortitude is probably just shorthand, so change that one up
  Reply With Quote
09-20-11, 10:13 AM   #5
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Tytyty!

This works perfectly, spent days looking through forums etc and this is exactly what I wanted =)

Could I just be a little bit more cheeky and ask if you could show me how to add different colours to each text/letter?

I would be so very grateful!
  Reply With Quote
09-20-11, 02:21 PM   #6
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Talisia View Post
Tytyty!

This works perfectly, spent days looking through forums etc and this is exactly what I wanted =)

Could I just be a little bit more cheeky and ask if you could show me how to add different colours to each text/letter?

I would be so very grateful!

This may work:
Code:
local AL = {"Fortitude", "Shadow Protection"}
local AS = {"F", "SP"}
local AC = {"ffffff", "ff10eo"}

local AR, AT, cnt = "", "", 0
for k,v in ipairs(AL) do
  if not UnitAura(unit, v) then
    cnt = cnt + 1
    AT = "|cff" .. AC[k] .. AS[k] .. "|r"
    AR = (cnt > 1) and (AR .. " " .. AT) or AT
  end
end
return AR

Last edited by Nibelheim : 09-20-11 at 02:49 PM.
  Reply With Quote
09-21-11, 07:58 AM   #7
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Couldnt check this out last night but did this morning and got this error:




Thank you for your help so far, you are already my hero <3

Edit: Never mind I got it to work! I changed the second colour code! =))

Last edited by Talisia : 09-21-11 at 08:01 AM.
  Reply With Quote
09-21-11, 08:44 AM   #8
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Ok so I am going to be even more cheeky and ask for a little more help if you have the time! =)

I found an old post as I was researching Health Texts and you had kindly replied with the following code:

local cur, max = HP(unit), MaxHP(unit)
local PerHP = cur/max
local hr, hg, hb

if (PerHP < 0.5) then
hr = 255
hg = 255 * PerHP * 2
hb = 0
else
hr = 255 * (1 - ((PerHP - 0.5) * 2))
hg = 255
hb = 0
end

return "|cff%02x%02x%02x%s",hr,hg,hb,Short(cur,true)

I love this! and it is great for my player health frame, however, I would love to have this show 'short hp & percent' for my target frame. Have had a go myself but I am getting nowhere =P

Appreciate all the time you have taken to help me =)
  Reply With Quote
09-21-11, 02:40 PM   #9
Nibelheim
local roygbi-
 
Nibelheim's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 1,600
Originally Posted by Talisia View Post
Ok so I am going to be even more cheeky and ask for a little more help if you have the time! =)

I found an old post as I was researching Health Texts and you had kindly replied with the following code:

{snip}

I love this! and it is great for my player health frame, however, I would love to have this show 'short hp & percent' for my target frame. Have had a go myself but I am getting nowhere =P

Appreciate all the time you have taken to help me =)
Code:
local cur, max = HP(unit), MaxHP(unit)
local PerHP = cur/max
local hr, hg, hb

if (PerHP < 0.5) then
  hr = 255
  hg = 255 * PerHP * 2
  hb = 0
else
  hr = 255 * (1 - ((PerHP - 0.5) * 2))
  hg = 255
  hb = 0
end

return "|cff%02x%02x%02x%s|r - %s%%", hr, hg, hb, Short(cur,true), Percent(cur, max)
Shift the |r to after the %s%% if you also want the percent to be colored.
  Reply With Quote
09-22-11, 06:15 AM   #10
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Worked perfectly! Thank you once again, you are a star =)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Lua Help - Pitbull


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