Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Monsieur OUXX on Wed 28/04/2010 19:10:14

Title: "while" won't want to obey (SOLVED) (I'm with stoopid)
Post by: Monsieur OUXX on Wed 28/04/2010 19:10:14
OK, I've got this code :


     #define RED 55
     #define AGSH_RBNode_Parent 0+
     #define AGSH_RBNode_Color  3+
     #define TO_LOCAL -
     #define SEGADDR_INT  33

     int memInt[100];

     int debug2 = memInt[AGSH_RBNode_Parent(z  TO_LOCAL SEGADDR_INT)];
     int debug3 = memInt[AGSH_RBNode_Color(debug2)];                  
     while ( debug3 == RED) {
          ...
     }



When I complie, I get error "Parse error in expr near '55'", for the line containing while (...

I just don't get why.


Here is a clearer picture of what the code looks like after the pre-processor has replaced the macros :

     int memInt[100];

     int debug2 = memInt[0+(z  - 33)];
     int debug3 = memInt[3+(debug2)];                  
     while ( debug3 == 55) {
          ...
     }



I'm confused.  ???
Could it be a bracket or similar missing somewhere else in the code?
Title: Re: "while" won't want to obey
Post by: Dualnames on Wed 28/04/2010 19:26:11

      #define RED 55
      #define AGSH_RBNode_Parent 0+
      #define AGSH_RBNode_Color  3+
      #define TO_LOCAL -
      #define SEGADDR_INT  33

      int memInt[100];
      int debug2, debug3;

       function game_start() {        
   debug2 = memInt[AGSH_RBNode_Parent(z  TO_LOCAL SEGADDR_INT)];
 debug3; = memInt[AGSH_RBNode_Color(debug2)];
           while ( debug3 == RED) {
              ...
          }
     }
Title: Re: "while" won't want to obey
Post by: Monsieur OUXX on Wed 28/04/2010 19:32:02
I don't get it. What's your point here?

In case you believe I forgot to include this code in a function body, then, no, I'm not so stupid.
It's a truncated version of the code, to explain my issue.

I've already written several thousands of lines of codes in the AGS script before :)
Title: Re: "while" won't want to obey
Post by: Monsieur OUXX on Wed 28/04/2010 19:36:53
DAMMIT!

I found the issue.

My macro declaration was actually :

#define RED 55;


STOOPID!

Thanks for putting time into this, dualnames.
Title: Re: "while" won't want to obey
Post by: Dualnames on Wed 28/04/2010 19:53:32
Quote from: Monsieur OUXX on Wed 28/04/2010 19:36:53
DAMMIT!

I found the issue.

My macro declaration was actually :

#define RED 55;


STOOPID!

Thanks for putting time into this, dualnames.


Does the I'm with stoopid goes for me? :o

I usually kind of mess the declaration of variables, and I know your scripting is ACE. You even had an AGS benchmark for strings and integers, so it goes without saying.

EDIT: I was only getting dramatic. Glad you solved this on your own. :D
Title: Re: "while" won't want to obey
Post by: Monsieur OUXX on Wed 28/04/2010 19:57:10
Quote from: Dualnames on Wed 28/04/2010 19:53:32
Does the I'm with stoopid goes for me? :o

Of course not! It goes for me!!!!
You didn't have any way to guess that I actually didn't copy-paste my #define statement properly!!!

Sorry if it was confusing :)
Title: Re: "while" won't want to obey (SOLVED) (I'm with stoopid)
Post by: Kweepa on Thu 29/04/2010 01:26:43
Implementing a red-black tree in AGS?
Crazy!