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.
Entire forum
➜ MUSHclient
➜ Plugins
➜ Improved health bar plugin - can be dragged around
Improved health bar plugin - can be dragged around
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
4
5
6 7
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #75 on Wed 01 Jun 2011 07:42 AM (UTC) |
Message
| Did you reinstall the plugin? And only do one suggestion, not both of them. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Renox Dashin
(17 posts) Bio
|
Date
| Reply #76 on Wed 01 Jun 2011 08:17 AM (UTC) |
Message
| i eventually ended up changing the other characters prompt to match. I was having problems trying to do the other chars because theres only 2 gauges. Didn't want to butcher the code. Is there a way to put your group members hp% on there?
[Neravar *%][*/*hp|*/*mp|*/*mv]
Honestly the MV in this MUD is completely useless. and the
[Neravar *%] is only there if your in a group. If your NOT in a group it shows up as [*/*hp|*/*mp|*/*mv]
how can i make this work? without the MV | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #77 on Wed 01 Jun 2011 08:31 AM (UTC) Amended on Wed 01 Jun 2011 08:32 AM (UTC) by Nick Gammon
|
Message
| The plugin was supposed to be a guide to the general idea. To get rid of the MV part, look for these lines:
DoGauge ("HP: ", hp , max_hp, ColourNameToRGB "darkgreen")
DoGauge ("Mana: ", mana, max_mana, ColourNameToRGB "mediumblue")
DoGauge ("Move: ", move, max_move, ColourNameToRGB "gold")
Delete the last line.
And for the asterisks (which will make it fail) change the regexp to match on digits, eg.
^.*?\[(\d+)\/(\d+)hp\|(\d+)\/(\d+)mp\|(\d+)\/(\d+)mv\]$
The \d+ thing matches on one or more digits (so it won't match on an asterisk.
And no, you don't need a plugin per prompt. Just add another trigger to the existing plugin to match the different prompt, the rest being the same.
So you would have:
<triggers>
<trigger
enabled="y"
match="first prompt whatever it is"
regexp="y"
script="do_prompt"
sequence="100"
>
</trigger>
</triggers>
<triggers>
<trigger
enabled="y"
match="second prompt whatever it is"
regexp="y"
script="do_prompt"
sequence="100"
>
</trigger>
</triggers>
|
Regular expressions
- Regular expressions (as used in triggers and aliases) are documented on the Regular expression tips forum page.
- Also see how Lua string matching patterns work, as documented on the Lua string.find page.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Renox Dashin
(17 posts) Bio
|
Date
| Reply #78 on Wed 01 Jun 2011 05:10 PM (UTC) |
Message
| Okay so how would i convert the third bar, to read a percentage of my group members health?
It doesn't show their hp and max. Just like 56% or 99% once it hits 100% it switchs to a different party member. How hard would it be to convert it to work with this? only on the third bar?
I'm sorry i'm being such a handful, i've never coded before and im kinda having trouble grasping it. I did get the chatbox AND the healthbar to work however, i just want to replace MV bar with Group health % | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #79 on Wed 01 Jun 2011 10:11 PM (UTC) |
Message
| Er, well, how do *you* know your group's health? Can you post some example prompts?
Making a script is basically taking information that you normally see, and getting a trigger to capture that. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Renox Dashin
(17 posts) Bio
|
Date
| Reply #80 on Wed 01 Jun 2011 10:27 PM (UTC) |
Message
| grouped - [Bellrog 98%][87/124hp|101/132mp|100/100mv]
not grouped - [87/124hp|101/132mp|100/100mv]
if partymembers are at 100% it shows my name in their spot.
I can add this as the third bar on the HP/MP bar right?
Can i add a fourth one too right?
for example if i changed my prompt to show exp as follows
[Bellrog 98%][87/124hp|101/132mp|100/100mv|65,447 tnl]
i can also make it pick up exp right? this is tricky for me because the groupmember health box isn't there if your not in a group.
| Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #81 on Thu 02 Jun 2011 02:29 AM (UTC) |
Message
| It can all be done, why not try it? I prefer to help debug scripts after someone has tried, not just answer general questions "can this be done?".
Virtually anything can be done, we have mappers that show hundreds of rooms at once. You will learn by trying, you can't break anything. Make a copy of the plugin if you are worried about going backwards. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Renox Dashin
(17 posts) Bio
|
Date
| Reply #82 on Thu 02 Jun 2011 03:26 AM (UTC) |
Message
| Honestly when i look at the coding i see jibberish so i look for keywords and edit small things. I'm not that good with coding to do like any of the simplest things :( | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #83 on Thu 02 Jun 2011 07:31 AM (UTC) |
Message
| I don't have the resources to actually code plugins for individual players, for each one of the 1000 or so MUDs around.
I try to distribute examples and explain how they work. If they work without change, that's great. Hopefully the changes needed to make them work on a different MUD are minor.
And indeed it sounds like you got it to work for your MUD as well. But to make major changes like incorporating members of a group, for a MUD I don't play (and I don't think you mentioned the name of), requires some work by you, the player.
You will learn a lot more, and empower yourself to make even better plugins, by trying to do things yourself. If I do it, you haven't learned anything, and tomorrow you will want me to do something else.
If you aren't sure, try reading the "Programming in Lua" online book:
http://www.lua.org/pil/
Experiment with the Immediate window to see how simple script commands work.
I've done a number of YouTube videos showing how to do things, like scripting, making aliases, triggers and plugins:
http://www.gammon.com.au/forum/?bbtopic_id=120
It validates the time I have taken to produce those, if people look at them, and experiment with the ideas shown there. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zylo4
USA (9 posts) Bio
|
Date
| Reply #84 on Thu 16 Jun 2011 12:51 AM (UTC) |
Message
| I've got the code and got it working with a few minor modifications. Works beautifully, save for one thing.
I, too, have a prompt which does not define the maximum values. At present, I have them hard coded in. Due to the way that I've been building up my system, I DO have the values readily available in variables.
But I can't seem to CALL them. Tried several variations of a standard getvariable line, to no avail. Is there a way to call a variable into this script, and if so, how does one do it?
What I've got at present is as follows:
max_endurance = world.GetVariable ("MaxEnd") or 402
It's picking up the 402, so if nothing else I'm pretty certain that I have the line in the right area of the script.
Any assistance you can give me would be much appreciated. | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #85 on Thu 16 Jun 2011 01:27 AM (UTC) |
Message
| If you open world configuration, and near the bottom at the Variables tab, do you see the variable "MaxEnd"? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zylo4
USA (9 posts) Bio
|
Date
| Reply #86 on Thu 16 Jun 2011 01:32 AM (UTC) |
Message
| Yes, I do.
And if I execute
ColourNote("","",tostring(GetVariable("MaxEnd")))
It does respond appropriately. So the variable itself seems to be okay, as long as I'm executing it from the world and not the plugin. | Top |
|
Posted by
| Nick Gammon
Australia (23,102 posts) Bio
Forum Administrator |
Date
| Reply #87 on Thu 16 Jun 2011 07:26 AM (UTC) |
Message
| Well you didn't exactly mention that you were trying to get a variable inside a plugin that exists outside the plugin. Each plugin, and the main world, have independent script and variable "spaces".
However it can be done.
If you call that with an empty string as the plugin ID then you will get the main world variable. eg.
maxend = GetPluginVariable ("", "MaxEnd")
You don't need to use tostring, GetVariable always returns strings (or nil if the variable doesn't exist). |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Zylo4
USA (9 posts) Bio
|
Date
| Reply #88 on Thu 16 Jun 2011 06:40 PM (UTC) |
Message
| Ah, apologies. I was under the impression that I could pull variables like I usually do (I usually do all of my work inside the world, with only minor projects in plugins).
With GetPluginVariable, it works beautifully. Thank you very much for the help, as well as for the link up to the functions' page. Much appreciated on both counts! | Top |
|
Posted by
| Aralia Faal
(25 posts) Bio
|
Date
| Reply #89 on Fri 23 Sep 2011 06:18 PM (UTC) Amended on Fri 23 Sep 2011 11:14 PM (UTC) by Nick Gammon
|
Message
| I've edited the script to need one to type score and the prompt formatting. I load it and it type score and hit enter a few times and get no errors but the miniwindow does not display.
Prompt:
[Fury: 100]
[PL: 84,587,890][KI: 83,331,246][STA: 83,316,014][TNL: 21,025,070][ 7 PM][Zen: 5,263]>
Score:
O==========================={ Health }==============================O
|CUR Pl: [ 84,587,890] CUR KI: [ 83,331,246] CUR STA: [ 83,316,014]
|MAX Pl: [ 84,587,890] MAX KI: [ 83,331,246] MAX STA: [ 83,316,014]
Script:
To follow | 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.
296,341 views.
This is page 6, subject is 7 pages long:
1
2
3
4
5
6 7
It is now over 60 days since the last post. This thread is closed.
Refresh page
top