 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Aug 03, 2007 10:17 am
Raise an Event from MXP |
I sure the coding guru's already know this but I thought I'd share.
This code snippet can raise an event from an MXP link.
| Code: |
| #mxp <send {'#EXEC "#RaiseEvent MiningStatusDisplay"'} >Mining Statistics</send> |
I hope it helps someone out there. Personally I'm using Fang's suggestion of using modules for inter-package communication. I'm using this to develop an MXP menu driven status window. Each package determines what is displayed for it's StatusWindow by listening to the appropriate event. |
|
_________________ Asati di tempari! |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Aug 03, 2007 10:53 am |
I had to escape the quote " characters to get it working, but work it does. You don't actually need the #exec - <send {'#RaiseEvent MiningStatusDisplay'} > will work.
But I was under the impression that MXP couldn't execute CMUD commands directly. Perhaps this is limited only to certain commands (I tried to use #var at some point in the past and was told it wasn't allowed) but I definitely think that #exec should be on that list!
And also, you need to have the braces to get it to compile (illegal token without them) but braces are never mentioned as required in MXP tags. I think that's a new bug as well. |
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri Aug 03, 2007 9:21 pm |
It's changes a little bit depending of if it's being run from the command line, or if defining directly in the status window or a variable. So sometimes it is, but not always.
|
|
_________________ Asati di tempari! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Aug 06, 2007 6:18 pm |
There is an option in the MXP Preferences to determine whether an MXP menu is allowed to execute commands. So be aware that some users might turn this off to prevent the MUD from doing something bad to their system.
|
|
|
|
 |
|
|
|