ID:1918099
 
Not a bug
BYOND Version:508
Operating System:Windows 10 64 bit
Web Browser:Chrome 44.0.2403.155
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:
The preprocessor does not process usage of defines if the define is defined in a file that gets processed LATER than the usage of said define.

Numbered Steps to Reproduce Problem:
Make 2 files, such as "A.dm" and "Z.dm"
Put the definition of a define in Z.dm
use said define in A.dm
DM will give a compilation error, stating undefined var on the usage of the define in A.dm

Code Snippet (if applicable) to Reproduce Problem:
File "A.dm":
/mob
name = TEST


File "Z.dm":
#define TEST "TEST"


Expected Results:
No compile errors, the usage of "TEST" will properly get handled.

Actual Results:
The preprocessor skips the usage of "TEST" in A.dm and as such a compilation error occurs.

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

When does the problem NOT occur?
Ensuring #define statements are in a place where they are at the top of the file tree.

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Untested

Workarounds:
Ensure #define statements are in a place where they are at the top of the file tree.
Defines don't work like variables, they don't get compiled the same way and can only be really used after the compiler is aware of them.

This isn't a bug, it's actually common in languages that use preprocessors. Just be glad DM handles file includes for you, in other languages you have to actually include files as you need them (the purpose of the dme).

Most programmers using pre-processors include them in a file that will always be at the top of the tree, that's just how they're done if you want to use them subsequently.
Nadrew resolved issue (Not a bug)
There's a somewhat useful feature of BYOND in that if you #include the same file multiple times, it will only actually get included once. If you have a file containing defines that you need earlier than the DME order, just #include that files at the top of the file you need it in and the defines will be available.
DM by default operates according to C's #pragma once directive. This is useful. The annoying part is that including things is alphabetical and you can't rearrange file inclusion order visually.