SA-MP Forums Archive
[Question] Splitting gamemode, found weird problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [Question] Splitting gamemode, found weird problem (/showthread.php?tid=439100)



[Question] Splitting gamemode, found weird problem - Proxyded - 23.05.2013

Hi there.

I've found this strange problem while I was trying to organize a gamemode that me and a friend were scripting by seperating it by files, such as placing the callbacks in each seperate file, like
Код:
#include "../src/Callbacks/OnPlayerSpawn.pwn"
and so on.

I also made a folder for definitions, such as macros, variables and others
For now I got these two files
Код:
#include "../src/Definitions/Macros/colors.pwn"
#include "../src/Definitions/Macros/general.pwn"
the file colors.pwn only has defined colors while general.pwn has all other defines such as dialogIDs, redifinition of max_players and such.

The problem being, the colors.pwn works perfectly fine, while general.pwn, even though the compiler knows that the file exists, it gives errors when compiling because of undefined stuff, which they exist in this file.

Even more strange, when I change that file to another place, such as
Код:
#include "../src/Definitions/general.pwn"
it works perfectly fine.

Has anyone ever happened a similar case? or even the same one?
Know any solutions or workarounds?

Thanks for reading and thanks in advance for any replies.


Re: [Question] Splitting gamemode, found weird problem - Pottus - 23.05.2013

Order matters with includes seems to be the problem here.


Re: [Question] Splitting gamemode, found weird problem - Proxyded - 23.05.2013

Weird, if I change
Код:
#include "../src/Definitions/Macros/colors.pwn"
#include "../src/Definitions/Macros/general.pwn"
to
Код:
#include "../src/Definitions/Macros/general.pwn"
#include "../src/Definitions/Macros/colors.pwn"
It says that the colors arent defined.

Why does this happen?


Re: [Question] Splitting gamemode, found weird problem - Proxyded - 24.05.2013

oh wow, I feel like an ignorant now. Thanks for pointing that one out.

But another issue that popped now:

in general.pwn, I had a define that was basically a macro of another file
Код:
#define BoughtCars_Dir "Vehicles\BoughtCars.txt"
And that shows me these kind of errors
Код:
error 027: invalid character constant
These dont show up if I use "/", why is that?

Plus, why on my first question, the first file worked correctly and the second one didnt?


Re: [Question] Splitting gamemode, found weird problem - Proxyded - 24.05.2013

I see, thanks for your help, I appreciate it.

Just one last thing, sorry for being persistent:

Why does it work with "/" on the string? (Atleast I think it's working, last I checked)


Re: [Question] Splitting gamemode, found weird problem - Vince - 24.05.2013

Huh? Forward slashes have always worked fine as directory separators. For me, at least.


Re: [Question] Splitting gamemode, found weird problem - Proxyded - 24.05.2013

Ok, thanks for all your replies. You can lock this thread if you wish.