Healthbar for Achaea!

Posted by Nickpick on Sun 28 Aug 2005 07:07 PM — 24 posts, 108,551 views.

#0
I hope that you don't mind Nick, but I adapted you Health_Bar plugin for the MUD called Achaea, just because so many people asked for help about it. It doesn't require any knowledge of VBScript and only needs a reconnect after being setup. Check the help file for more info.

Here's the code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
<!ENTITY trigger_match
"^(\d+)h, (\d+)m, (\d+)e, (\d+)w c?e?x?k?d?b?-(.*)$" >
]>


<!-- 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;

-.-.-.-.-.-.-.- ADAPTED TO ACHAEA! -.-.-.-.-.-.-.-

Reconnect to Achaea in order to lauch the plugin properly.

-->

<muclient>
<plugin
name="Health_Bar"
author="Nick Gammon"
id="a2af5216d68563401888e01e"
language="VBscript"
purpose="Shows HP, Mana, Endurance and Willpower 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.12"
>
<description trim="y">
<![CDATA[

IMPORTANT: In order for plugin to work properly you need to reconnect to Achaea or call out the SCORE.

ALSO, configure your PROMP to show ALL, i.e. Health, Mana, Endurance and Willpower. In order to do so, type CONFIG PROMPT ALL.

Original text:

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

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-.-.-.-.-.- Original Script -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.- by -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.- Nick Gammon -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-.-.-.-.-.- ADAPTED TO ACHAEA! -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.- by -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.- Caecilius Azon -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

]]>
</description>

</plugin>


<!-- Triggers -->

<triggers>
<trigger
enabled="y"
match="&trigger_match;"
name="InfoBar"
regexp="y"
script="DoPrompt"
sequence="100"
>
</trigger>
<trigger
enabled="y"
match="^Password correct\. Welcome to Achaea\.$"
regexp="y"
script="RunScore"
sequence="100"
>
</trigger>
<trigger
enabled="y"
group="Multi Line"
lines_to_match="3"
keep_evaluating="y"
match="You are level (.*?)\.\nHealth\: (.*?)\/(.*?) Mana\: (.*?)\/(.*?)\nEndurance\: (.*?)\/(.*?) Willpower\: (.*?)\/(.*?)\Z"
multi_line="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>world.setvariable "HealthMax", %3
world.setvariable "ManaMax", %5
world.setvariable "EnduranceMax", %7
world.setvariable "WillpowerMax", %9</send>
</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 RunScore (sName, sLine, wildcards)

world.send("SCORE")

end sub

sub DoPrompt (sName, sLine, wildcards)

dim MaxH, MaxM, MaxE, MaxW

MaxH = world.getvariable("HealthMax")
MaxM = world.getvariable("ManaMax")
MaxE = world.getvariable("EnduranceMax")
MaxW = world.getvariable("WillpowerMax")

InfoClear

'
' World name
'

InfoFont "Times New Roman", 12, 1 ' 12 point Arial *bold*
InfoColour "darkgrey"
Info GetInfo (2) ' world name

DoGauge " HP: ", wildcards (1), MaxH, "darkgreen", "maroon"
DoGauge " Mana: ", wildcards (2), MaxM, "DarkBlue", "Blue"
DoGauge " Endurance: ", wildcards (3), MaxE, "orange", "orange"
DoGauge " Willpower: ", wildcards (4), MaxW, "purple", "purple"


end sub

'
' Do this once
'
ShowInfoBar vbTrue



]]>
</script>

<!-- Variables -->

<variables>
<variable name="WillpowerMax">1000</variable>
<variable name="HealthMax">1000</variable>
<variable name="ManaMax">10000</variable>
<variable name="EnduranceMax">10000</variable>
</variables>

<!-- 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>


Just create a file called Health_Bar.xml with your notepad and paste in the code from above.

I really hope that you don't mind me posting it.

EDIT: A slight update has been made on 30th August 2005.
EDIT2: CONFIG PROMPT ALL notion added on 23rd February 2006.
Amended on Thu 23 Feb 2006 09:08 AM by Nickpick
#1
dont suppose youy want to make one for The Two Towers?:P

the prompt is...

HP:230 EP:230 REG:MOR >

with a newline...:)

I cant seem to get it to work...as 230 in the max HP.
#2
I can't get this modified plugin to work in Achaea no matter what I try. I sent this to my brother and he got the plugin to work, first try, no problems. I however am not as lucky.

I've tried uninstalling the plugin, reinstalling it, exiting MUSH, saving here, saving there, reinstalling MUSH and starting over... all to no avail. I'm guessing there's one little step somewhere that I'm just flat missing and it will work like a charm, but I sure as heck can't figure out what it is. Unless it's another part of my machine that hasn't been updated properly, or another setting that I've failed to configure, I'm completely at a loss.

