ID:958181
 
Not a bug
BYOND Version:496
Operating System:Windows 7 Home Basic 64-bit
Web Browser:Firefox 14.0.1
Applies to:Dream Maker
Status: Not a bug

This is not a bug. It may be an incorrect use of syntax or a limitation in the software. For further discussion on the matter, please consult the BYOND forums.
Descriptive Problem Summary:
Using the old "macro" script command (see "macro" under the Dream Maker F1 help), you can create macros for letters, but not for numbers.

Numbered Steps to Reproduce Problem:
1. Create a macro file (ending in .dms)
2. Include file with project.
3. Try to make the macro trigger with a number (1,2,3,4,5,6,7,8,9,or 0).
4. Error, cannot compile.

Code Snippet (if applicable) to Reproduce Problem:
/*
These are simple defaults for your project.
*/


world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default

view = 6 // show up to 6 tiles outward from center (13x13 view)

// Make objects move 8 pixels per tick when walking

client

command_text = ".alt " // macro mode

mob

step_size = 8

verb/inventory()

usr << "You're not carrying anything, silly!"

verb/say(var/textToSay as text)

view() << "[name]:[textToSay]"
obj
step_size = 8

This .dms file works:
macro
i return "inventory"

This .dms file does not:
macro
1 return "inventory"

See actual results for the error message.

Expected Results:
.dms file that does not work would compile and work identically to .dms file that does.

Actual Results:
During compile, I get this error message:
loading MacroTest.dme
loading macrotest.dms
D:\Users\YourName\Documents\BYOND\My Games\MacroTest\macrotest.dms:2:error at '1': expected end of macro block
D:\Users\YourName\Documents\BYOND\My Games\MacroTest\macrotest.dms:2:error at '1': unexpected character

MacroTest.dmb - 0 errors, 0 warnings


Does the problem occur:
Every time? Or how often?
Every time.
In other games?
N/A
In other user accounts?
N/A
On other computers?
N/A

When does the problem NOT occur?
Unknown.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? (Visit http://www.byond.com/download/build to download old versions for testing.)

I am seeing old, old forum posts here with people having this problem (and other people failing to provide a solution),so I'm guessing it's bee around for awhile.

Workarounds:

You can use an interface, but this solution won't work if you want to use BYOND's default interface (e.g. for flash compatibility).

You can instruct your users to make their own macros in DreamDaemon (F1, client, macros) but this may create incompatibilities with other games.

There may be a working workaround, but I'm not sure what it is and neither Dream Maker F1 nor forum crawling seems to have produced the answer.
The old script files (.dms) are pretty much depreciated in favour of the new interfaces (.dmf).

You can set up macros in-game using winset() without having to make an interface.

Also, you can't begin variables or objects in DM with a number. Doing var/1 or obj/chocolate/7 will give you a compile error as well.
In response to LordAndrew
True enough, but I already mentioned why that workaround won't suit my needs.

Unless maybe flash compatibility works just fine with the interfaces?
Although this is no longer relevant because script files were depreciated, you could create macros for numbers and other special keys (like space) by using the set name option.

I can't even dig up an old project that used DMS files, but I believe it went like this:
macro
Inventory
set name = "1"
return "inventory"


Also, for the Flash client, I doubt they'll force you to use to the old DMS notation. So unless you were told otherwise by Tom/Lummox JR/Nadrew, I would assume it'll support the macro settings from interface files (or a special type of file will be created for this purpose).
DarkCampainger resolved issue (Not a bug)
I'm not sure if a bug in a deprecated feature is the same thing as not a bug, but close enough.

The important thing is that there's the answer I was looking for which many forum search attempts failed to find. We need to put this in the BYOND reference somewhere, even if this is considered a deprecated macro method.

From the sounds of things, I need to read up more on what's required to make a BYOND app Flash compatible. If Interface files are allowed, I've been tormenting myself for no reason.
In response to Geldonyetich
Well, I marked it as "Not a bug" because requiring identifiers to start with a letter is a limitation of the software. Plus, there's a system in place to work around it (set name), so it's a non-issue even if the syntax wasn't depreciated.
Fair enough. I do want to maintain that it's a legitimate issue that the references do not include the workaround. Can't expect your brain always to be about to pick, now can I?