I've tried
#define Fireball "/obj/Fireball"
Is this possible to set a word to a path or not? Should I just use variables that are defined at world start up?
ID:152686
Jan 29 2006, 2:25 pm
|
|
Well I've been curious as to how #define works. Can someone explain it a little bit? I've seen some of how to use it around on the forums. I still don't get it,
I've tried
#define Fireball "/obj/Fireball"
Is this possible to set a word to a path or not? Should I just use variables that are defined at world start up? |
When you compile your code, any instances of the defined word get replaced with what it is defined as. So:
#define MESSAGE "Hello, world" Compiles the same way as: mob/Login() You can define something as anything, so:
#define TEST alfaslgjalgjaljgalgj
would compile, but if you actually USED the TEST define, you'd probably get interesting syntax errors. |
In response to Jp
|
|
Ah..
I'll do some testing =) |
In response to Joseph Constantine
|
|
Wow. Thanks everyone. this will really help in compacting my code. >=D
ok wait. xD I've got #define FireLO "/obj/Attack/Missile/Fire/FireBall" It gives me a error: undefined variable. |
In response to Mechanios
|
|
If you are defining a type path, you REALLY shouldn't be using quotation marks around it. But, when you define something it isn't a variable. You simply type it what you defined it as.
#define FireLO /obj/Attack/Missile/Fire/FireBall |
For example:
Gurus correct me if I'm wrong.