I'm using MUSH 3.65 on Windows XP. Any help anyone could provide would be most appreciated.
Australia Forum Administrator #3
When the plugin was posted Maxgrin should have "quoted forum codes" (there is a function in the MUSHclient notepad to do that). Without it, subtle bugs have probably crept it. Here is the same code, modified with quoted forum codes:



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient [
  <!ENTITY trigger_match 
   "^(\d+)h, (\d+)m, (\d+)e, (\d+)w c?e?x?k?d?b?-(.*)$" > 
]>


<!-- 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;

-.-.-.-.-.-.-.- ADAPTED TO ACHAEA! -.-.-.-.-.-.-.-

Reconnect to Achaea in order to lauch the plugin properly.

-->

<muclient>
<plugin
   name="Health_Bar"
   author="Nick Gammon"
   id="a2af5216d68563401888e01e"
   language="VBscript"
   purpose="Shows HP, Mana, Endurance and Willpower 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[

IMPORTANT: In order for plugin to work properly you need to reconnect to Achaea or call out the SCORE.

Original text:

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

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-.-.-.-.-.-   Original Script  -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-        by          -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-    Nick Gammon     -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-.-.-.-.-.-.- ADAPTED TO ACHAEA! -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-        by          -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-  Caecilius Azon    -.-.-.-.-.-.-.-
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.

]]>
</description>

</plugin>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="&trigger_match;"
   name="InfoBar"
   regexp="y"
   script="DoPrompt"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   match="^Password correct\. Welcome to Achaea\.$"
   regexp="y"
   script="RunScore"
   sequence="100"
  >
  </trigger>
<trigger
   enabled="y"
   group="Multi Line"
   lines_to_match="3"
   keep_evaluating="y"
   match="You are level (.*?)\.\nHealth\: (.*?)\/(.*?)  Mana\: (.*?)\/(.*?)\nEndurance\: (.*?)\/(.*?)  Willpower\: (.*?)\/(.*?)\Z"
   multi_line="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>world.setvariable "HealthMax", %3
world.setvariable "ManaMax", %5
world.setvariable "EnduranceMax", %7
world.setvariable "WillpowerMax", %9</send>
  </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 RunScore (sName, sLine, wildcards)

world.send("SCORE")

end sub

sub DoPrompt (sName, sLine, wildcards)

dim MaxH, MaxM, MaxE, MaxW

MaxH = world.getvariable("HealthMax")
MaxM = world.getvariable("ManaMax")
MaxE = world.getvariable("EnduranceMax")
MaxW = world.getvariable("WillpowerMax")

  InfoClear

'
'  World name
'

  InfoFont "Times New Roman", 12, 1  ' 12 point Arial *bold*
  InfoColour "darkgrey"
  Info GetInfo (2)  ' world name

  DoGauge " HP: ", wildcards (1), MaxH, "darkgreen", "maroon"
  DoGauge " Mana: ", wildcards (2), MaxM, "DarkBlue", "Blue"
  DoGauge " Endurance: ", wildcards (3), MaxE, "orange", "orange"
  DoGauge " Willpower: ", wildcards (4), MaxW, "purple", "purple"


end sub

'
'  Do this once
'
ShowInfoBar vbTrue



]]>
</script>

<!--  Variables  -->

<variables>
  <variable name="WillpowerMax">1000</variable>
  <variable name="HealthMax">1000</variable>
  <variable name="ManaMax">10000</variable>
  <variable name="EnduranceMax">10000</variable>
</variables>

<!--  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>
Australia Forum Administrator #4
Quote:


I can't get this modified plugin to work in Achaea no matter what I try. I sent this to my brother and he got the plugin to work, first try, no problems


In what way does it not work? Error message? Nothing happens?

Try it with version 3.70:

http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=6124
#5
Nothing happens. When I initially install it, down in the status bar it says that it's loading it, but then nothing ever pops up.

Haven't tried it yet w/ 3.7. Will do that now.
Australia Forum Administrator #6
What is your prompt line like? It needs to match the trigger exactly. Can you give an example?
#7
Still nothing, not even w/ 3.7. It just doesn't pop up. It says "Achaea loading plugin Health_Bar..." but then nothing happens, and even when I type in SCORE as suggested, still nothing happens, and then even after I save world and relogin, still nothing happens.

I kinda think that it has to be running because when I type Health_Bar:help it brings up that section of the xml file, but no bars ever show up.
#8
1040h, 1100m ex-

