MXP Bug & Question

Posted by Mleo2003 on Thu 20 Sep 2012 03:41 AM — 6 posts, 26,422 views.

#0
2 things. First is, whenever I use the mxp callbacks in my plugin (simple test plugin, function only appends mxp arg to note), all my send tags break, and are no longer clickable, even when I explicitly return 0.

Second is a question. Is there a way to only pull MXP from certain lines? The mud uses mxp for clickable links in many places, but I only want to parse and use the information from certain lines. I'm not sure how to setup a trigger to enable/disable mxp parsing on that line. I don't know if the trigger function would fire after the mxp callback, or before, and how to handle pulling the information after that.
Australia Forum Administrator #1
Can you show your example test plugin?

I don't know of an easy way to make MXP be only occasionally parsed, if that is what you are asking. If not, can you give more details?
#2
Well, the plugin is really empty, save for Notes on Install and Close, and then this:

function OnPluginMXPopenTag (name)
  AppendToNotepad ("MXP", "Opening tag: " .. name .. "\r\n")
  return 0
end -- function


This is all in Lua.

As for the conditional, the line I'm looking for contains an MXP entry in the middle of it, that displays one message, but when clicked sends another to the Mud. I'd like to watch for that line, and pull the href from only that line (it's a SEND tag). There are multiple SEND tags, though.

I was thinking if I had the script just put the last seen MXP information in a global variable in my script, then when the trigger fired, it could pull from there and use that, but I don't know if the MXP callback would fire before or after the trigger function to know if that would work.
Australia Forum Administrator #3
You should be able to use OnPluginMXPopenTag where the arguments are passed to the function, eg.


function OnPluginMXPopenTag (name, args, mylist)


end -- function


I think this will be processed before the trigger because MXP tags are processed as they are hit, and the trigger is processed when the line ends.
#4
I tried that first, as the help files show. The last 2 arguments do not pass anything and are nil. Even the help files I found online mention this as intended behavior in Lua.

I think that hould work as well, so I can just let MXP set a variable and the trigger will pull from that. Only issue left is even if OnPluginMXPOpenTag just returns 0, I lose my clickable links.

*EDIT* I even just put the empty function you posted in a plugin, and tried it again. Even that causes my clickable links to go away. The text is still there, but they are no longer clickable at all.
Amended on Fri 21 Sep 2012 11:54 PM by Mleo2003
Australia Forum Administrator #5
This is a bug in that callback handler. Fixed in version 4.82.

(comma in the wrong place)