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 =) |
Without seeing the errors it's hard to say for sure but it looks to me like your problem occurs when the max hp is zero. Try changing:
Lua Code:
to Lua Code:
|
I realised as I was typing this message that I should have kept the error to show! I just logged in and enabled them again so I could post it, but so far no error grrr! Always the way =p I only logged in for a few minutes though as its 5am in the morning and I need sleep ;)
I will recreate tomorrow and then try the changes, I'l post the errors for reference and results of the edit, hopefully all fixed though! Just to add, thank you for such a great addon, I have used it for years now and do not think I could ever play without it =p |
All times are GMT -6. The time now is 05:26 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI