Plugins and writing them

Posted by Hathcock on Fri 19 Dec 2003 07:54 AM — 25 posts, 102,662 views.

#0
ok, I tried this for hours before I posted here, and I looked at what I can find for plugins already, but I'm lost. I posted a couple weeks ago about setting up an autohealer/sipper but it never worked out.....I found a site for the realm I play in that has a mushclient sipper script, but it requires me to set it up as a plugin in .xml, so I'm completely lost on how to set it. for ease, anyone thats interested, the site that has the auto sipper is www.achaea.cjb.net under the scripts section, scroll down to after the Zmud script section and it will have an area for mushclient scripts....the sipper is listed there. The next post I place here will contain the entire script listed, maybe someone in their free time can take a look and point my dumbass in the right direction. Please do not spend anytime on this if it's going to be hard, Shadowfyr already has done to much to help me and used alot of time....but if anyone knows an easy answer to why I keep screwing up, please let me know, thanks
#1
ok, I can't paste it all here, I keep getting errors from it being to big. If anyone feels like taking the time I guess, you can go to the website, or let me know how the hell to save it as an .xml easily, thanks
Russia #2
Since that plugin is actually mine... Don't bother with the version on the site - it's probably outdated anyways. Go to achaea.mc0wnage.com/forums, browse to the Scripts section and find the thread named "Auto vial drinker (Mushclient version). That thread has the most recent update (near the end of it), as well as instructions on how to set up a plugin (in the thread's original post.
Australia Forum Administrator #3
That looks great. Can I add it to the plugins area here?
Russia #4
Sure Nick!
#5
I was able to get the AutoHealer.xml added to plugins, and it says it turns on when I enter "ah on" but I don't heal, I set the maxhealth and mana, and it confirmed it,but when I get hit it doesn't heal me, even when low on life it wasn't healing, the mana didn't work either.....is there something else I'm forgetting to do?

Also, I need to set variables for my pipes, what is the easiest way to do this? So I can switch them around when I'm on different characters without manually having to go through each pipes alias and trigger and changing out the ID#'s
Australia Forum Administrator #6

I have added this plugin to the plugins area on this site. See: MUSHclient plugins.

Any other plugin authors that have a debugged and useful plugin are welcome to mention it here for inclusion in the plugins area.

That way your plugin isn't lost if the site where it currently appears goes down, and it gets shared with a lot of other MUSHclient users.

Amended on Mon 22 Dec 2003 12:42 AM by Nick Gammon
#7
There's an error when you click the Autohealer line
Australia Forum Administrator #8
Hmm - that will teach me to not test it first. :)

There was a problem in my system somewhere. Some spaces had converted themselves from hex 20 to hex A0. I have fixed that up and reposted it.

Anyway, you should right-click it to download it, single-left-clicking will simply display the XML in your browser, which may or may not look good, but won't be suitable for installation.
Amended on Mon 22 Dec 2003 06:56 PM by Nick Gammon
#9
Hmmm, I'm able to get it added to the plugins, and when I type ah on, a confirmation comes up saying it's on...then I set the maxmana and health but it doesn't heal still...is it specific only to Achaea? I'm in Aetolia, which is pretty much the same thing.......

Also, if anyone can still tell me how tomake a simple variable, that would be great. I need it for 3 pipes, each with ID#'s, so that when I switch characters, I just have to change a variable I guess instead of changing all the pipes trigegrs/aliases themselves one by one, thanks for the help
Canada #10
World.SetVariable
http://www.mushclient.com/scripts/function.php?name=SetVariable

and to retrieve value:

World.GetVariable
http://www.mushclient.com/scripts/function.php?name=GetVariable
#11
I'm still not able to get the Autohealrer to work...anyone else having problems with it?
Australia Forum Administrator #12
The auto-healer has some rather specific triggers in it. I suggest you post an example prompt line so we can see what the difference is between what it is matching on, and what the MUD is supplying.
Russia #13
The most common cause of problems is the prompt. Make sure the plugin's prompt trigger matches on yours. It's set by default for the basic Achaean format: "1234h, 1234m cex-" and it won't match on anything else. Check out my last message in the plugin's thread at achaea.mc0wnage.com/forums site, it has the details on how to amend the prompt trigger.
Russia #14
Erm, the prompt explanation was actually in a different thread - the one for RiftList. I'll just paste the relevant post here:



Someone else complained to me about the same problem before and it turned out that the prompt was to blame. The plugin uses your prompt to figure out when it has recieved the full rift listing and should count and display the herbs, so if the prompt trigger doesn't match, then the plugin will never finish waiting for the end of rift output. Try changing the 'match' property of the 'rlist_finish' trigger to something that'll fit your prompt if it's different from the standard "1234h, 1234m cx-" thingy. Just put "\d+n" for every extra stat you have, where 'n' stands for the actual letter. For example, if your prompt looks like:

1234h, 1234m, 1234w cex-

then you'll need to put the following into the trigger's match:

^(\d+h), (\d+m), \d+w \D*-.*$
Amended on Wed 24 Dec 2003 07:21 AM by Ked
#15
H:3436 M:2644 B:98% [eb]

thats what the prompt look like....I tried this, but it didn't work ^H\:(\d+) M\:(\d+) B\:(\d+)\% \[.*\]
USA #16
Hmm. The problem here is if there are any extra spaces between things. The trigger you have 'should' work if the like is exactly that way, but if there are two spaces some place instead... You could try:

^H\:(\d+)\s+M\:(\d+)\s+B\:(\d+)\%\s+\[.*\]

By using \s+ you tell it to match no matter how many spaces are in between. Also, make *sure* you have the trigger set to use a regular expression. This is often the single most common mistake made, aside from getting the spacing wrong.
Australia Forum Administrator #17
The first question is, did the trigger actually match?

Disable the plugin for a moment, and try your trigger manually by entering it into trigger configuration, and colour the line (eg. yellow).

Then see if the prompt changes the line colour. If so, there is a problem in the calculations. If not, you need to investigate why.
#18
That worked!! It works great, but is there a way to stop it from drinking twice in a row...it does that every so often...instead of waiting the 5 second delay
Russia #19
That's a little bug I've noticed myself: if you sit there without doing anything and let the prompt idle on the screen without recieving a newline to close it, the timer will eventualy fire and it drinks twice. Not exactly sure why that happens, but I'll be looking into it. Myself, I simply don't loiter - I use the plugin when bashing or pk'ing and then everything moves fast enough to avoid getting that behavior.
#20
Alright, I am having problems with this auto healer as well. Using the previous posts I now have the match to be

^H\:(\d+)\s+M\:(\d+)\s+E\:(\d+)\s+Dev\:(\d+)\%\s+XP\:(\d+)\%\s+\[.*\]

My prompt in game looks like this:

H:2140 M:1274 E:9600 Dev:100% XP:1% [eb]

What am I doing wrong? As for "regular expressions, how do I check and set that?
Australia Forum Administrator #21
Can you show the whole trigger?

Inside it there should be: regexp="y"
#22
<triggers>
<trigger
enabled="y"
keep_evaluating="y"
match="^H\:(\d+)\s+M\:(\d+)\s+E\:(\d+)\s+Dev\:(\d+)\%\s+XP\:(\d+)\%\s+\[.*\]"
name="prompt_trigger"
regexp="y"
script="DecipherPromptInfo"
sequence="1"
other_text_colour="black"
other_back_colour="black"
Australia Forum Administrator #23
I tested that with your example line and the trigger fired. Are you saying the trigger doesn't fire, or something else goes wrong?
#24
After re-downloading the file and pasting in the match line, it now works. Thank you so much for all of your help.