function FaceDirection(int ch, int d) {
if (d == F_UP){ //line number 21
FaceLocation(ch, character[ch].x, character[ch].y-10);
}
else if (d == F_LEFT){
FaceLocation(ch, character[ch].x - 10, character[ch].y);
}
else if (d == F_DOWN){
FaceLocation(ch, character[ch].x, character[ch].y+10);
}
else if (d == F_RIGHT){
FaceLocation(ch, character[ch].x + 10, character[ch].y);
}
}
all the F_ vars are defined in the header
#define F_UP 0;
#define F_LEFT 1;
#define F_DOWN 2;
#define F_RIGHT 3;
//import function FaceDirection(int ch, int d);
I tried to use the import in the script header but it didnt work so i commented it out. Anyway...
When I try to save it I get the following error:
Error (Line 21) : Parse Error in expr near '0'
my brain isnt working or something...
Thanks,
Well I changed all the uses of F_(direction) with the actual numbers and it worked fine... So I'm thinking there is something wrong with #define... can anyone shed some light on that?
NM I just changed the #defines in the header to int so they have actual int values, it all works properly now
Just a little change:
#define F_UP 0
#define F_LEFT 1
#define F_DOWN 2
#define F_RIGHT 3
And it works... I did the same mistake a while ago...
QuoteImports, erros, and suff
Hehe, "suff" is german for booze ;D
Quoteall the F_ vars are defined in the header
#define F_UP 0
#define F_LEFT 1
#define F_DOWN 2
#define F_RIGHT 3
Just a quick (unrelated) question: Are all defines supposed to go in the script header? I am not sure where to place them exactly.
Just in case our readers missed the change that TK made... don't use ";" at the end of a #define...
to answer stazer's question:
You can put #defines anywhere, but if they are anywhere other than the header then they won't apply everywhere. For example, if they are in the global script they only apply to the global script and not to room scripts.
If the #define is only relevant to one room, however, (e.g. object numbers) then feel free to put the #define in that room's script.
I have edited my post to avoid confusion.
And SSH, thanks for the clarification!