ID:2817610
 
(See the best response by LemonInTheDark.)
I'm getting this error:
testdir\test_a.dm:8:error: CURSOR_B: undefined var

testdir/test_a.dm
#define CURSOR 'misc.dmi'

client/verb
Test()
var/icon/a = CURSOR
world << a

var/icon/b = CURSOR_B
world << b


testdir/testdir_b/test_b.dm
#define CURSOR_B 'misc.dmi'

client/verb
Test2()
var/icon/a = CURSOR
world << a

var/icon/b = CURSOR_B
world << b


Seems like the define is not functioning when files are not in the same folder? Is there a way to make them work globally instead? Or am I just misunderstanding completely how they work?
Best response
Defines/macros are handled in a single pass. So you can only use one after it's been #define'd.

This order is typically alphabetic, but is always the order of #includes in the dme file.

The way at least my community handles this is having a folder called __DEFINES in the top level of the code bit of the project. Then you just put defines that are meant to be used globally like this in there, since __ will be ordered before anything else by default.

I'm not sure if there's a better way of going about it, but that's what I do.
In response to LemonInTheDark
Ahh, that makes a lot of sense. I suppose I will use that method from now on when I run into the issue. Thanks!