|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Mar 18, 2006 6:48 pm
Changes to #MENU command |
Another change in CMUD to warn you about is the #MENU command. As in zMUD, the #MENU command will continue to allow you to execute any menu command from your script. But since the menus are different in CMUD, existing #MENU scripts will probably break.
The #MENU command literally looks at the captions in the menu system. So if a caption on the menu changes, or a command moves to a different submenu, then the #MENU command breaks.
I think having a #MENU command that lets you execute any menu by name is still useful. But in CMUD there will be a new command that will execute these commands by "ID name" instead of by the menu caption.
For example, in zMUD if you want to exit the program you can use:
#MENU {File|Exit}
This goes to the submenu with the caption "File" and executes the menu item with the caption of "Exit". If the menu caption gets changed to "Exit CMUD" then the #MENU command would fail.
A new command will allow you to exit the program directly:
#COMMAND cmdExit
There will be a large list of "commands" like this. Basically, each menu item is associated with a command (in Delphi these are Actions, but I can't call them Actions in CMUD because of the confusion with the TinTin #ACTION which is the same as #TRIGGER).
The advantages of #COMMAND is that these would work regardless of changes to the menu system.
Comments are welcome. Just wanted to give a heads-up for people who might have existing #MENU scripts that will need to be changed. |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sat Mar 18, 2006 11:02 pm |
Why make a new command? Wouldn't it be just as easy/fast to update #MENU to handle it all?
#MENU {File|Exit} -- matches an existing menu caption, executes this menu
#menu {mnuExit} -- matches an existing menu id, executes this menu
#menu "id" {caption} {code} "class" -- defines a new menu or redefines an existing one (seems to be a standard Zscript definition syntax)
If you have to use a stiffer syntax, perhaps anything in {} would equate to captions and anything in "" would equate to ids and anything with 2 or more arguments would be a definition. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sun Mar 19, 2006 1:31 am |
Hmm, well I could use the system menu handle ID possibly. But the main reason I wanted a different command was to handle "commands" that don't necessarily have a corresponding menu item. I wanted to de-couple the user interface (menus) from the functionality (commands).
Redefining menu captions (or adding new menu items) is a whole different ballgame and gets into a bunch of zApp stuff that I'm not going to have in the first beta version yet. You won't use # commands for that, you'll use zApp XML syntax. |
|
|
|
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Sun Mar 19, 2006 7:19 am |
De-coupling is good. It seems more intuitive to me.
|
|
|
|
Rainchild Wizard
Joined: 10 Oct 2000 Posts: 1551 Location: Australia
|
Posted: Sun Mar 19, 2006 10:39 pm |
I would recommend that you add to the "#MENU" documentation a disclaimer like "The #MENU command is obsolete but left in for compatibility purposes. Use #COMMAND instead." ... mainly because for the multi-lingual thing, someone's "File|Exit" may be "Akte|Ausgang" ... but everyone's cmdExit will be cmdExit... so for a shared script library you really want it to function the same no matter what
|
|
|
|
|
|