Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net