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, 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 ➜ MXP and Pueblo ➜ Triggering on MXP

Triggering on MXP

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


Posted by Teapot   Australia  (9 posts)  Bio
Date Fri 14 Aug 2009 06:25 AM (UTC)
Message
Hello! I haven't yet worked out how to make triggers in any way interact with MXP. Can anyone point me in the right direction?

Here is a sample line from my MUD:
.[4z<Green>.[4z<b>(.[4z<talker>Channel.[4z</talker>) Someone wisps: Testing!.[3z.[4z<BR>

I'd like a way to make a trigger fire on colours like <Green> or <C #AF1E2D>. This is for when I want to check that a line is a certain colour, and also for when I'm matching only on colour.

I'd also like to be able to match specific tags like <talker>, which I assume will be very similiar to matching <Green>.

Thanks!
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 14 Aug 2009 06:45 AM (UTC)
Message
http://www.gammon.com.au/scripts/doc.php?general=mxp_callbacks

- Nick Gammon

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

Posted by Teapot   Australia  (9 posts)  Bio
Date Reply #2 on Fri 14 Aug 2009 07:25 AM (UTC)
Message
I gave that a go, and thought I was barking up the wrong tree. When using the OnPluginMXPcloseTag and the OnPluginMXPcloseTag functions provided on that page, everything (both the tag name and the arguments/text) seems to be passed to the function as the 'name' argument. For instance:
Closing tag: green,(Channel) Someone wisps: Testing.
Text: No text


or

Opening tag: send,expire='Exits'
Argument list: No arguments


What am I doing wrong?

[Edit: failure to operate slashes.]
Top

Posted by Nick Gammon   Australia  (23,057 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 15 Aug 2009 03:26 AM (UTC)
Message
Maybe the documentation is slightly wrong. I found this in another post:





OnPluginMXPstart
OnPluginMXPstop
OnPluginMXPopenTag
OnPluginMXPcloseTag
OnPluginMXPsetVariable
OnPluginMXPerror




OnPluginMXPopenTag

It seems that in the case of OnPluginMXPopenTag it the callback expects a single argument in the form:

name,arguments

In other words, you would get something like this:

sound,FName="mm_door_open.*" V=100 L=1 P=50 T="misc"

Thus you could use Split to break up the line into "sound" and the arguments, and then proceed much the same as before.


OnPluginMXPcloseTag

Just to complete the documentation, in the case of OnPluginMXPcloseTag you get the tag name followed by the text of the tag. eg.

<b>Hi there</b>

In this case the close tag for "b" would have as its argument:

b,Hi there


OnPluginMXPsetVariable

For OnPluginMXPsetVariable the argument is variable name=value, eg.

RoomName=Red Square


OnPluginMXPerror

For OnPluginMXPerror the argument is:

level,number,line_number,message

eg.

I,10008,417,MXP mode change from 'open' to 'permanently secure'





- Nick Gammon

www.gammon.com.au, www.mushclient.com
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,234 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.