And as I said, I have another user that copied the same text into his xml file and it worked like a charm. Which makes me think it's just another setting I don't have toggled properly or something.
Australia Forum Administrator #9
If you look at the trigger at the top of the page it is this:


^(\d+)h, (\d+)m, (\d+)e, (\d+)w c?e?x?k?d?b?-(.*)$


Now an example of what that would match is:


1040h, 1100m, 300e, 88w ex-


So, you need to change your prompt to look like that. Add endurance and willpower.
#10
Dude, that's totally weird. I didn't even change it to add all the stats. All I added was endurance and BLAMMO! There it is. I even changed it back to just display health and mana and it's still up. Never would have thought to try that. Thanks Nick, MUSHclient rules, ergo, you rule.
#11
That's a pretty neat plugin. Any chance I could incorpoate parts of it into my system?
Australia Forum Administrator #12
What system? If you mean the plugin I wrote, that is publicly available for use.
#13
I mean would you mind if I dissected for some parts I required and incorporated it into my plugin? I'd give you credit of course =p
Australia Forum Administrator #14
Go ahead.
#15
I do not understand how to change this prompt line. I am entirely new to this programming, and unfortunately I need to be spoon-fed.

Any help would be appreciated.
Australia Forum Administrator #16
Which prompt line? Can you clarify?
#17
The prompt line that you were talking about when you said this:

"
If you look at the trigger at the top of the page it is this:


^(\d+)h, (\d+)m, (\d+)e, (\d+)w c?e?x?k?d?b?-(.*)$


Now an example of what that would match is:


1040h, 1100m, 300e, 88w ex-


So, you need to change your prompt to look like that. Add endurance and willpower."

I've added the plugin that you modified to MUSHclient plugins, and it doesn't show up, so I'm assuming that whatever I'm doing wrong has to do with the prompt line that you mentioned in that quote.
Australia Forum Administrator #18
This is nothing to do with programming. It is saying you need to change your Achaea prompt (in the game) to look like the one you just showed. I don't play that MUD so I don't know how to do it.
#19
Ok. I got it to work. For future reference, to anybody that might ask, you have to type this after you install the plugin:


config prompt hmew


Thanks.
#20
Ok, I'll fix the first post ASAP. Use it for the reference.
Thank you.
#21
I am very interested in a healthbar for achaea. I think I can use this, but I am using .LUA for my script. all my other triggers and everything is in .lua can anyone help me? perhaps make this super cool healthbar thing turn into a uh, .lua one instead of vb? or is it the same? I hesitate to download it in case it screws something up and I can't delete it. if anyone is actually in achaea and uses mush client with .lua, I could use an ATCP that works with vadi system, (I purchased vadi system have not received it yet) that could give me a compass, healthbar, and gauges for willpower and endurance and mana as well. so uh, If any information about .lua script is needed, you know I can get that info easy I will go get it and put it in here. so that you wizards can be able to modify stuff. if you play achaea I will give you gold or forge you a weapon to pay for your time, unless ya'll are so nerdy you actually enjoy this and want to do it for free. hee hee. I love nerds. gimme a sec to get the info:

NEXUS FUNCTIONS AND THEIR MUSH COUNTERPARTS
#set -> Send to: Variable, or SetVariable("variable", "content")
$target -> @target or GetVariable("variable")
{w} and {*} -> *
$1 -> %1
#echo -> Send to: Output, or Note("what to echo")
#groupon/groupoff -> EnableTrigger("label/group", true/false)
#wait -> DoAfter(timeinseconds, "action")
#if -> if something == somethingelse then dothis else dothat end

okay. so ignore the nexus part, it is the part after the arrows that matters. -> then this is what I'm dealing with. I can get more info easily if you need more info, I know nothing about vb script. so if anyone can help get me healthbars and mana, endurance willpower, and a compass, those two things will be a great start. preferably something that won't mess up my expensive vadi system. thanks!

-Drohgnor

p.s. feel free to e-mail me.
#22
I've not used this yet but I'm pretty sure you could make it do just about anything you want and it's in Lua.
Template:post=9097
Please see the forum thread: http://gammon.com.au/forum/?id=9097.
USA #23
Or you could try (since this is Achaea) Trevize's compass and gauges, both available from his website at moonflair.com. They're styled similarly to Nexus's compass and gauges, and they use a separate ATCP plugin to communicate with the server for the extra information.

Plugins are self-contained, by the way; they won't "screw anything up" if they use a different language than the one you have set for your world file. You just have to make sure you have that plugin's language installed, and VBscript should be pre-installed anyways. (I still recommend Trevize's plugins since they're specific to Achaea, though.)

P.S. Did you seriously c/p that from CLHELP RYNNGUIDE? *rofl*