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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Thu Dec 07, 2006 9:47 pm   

[1.20] Question on usage of #MODULE (possible bug)
 
Wanting to see if I could "programmatically" create a module from a script, I did the following:

Code:
#MODULE "My Calendar"

#CLASS Calendar|Sync
#EVENT OnPrompt {
   #T- Palisade|Calendar|Sync
   date
   time
}
#CLASS 0

#MODULE 0


If I execute this from the command-line, it does exactly what I want and creates a new module "My Calendar" with the Calendar|Sync class folder in it and the single event.

If I use the Action menu to Execute Script, it creates the "My Calendar" module, but then puts the Calendar|Sync class and event in the untitled window module.

I don't think I did this the wrong way (and I prefer to use the execute script option rather than pasting scripts into the command-line as some of them are hundreds or thousands of lines long), so is this a bug?
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Dec 07, 2006 11:39 pm   
 
It's because of how the Execute Script action works. In order to maintain compatibility with zMUD, it actually splits your script into lines and executes it line by line. Whereas on the command line, it compiles and executes the command all at once. Changing the current module using #MODULE only works within a code block...so as soon as the Execute Script goes to the next line, the scope is set back to the current window.

The same problem will happen when using the Editor window since it also sends stuff to the MUD window line by line (although an option was added to the Editor that you can toggle off to fix this).

Unfortunately, it's just the way #MODULE works. Not much I can do right now, so I'd suggest using the Editor window for long scripts like that.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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