Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Bleckman1974 on Fri 07/04/2006 13:29:23

Title: Struct problem -- yes I read the manual and the Bfaq
Post by: Bleckman1974 on Fri 07/04/2006 13:29:23
ok, I searched and read the manual

I did what it said to do:

struct Weapon {
  int damage;
  int price;
  String name;
};
Weapon sword;
sword.damage = 10;
sword.price = 50;
sword.name = "Fine sword";

And then did the rest
why does it say unexepted "sword?"


Title: Re: Struct problem -- yes I read the manual and the Bfaq
Post by: Gilbert on Fri 07/04/2006 13:45:06
Assigning values to struct members MUST be within functions, so move the "sword.=*;" lines into a function to initialise teh values.
Title: Re: Struct problem -- yes I read the manual and the Bfaq
Post by: Bleckman1974 on Fri 07/04/2006 13:57:37
thanks it worked