Hmm. You would have to pick Perl... lol I can provide you with a VB version though, which hopefully you can convert. ;)
Also, right now the idea of a seperate window isn't going to fly. There simply isn't one you can use unless you open a second world and that makes life 1000 times more complex. So here is my idea:
<triggers>
<trigger
enabled="y"
group="Heal_Link"
keep_evaluating="y"
match="^(/w+)/s+(Member|Leader)/s+(/S+)/s+(Yes|No)/s+(Yes|No)/s+(/d{1,3))%/s+(/d{1,3))%/s+(/d{1,3))%"
name="Heal_Link"
omit_from_output="y"
regexp="y"
script="Heal_Link"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
</triggers>
Note: The above retrieves 'all' data. I figured it was as easy to do that
as retrieve only part, since sub groups like (Yes|No) will get passed anyway
and you would still end up with 5 wild cards. Three extras are no big deal
and since it gets them, you can still use them for something.
sub Heal_link (name, output, wilds)
Hue = int(120 * (wilds(6)/100)) ' Set color in range from Green to Red
'Hue = 360 - int(120*(wilds(6)/100)) ' Set color in range from Blue to Red
Sat = 255 ' This is how 'grey' it is. 255 means the color has no greying.
Lum = int (155 * wilds(6)/100) + 100 ' Set from full to 39% of how 'bright' the color is.
Forecolor = HSLtoRGB (Hue, Sat, Lum) ' Get our new color.
' Check to see if they are in the room before making a link.
if wilds(4) = "Yes" then
hyperlink "c heal " & wilds(1), output, "c heal " & wilds(1), Forecolor, "black", 0
else
' If they where not in the room, color it, but don't give a link.
colournote Forecolor, "black", output
end if
end if
function HSLtoRGB (Hue, Sat, Lum) 'I know it works, don't ask me how. ;)
dim rm1, rm2, Temp, Temp2, Red, Green, Blue
Lum = Lum / 255
Sat = Sat / 255
if Sat = 0 then
Temp = Lum * 255
Red = Temp
Green = Temp
Blue = Temp
else
if Lum <= 0.5 then
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)
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
'world.note rm1
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
This should do one better than what you wanted, except for the extra window thing. It will replace each line with a hyperlink that when clicked will heal the person that the link is associated with. It also ranges the color of each link from Blue, to purple then red or green, then yellow and finally red depending on which of the lines you have a ' in front of. Right now it is set for Green to Red. It is also smart enough that it will not create a hyperlink if the individual is not actually 'in the room' at the time.
Of course this is in VB, so if you want to use perl you will need to find someone that knows how to convert it. ;) |