Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ishmael on Sat 06/12/2003 20:31:08

Title: My #define's gone broken??
Post by: Ishmael on Sat 06/12/2003 20:31:08
Version 2.55

I had some defines in the script header:

#define DIALOG 1;
#define LIST 2;
#define OK 3;
#define CANCEL 4;

[Using modified BlueGUI save/load scripts, credit to Rick]

and the functions have if's:

...
if (state == DIALOG) {
blah blah balh...
}
if (state == LIST) {
blah blah blah...
}

etc.

When I tried to complile, it game me error:

... Problem in "Main Script"
(Line blah) Error in expr near '1'
etc.

I changed the "DIALOG" in the if to "1", and the script was compliled.

I had call for the fucntion in interface_click:

if (button == 2) {
Load(DIALOG);
}

It gave the same error on the Load()-call line.

I changed the "DIALOG" to "1", and it worked aswel. The same for all #defined using functions. I can't use the #defines! Argh!

And, the same comes up with v2.56d. Are my game files somehow corrupted, or what is it? I'd like to know if someone knows this problem or even knows how to fix it.
Title: Re:My #define's gone broken??
Post by: Scorpiorus on Sat 06/12/2003 20:49:59
Hey, TK the define directive works the way that it just replace the macro identifier with appropriate string, so:

#define DIALOG 1;

turns out into:

if (button == 2) {
Load(1;); // originally was Load(DIALOG);
}

~Cheers

Title: Re:My #define's gone broken??
Post by: After on Sun 07/12/2003 01:55:11
That goes for the whole line, so don't put a comment on the same line either.
Title: Re:My #define's gone broken??
Post by: Ishmael on Sun 07/12/2003 09:33:55
Dammit! Ok... thanks...
Title: Re:My #define's gone broken??
Post by: Kweepa on Sun 07/12/2003 12:42:07
Also, watch out for tabs between #define and the symbol. Use spaces instead.
Title: Re:My #define's gone broken??
Post by: Ishmael on Sun 07/12/2003 13:46:08
My tabs with MRC room names worked just fine...
Title: Re:My #define's gone broken??
Post by: After on Sun 07/12/2003 19:50:37
Quote from: SteveMcCrea on Sun 07/12/2003 12:42:07
Also, watch out for tabs between #define and the symbol. Use spaces instead.
Same between symbol and definition. Use spaces if you want them nicely aligned.