Error: Size of identifier does not match prototype (SOLVED)

Started by Nine Toes, Wed 19/07/2006 12:58:24

Previous topic - Next topic

Nine Toes

Time for another one of my stupid questions... I wrote this simple struct in the very top of the global script.  The asterisk is the line where I get the error.

Code: ags

struct Attributes {
  int health;
  int mana;
  int fatigue;
}

Attributes character[1];

Attributes enemy[10];

// main global script file...
...
...
...
... // called when the game starts, before the first room is loaded
character[EGO].health = 100;
character[EGO].mana = 100;
character[EGO].fatigue = 0;
...


This whole script was just for a small RPG-type game.

I'll be perfectly honest, I don't know what the hell I'm doing.  :P  An hour ago, I didn't even know what structs and arrays were.  I read up on them in the manual, and they seemed to make sense, but I don't understand why I'm getting this error.

If somebody could explain to me what exactly I'm doing, or rather what I should be doing, I'll kiss your feet and call you master.  :-*
Watch, I just killed this topic...

strazer

  int fatigue;
};

Aside from that, "character" is a reserved keyword, you will have to rename the array (characters would suffice).

Nine Toes

#2
Cool.  Thank you, Master.  :-*

EDIT: ...yeah, sorry.  Thanks again.

I started picking out my mistakes right after I posted.  (Why is it that I finally spot them only AFTER?...)
Watch, I just killed this topic...

Alynn

Bah Strazer beat me to it... but let me just say it again because I don't want to waste the time I spent typing this post....

Code: ags
struct Attributes {
 Ã, int health;
 Ã, int mana;
 Ã, int fatigue;
}[b];[/b]


And yes, you can't use character for the reasons Strazer mentioned :)

EDIT and hyde replied by the time I got this off... I'm slow today :/

strazer

You're welcome. :)

Btw, if you want to use your stuff outside the global script (i.e. in room scripts), you will have to export/import the arrays into the script header. See this post for examples.

SMF spam blocked by CleanTalk