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 ➜ Lua ➜ Help with MXP.

Help with MXP.

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


Posted by Seyen   Moldova  (4 posts)  Bio
Date Sat 26 Aug 2006 11:38 PM (UTC)

Amended on Sat 26 Aug 2006 11:39 PM (UTC) by Seyen

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

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sun 27 Aug 2006 12:21 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Seyen   Moldova  (4 posts)  Bio
Date Reply #2 on Sun 27 Aug 2006 10:36 AM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #3 on Sun 27 Aug 2006 10:13 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Seyen   Moldova  (4 posts)  Bio
Date Reply #4 on Sun 27 Aug 2006 11:44 PM (UTC)
Message
I see, I will try that. Thanks a lot for the timely answers :)
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.


18,857 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.