Well StefanWulph.. In the case of my suggestion, it requires two subroutines in VBScript that are part of my own version of such a bar. The triggers I use for mine are included within that plugin, which you can download from www.magnumsworld.com/muds.
However, since I don't use the infobar itself, but generate my own inline bar, most of the code wouldn't help much. It is a good source of examples for the trigger I use. If you do want to use the HSLtoRGB(Hue, Sat, Lumin) feature to adjust the color by percentage it is a must though, since Mushclient has no such converter built into it.
Put simply. You could either adapt the trigger and text it displayed to match the line you want to replace and use it as is, or use the trigger and HSLtoRGB code and scrap the rest in favor of something that used the InfoBar. ;) Since I already had mine working, and I had some issues with the way the InfoBar works, I never bothered to code a version that used it.
However, to more specifically answer you, the trigger I am using works off a lines like:
HP: [50/100] CONC: [100/400]
HP: [50/100] CONC: [100/400] Opponent: Wounded
So my trigger looks like this:
<trigger
enabled="y"
match="HP: [(.*)/(.*)] CONC: [(.*)/(.*)](.*)"
name="HitBar"
omit_from_log="y"
omit_from_output="y"
sequence="1"
regexp="y"
script="HealthDisp"
>
</trigger>
I chose to use a regular expression to avoid some of the issues that could come up otherwise. Hmm... Although, I should have used match="^HP: [(\d+)/(\d+)] CONC: [(\d+)/(\d+)](.*)" in order to avoid it working on stuff someone dropped in channels and to make sure that 'HP: [1/3]' worked, but 'HP: [a/b]' wouldn't. But that would be overkill, just adding the ^ to it would fix the channel spoofing issue. ;)
In simplest terms you could manage with:
<trigger
enabled="y"
match="HP: [*/*] CONC: [*/*]"
name="HitBar"
omit_from_log="y"
omit_from_output="y"
sequence="1"
script="HealthDisp"
>
</trigger>
sub HealthDisp (name, output, wilds)
pc = CInt ((CInt (wilds(1)) / CInt (wilds(2))) * 10)
Hue = 120 * pc
Sat = 255
Lumin = 60 * pc + 68
color = HSLtoRGB(Hue, Sat, Lumin)
DoGauge " HP: ", pc, 100, color, "maroon"
pc = CInt ((CInt (wilds(3)) / CInt (wilds(4))) * 10)
Hue = 120 * pc
Sat = 255
Lumin = 60 * pc + 68
color = HSLtoRGB(Hue, Sat, Lumin)
DoGauge " HP: ", pc, 100, color, "maroon"
end sub
'Color spectrum is:
' 0 = Red
' 60 = Yellow
'120 = Green
'180 = Cyan
'240 = Blue
'300 = Magenta
'360 = Red
function HSLtoRGB (Hue, Sat, Lum)
dim rm1, rm2, Temp, Temp2, Red, Green, Blue
Lum = Lum / 255 '** Get these back to a %. Hue is an arc from 0 to 360, so we don't touch it.
Sat = Sat / 255
if Sat = 0 then
Temp = Lum * 255 '** Satuaration of 0 means it is gray, so all colors are a % of the maximum.
Red = Temp
Green = Temp
Blue = Temp
else
if Lum <= 0.5 then '** Haven't a clue about the rest of this, I just know it works. lol
rm2 = Lum + Lum * Sat
else
rm2 = Lum + Sat - Lum * Sat
end if
rm1 = 2 * Lum - rm2
Temp = rm1
Red = FindColor(Temp, rm2, Hue + 120)
Temp = rm1
Green = FindColor(Temp, rm2, Hue)
Temp = rm1
Blue = FindColor(Temp, rm2, Hue - 120)
end if
Red = Cint(Red) '** Stick it all together into a single hex string.
Temp = Hex(Red)
if len(Temp) < 2 then
Temp = "0" + Temp
end if
Temp2 = Temp
Temp = Hex(Green)
if len(Temp) < 2 then
Temp = "0" + Temp
end if
Temp2 = Temp2 + Temp
Temp = Hex(Blue)
if len(Temp) < 2 then
Temp = "0" + Temp
end if
Temp2 = Temp2 + Temp
HSLtoRGB = Temp2
end function
function FindColor (rm1, rm2, rh)
if rh > 360 then
rh = rh - 360
else
if rh < 0 then
rh = rh + 360
end if
end if
if rh < 60 then
rm1 = rm1 + (rm2 - rm1) * rh / 60
else
if rh < 180 then
rm1 = rm2
else
if rh < 240 then
rm1 = rm1 + (rm2 - rm1) * (240 - rh) / 60
end if
end if
end if
FindColor = rm1 * 255
end function
That would produce two guages based of the current and maximum values for HP and CONC that change color as those stats dropped. Yours would be different of course, but this is basically all that is needed to do so. Assuming I didn't screw something up that is. ;) |