(See the best response by LordAndrew.)
As the title suggest, I have a question regarding Script files (*.dms) and their macro assigning capability. Reading around on the forums lately has been rather helpful; I learned a new technique when it comes to handling keystrokes that I hadn't thought of before, namely having macros for when a key is both pressed and released. The issue I've been having is that editing the macros from within the Interface file (*.dmf) is a pain; I'd much rather have the simplicity of typing out the macros within a particular syntax.

Unfortunately, I've ran into a little snag, specifically the lack of documentation regarding Script files and their syntax. All I can find is the small section located in the DM reference and the F1 help menu within Dream Maker. With that, I wrote this:

NORTH return "MoveHandle \"NORTH\" \"D\""
SOUTH return "MoveHandle \"SOUTH\" \"D\""

This particular code works just fine; Assuming the MoveHandle() verb is programmed to echo the direction and the state of the key, it will trigger when you press the up and down arrow keys, and output the key appropriately. The issue I'm having is that I don't know how to trigger the released state. Poking around the macro section of the Interface file, I noticed that the released state is simply the key with +UP appended, so I tried the following code.

NORTH return "MoveHandle \"NORTH\" \"D\""
SOUTH+UP return "MoveHandle \"NORTH\" \"U\""
SOUTH return "MoveHandle \"SOUTH\" \"D\""
SOUTH+UP return "MoveHandle \"SOUTH\" \"U\""

Unfortunately, I run into a syntax error; "macro.dms:3:error at '+': statement syntax error". It seems as though that's not the way to go, though I'm confused as to how to go about my method otherwise.

Is it possible to achieve what I'm attempting to accomplish here, or am I forced to use the clunky GUI based macro editing method from within the Interface file?
Best response
The .dms file is depreciated and doesn't have a lot of function. .dmf is much more versatile. Also no, you don't implicitly have to to use a .dmf file, it's possible to generate macros at runtime.


Macros can also be changed at runtime. If a macro does not have an ID, you can refer to it by its key combination. If you have a macro set named macro1 and have a Ctrl+E macro for instance, you could use winset() with "macro1.Ctrl+E". These are the parameters that can be changed using winset():

  • name
  • command
  • is-disabled

The name is actually the full key combination as it would appear in the macro editor, like CTRL+E, Space+REP, or Alt+Shift+F1. This is not case-specific and it doesn't matter where you put modifiers like CTRL+, SHIFT+, etc.

A new macro can be added to a macro set at runtime by including a parent parameter, which points to the ID of an existing macro set. Using the example above, Ctrl+E could be added as a macro at runtime like so:

winset(usr, "myCtrlEmacro", "parent=macro1;name=Ctrl+E;command=exit")
Macros that were added this way can also be deleted again by setting their parent to a blank value.

winset(usr, "macro1.myCtrlEmacro", "parent=")
A macro set can also be cloned with winclone. To use the macros, use winset() to assign the macro set to a window.

(From the Interface Reference.)
Also, if you get stuck you can always have a look at (or use, even!) either SuperAntx's Simple Move or Forum_account's Keyboard library.
Thank you again for your prompt response, LordAndrew. This is definitely a great help. =3