Help with MXP.

Posted by Seyen on Sat 26 Aug 2006 11:38 PM — 5 posts, 19,861 views.

Moldova #0
..Sorry, I couldn't find a more fitting title.

What I want to do is capture a MXP entity, and display it's value in the info bar. I want this info constatnly updated each time the client receives said entity.

Now, the only way I have thought yet is to put a function in the script file that processes MXP errors(with arguments given in the help file). Then I add said function to "MXP Script Routines" under "Error". Thus every message that involves MXP gets checked, and my function fires when needed.

My question: Is there any other way?
First of all, I don't think it's too effective, cause it's checking a lot of information(not only errors, but ino, warnings, and something else I forgot), so it's slower than it could be.
Second, I don't know if the Error MXP script routine accepts more than one function. If it doesn't, I wouldn't want to keep my function there. Cause I might need the sace for something else.

I only receive the MXP entities when I send commands to the MUD(any commands), so I thought I'd do a trigger, but I don't know how to make a trigger match anything I send(not anything I receive).

Also, I would eventually want to put this into a plugin. What limitations would apply and what can I do to not be restricted?

I know I could probably have found the answer if I'd peruse Lua's docs and the help files for a few hours or more(I'm a very big MUSHClient newbie), but it's really late, and if anyone can be bothered to drop me a response, please do.
Amended on Sat 26 Aug 2006 11:39 PM by Seyen
Australia Forum Administrator #1
To catch anthing you send you could make an alias that matches "*", give it a low sequence number, and check "keep evaluating".

However this probably wouldn't totally work because it would match before the MUD responded.

I can't see an easy way of doing this so I have added another plugin callback OnPluginMXPsetEntity to version 3.79. That will be called whenever the MUD changes an entity. That should let you display it.

As a workaround for now, you could just set up a timer that fires every couple of seconds and updates the status bar.
Moldova #2
Maybe if I'd script an alias with an inbuilt timer? Lua should probably have some delay operation(which would wait for 200-300 miliseconds) perhaps?
Australia Forum Administrator #3
You can make a temporary timer to do something after a little while, see:

http://www.gammon.com.au/scripts/doc.php?function=DoAfterSpecial

However I'm not sure this is much better. If the MUD is laggy, 200 ms might not be long enough, whilst 2 seconds might be too long.

A simple timer that fires every second and updates the status line, will not take many resources and will be reliable.
Moldova #4
I see, I will try that. Thanks a lot for the timely answers :)