I need a little bit of help editing the health bar plugin for my Mud. The problem I'm having is my MUD does not display Maximum hitpoints / mana on the prompt, to see this you have to type 'score' and it sends out:
Health [ 399/ 399 ] Exp [ 27414035] QP [ 3]
Power [ 189/ 189 ] Need [ 3316143] Clan [ No Clan]
Vigor [ 124/ 124 ] Gold [ 27437] Rank [ No Clan]
So, I made a few triggers to set the maximums as variables:
max_health, max_power
whenever you type 'score' and see this info.
I also made a trigger to match my prompt (Its not RegExp because i find that a headache :P):
399H 189M 124V [52] >
has trigger
*H *M *V [*] *
The problem is, I have no Idea how to get these to give this info to the plugin!
Ok, i have got your script working by myself (I know, I know...)
Its pretty goddam cool, but it doesnt seem to update itself very often (e.g. if I cast a spell on myself it doesnt notice I use mana until later on at some random time). Here it is in all its glory, but could someone tell me why it doesnt update very often? I have a feeling its because my trigger isnt working proper, but i really cant do Regular Expressions so its the best I can do ;P
If someone could figure out why it doesnt update often, Id appreciate it :)
Anyway here it is, (set up for bb8.betterbox.net, port 6666):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, June 13, 2003, 5:01 PM -->
<!-- MuClient version 3.42 -->
<!-- Plugin "health_bar" generated by Plugin Wizard -->
<muclient>
<plugin
name="health_bar"
author="Ishnaf / Nick Gammon"
id="a2af5216d68563401888e01e"
language="VBscript"
save_state="y"
date_written="2003-06-13 16:56:36"
requires="3.40"
version="1.0"
purpose="a health bar plugin"
>
<description trim="y">
<![CDATA[
This is a health bar plugin that displays your health in bars :) Its flashy :)
It basically installs itself. All you need to do is:
1. Add this plugin to your plugin list.
2. Type 'score' to let the plugin know its maximums it should work already!
Have fun!
NOTES FOR ENTHUSIASTS:
The script gets it maximums from the MUD readout, i.e.:
Health [ whatever ......
Power [ 438/908 ] Exp[........
I did it this way because its automatic and easy to set up...
]]>
</description>
world.note "Health bar script loaded"
world.note "type ishnaf-health_bar for help"
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
dim health, power, vigor
health = world.GetVariable("max_health")
power = world.GetVariable("max_power")
vigor = world.GetVariable("max_vigor")
'this checks to make sure the maxmana/hit and stuff is ok, so the script doesnt have a sad.
dim d
d=1
if cInt(wildcards(1)) > cInt(health) then
d=0
end if
if cInt(wildcards(2)) > cInt(power) then
d=0
end if
if cInt(wildcards(3)) > cInt(vigor) then
d=0
end if
'if this case is true, yer script would have a sad, so we display this:
if d=0 then
world.colourTell "red", "black", "-----------------------Health_Bar Scripting Alert-------------------"
world.note ""
world.colourTell "white", "black", "your maximum hitpoints/mana are set too low for this script to run."
world.note ""
world.colourTell "white", "black", "please type 'score' and check your score, and this should fix the problem,"
world.note ""
world.colourTell "white", "black", "as the plugin gets your maximum values and updates them whenever you check"
world.note ""
world.colourTell "white", "black", "your score"
world.sound "ding.wav"
else
'this means its checked everything is ok, and is continuing
DoGauge " HP: ", wildcards (1), cInt(health), "darkgreen", "maroon"
DoGauge " Mana: ", wildcards (2), cInt(power), "mediumblue", "mediumblue"
DoGauge " Move: ", wildcards (3), cInt(vigor), "gold", "gold"
end if
end sub