View Single Post
09-05-12, 08:46 PM   #1
Talisia
A Deviate Faerie Dragon
Join Date: Sep 2007
Posts: 15
Pitbull Lua Help Please =)

Hi all,

After patch and updating my Pitbull 4 a few pieces of code I use seem to be broken. I got this code from some lovely people here when I came asking for help before. The code is:

Health/Player:
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

and

Health/Target:
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 - %s%%|r", hr, hg, hb, Short(cur,true), Percent(cur, max)

They don't show as errors on Pitbull but when I use them I keep getting Blizzard Lua error screens popping up and the errors just keeping increasing until I reload the ui. It then starts all over again. I have just disabled them completely.

I have lots of little bits of code for Pitbull (all written by other people! I am clueless but only these 2 seem to be having problems.

I would be most grateful if anybody could take a look and maybe fix them for me =)
  Reply With Quote