<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY trigger_match 
   "^\&lt;(\d+)\/(\d+) hp (\d+)\/(\d+) m (\d+)\/(\d+) mv\&gt;(.*?)$" > 
]>

<!-- Saved on Monday, April 28, 2003, 9:53 AM -->
<!-- MuClient version 3.41 -->

<!-- Plugin "Health_Bar" generated by Plugin Wizard -->

<!--
You will probably need to customise the trigger to match your MUD.

See ENTITY line near top of file. The above trigger will match on:

  <54/1000 hp 90/100 m 600/750 mv>

A simpler trigger would be:

  &lt;*/*hp */*m */*mv&gt;

-->

<muclient>
<plugin
   name="Health_Bar"
   author="Nick Gammon"
   id="a2af5216d68563401888e01e"
   language="VBscript"
   purpose="Shows HP, Mana, Movement points in a colour bar"
   date_written="2003-04-28 09:50:05"
   date_modified="2003-04-28 12:40:05"
   requires="3.29"
   version="1.1"
   >
<description trim="y">
<![CDATA[
Install this plugin to show an info bar with HP, Mana, 
and Movement points shown as a bar (between 0 and 10 blocks).

You need your prompt line to display the appropriate information,
naturally. I used this in SMAUG:

prompt <%h/%H hp %m/%M m %v/%V mv>
fprompt <%h/%H hp %m/%M m %v/%V mv>

"prompt" sets the normal prompt, "fprompt" sets the fight prompt.

Customise the plugin if you want to match a different sort of prompt line.

To see this message, type: Health_Bar:help

]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="&trigger_match;"
   name="InfoBar"
   regexp="y"
   script="DoPrompt"
   sequence="100"
  >
  </trigger>
</triggers>

<!--  Script  -->


<script>
<![CDATA[
sub DoGauge (sPrompt, iCurrent, iMax, sGoodColour, sBadColour)
dim pc, count

'
'  Do prompt in black Arial
'
  InfoColour "black"
  InfoFont "Arial", 10, 0
  Info sPrompt

'
'  Use Webdings for gauge (black square)
'

  InfoFont "Webdings", 10, 0

  pc = CInt ((CInt (iCurrent) / CInt (iMax)) * 10)

'
'  Below 20% warn by using different colour
'

  if pc < 2 then
    InfoColour sBadColour
  else
    InfoColour sGoodColour
  end if

'
'  Draw active part of gauge
'
  for count = 0 to pc
    Info "g"
  next  

'
'  Draw rest of gauge in grey (ie. unfilled bit)
'

  InfoColour "dimgray"
  while count <= 10
    count = count + 1
    Info "g"
  wend

end sub

sub DoPrompt (sName, sLine, wildcards)

  InfoClear

'
'  World name
'

  InfoFont "Arial", 12, 1  ' 12 point Arial *bold*
  InfoColour "purple"
  Info GetInfo (2)  ' world name

  DoGauge "  HP: ", wildcards (1), wildcards (2), "darkgreen", "maroon"
  DoGauge "  Mana: ", wildcards (3), wildcards (4), "mediumblue", "mediumblue"
  DoGauge "  Move: ", wildcards (5), wildcards (6), "gold", "gold"

end sub

'
'  Do this once
'
ShowInfoBar vbTrue



]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="Health_Bar:help"
   enabled="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
Sub OnHelp (sName, sLine, wildcards)
  world.Note world.GetPluginInfo (world.GetPluginID, 3)
End Sub
]]>
</script> 

</muclient>
