I know this is a common question, but I still can't quite get my head around how the solutions offered would apply to my specific case.
I have two structs and two arrays.
struct CrewVariables{
int floor;
int health;
String name;
};
struct BadguyVariables{
int Distance;
int HP;
String name;
};
BadguyVariables Enemy[10];
CrewVariables Crew[6];
They were working fine as a general definition in GlobalScript.asc, but now I need to move that information between the GlobalScript.ash and Room 1, so I've moved the structs now to the GlobalScript.ash header instead, and kept the arrays in the .asc. What do I put in the general definitions of the .asc and Room 1 in order to move all this information around?
In your header, use import lines:
import BadguyVariables Enemy[10];
import CrewVariables Crew[6];
In your main script, declare and export the variables:
BadguyVariables Enemy[10];
CrewVariables Crew[6];
export Enemy, Crew;
If you only need them in Room 1, you can import them there instead (the header is put on top of every room script).
Got it. Thanks again!
Sorry this is an old one..
I cannot get this method to work though, i get the error:
Failed to save room room1.crm; details below
GlobalScript.ash(6): Error (line 6): expected variable or function after import, not 'GridAttribute'
In my GlobalScript:
struct GridAttribute
{
bool walking;
bool swimming;
int resource1;
int resource2;
int resourceQuantity1;
int resourceQuantity2;
};
GridAttribute gridspot[200];
export gridspot;
And in my header:
import GridAttribute gridspot[200];
Thanks
EDIT:
I did some searching the beginners forum.. I should have:
In my GlobalScript:
GridAttribute gridspot[200];
export gridspot;
And in my header:
struct GridAttribute
{
bool walking;
bool swimming;
int resource1;
int resource2;
int resourceQuantity1;
int resourceQuantity2;
};
import GridAttribute gridspot[200];
Sorry about that, maybe this will help the next AGS'r...