Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Editing the Health Bar Plugin

Editing the Health Bar Plugin

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Ishnaf   Australia  (17 posts)  Bio
Date Fri 13 Jun 2003 08:11 AM (UTC)
Message
Hello again people,

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!

What do i need to change to do this?

thanks,
ishnaf



egads!
Top

Posted by Ishnaf   Australia  (17 posts)  Bio
Date Reply #1 on Fri 13 Jun 2003 09:14 AM (UTC)

Amended on Fri 13 Jun 2003 09:18 AM (UTC) by Ishnaf

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

</plugin>


<!-- Get our standard constants -->

<include name="constants.vbs"/>

<!-- Triggers -->

<triggers>
<trigger
enabled="y"
match="Power [ */ * ] Need [*] * "
name="max2"
send_to="9"
sequence="100"
variable="max_power"
other_text_colour="black"
other_back_colour="black"
>
<send>%2</send>
</trigger>
<trigger
enabled="y"
match="Vigor [ */ * ] Gold [*] *"
name="max3"
send_to="9"
sequence="100"
variable="max_vigor"
other_text_colour="black"
other_back_colour="black"
>
<send>%2</send>
</trigger>
<trigger
enabled="y"
match="*H *M *V [*] *"
name="max4"
script="DoPrompt"
sequence="100"
other_text_colour="black"
other_back_colour="black"
>
</trigger>
<trigger
enabled="y"
match="Health [ */ * ] Exp [*] *"
name="max"
send_to="9"
sequence="100"
variable="max_health"
other_text_colour="black"
other_back_colour="black"
>
<send>%2</send>
</trigger>
</triggers>

<!-- Variables -->

<variables>
<variable name="max_vigor">127</variable>
<variable name="max_health">316</variable>
<variable name="max_power">908</variable>
</variables>

<!-- Script -->


<script>
<![CDATA[

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

'
' Do this once
'
ShowInfoBar vbTrue

]]>
</script>


<!-- Plugin help -->

<aliases>
<alias
script="OnHelp"
match="ishnaf-health_bar"
enabled="y"
>
</alias>
</aliases>

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

</muclient>

egads!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,324 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.