|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Mon Mar 03, 2008 7:46 pm
Mxp tags, <script> <send href='' prompt> |
realise that this is a bit off topic/forum, but everywhere for mxp points here, and since it's for a cmud script...
I've recently been using mxp for a number of displays in the status window, and love being able to click on them, sending stuff directly to the mud and sending stuff to the prompt is great. But I would like to bealbe to click them to execute scripts in cmud, resetting counter and the such mainly, currently using the prompt argument, you have to click the link then hit enter. I think I understand why the <script> tag was done away with, not only security issues, but also how do you script for a dozen different mud clients...
Unless I'm missing something and there is a way to do this, which I'ld love to know... it would be GREAT if the <script> tag.. or another tag was re-implemented insofar as if the tag came from the client the script was executed, or from the mud, it would be sent to the prompt. |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4690 Location: Pensacola, FL, USA
|
Posted: Mon Mar 03, 2008 8:31 pm |
<send '#EXEC {aliasname}'>clicky</send>
that should work... |
|
_________________ Discord: Shalimarwildcat |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Mar 03, 2008 8:52 pm |
While it may not be exactly what you're looking for, I came up with a technique to RAISEEVENT using MXP so that maybe something you'd be interested in.
Here's an example code snippet
Code: |
%concat(" <send '",%char(35)"EXEC ",%char(34),"#RaiseEvent displayMainStatus CoreStatus",%char(34),"'>Back to Main Menu</send>") %crlf %crlf |
I display that code in the status window. I had it in a variable (so I could combine it with other things).
Basically the click does a #EXEC to raise the event called 'displayMainStatus'. 'CoreStatus' was an argument to that event. The %char(35) was added to get around some quoting issues since i was working from a variable.
Hope that helps. |
|
_________________ Asati di tempari! |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Mon Mar 03, 2008 9:54 pm |
Shalimar - Tried that but because of the syntax error it generates, figured that it was not supposed to work that way.
Tech - Perfect.. or close enough, should be able to adapt that to do most any scripting commands, save for the few bugs that execute has... it is a bit long to do something... fairly simple... cheers for copy and paste
Thanks for help! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Mar 03, 2008 9:55 pm |
MXP does actually support some script commands direct from the tag, but you can't use many of them for safety reasons (since zScript can create and remove files, run applications, etc etc). There's no complete list of these commands, but I wouldn't be surprised if #exec was one of them, for hopefully obvious reasons.
However, aliases work absolutely fine because you need to create them yourself first. So make an alias to do whatever you want to do and then use
<send 'alias param param'>text</send>
and it should work fine. I use this method myself for things like a menu of script options (autohealing on, click the on changes it to off, etc). |
|
|
|
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Mon Mar 03, 2008 10:45 pm |
If you are not executing direct CMUD commands
Code: |
#MXP.....<send 'alias param(s)'>....</send>
|
should work just fine. Don't forget the single quotes. |
|
_________________ Sic itur ad astra. |
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Tue Mar 04, 2008 2:25 am |
WEEEE that works great.
Thanks for the additional posts, was looking around for something simple like that.
Don't think I missed a helpfile/website with that info so assuming that you guys have just Stumbled across these...features? |
|
_________________ "To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 04, 2008 2:28 am |
I believe it's mentioned in the mxp help that the commands you can use from MXP are limited, but if it's not, I can find somewhere to add it.
|
|
|
|
wrym Magician
Joined: 06 Jul 2007 Posts: 349 Location: The big palace, My own lil world
|
Posted: Tue Mar 04, 2008 5:06 am |
Fang - Yeah it does, total missed that. part about secure mxp commands also says that thre is a full listing of commands in the mxp specification. Focus's more so on what you CANT do and not what can be done.
A link to that, and or some a example or two would be great I think,... this post even has a few examples I think... |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Mar 04, 2008 5:24 am |
I've added a short section explaining about aliases and zScript in <send>. The part you read refers to MXP commands, which is the term the article uses when talking about the different MXP tags. There are more than <a> and <send> available, but most of them are for advanced users only (and by that I mean they're niche things you probably won't use :P). Also, there's a link to the MXP spec right at the top of the article.
Allow me to take this moment to again bemoan whoever it was at whatever MUD it was that decided that an <!EVENT> tag would be a good idea. <defineEvent> and <event> would've worked just as well and would've fit the spec like a glove. Grr. |
|
|
|
|
|