SOLVED: How to import an int variable in the header file of a new module?

Started by LostTrainDude, Thu 01/09/2011 14:18:39

Previous topic - Next topic

LostTrainDude

Probably it's simplier than I imagine.
Anyway, I'm still a coding newcomer :)

I've created a new script. I've written variables and functions in the .asc file and imported them in the .ash file.
I've no problems at all with functions but I get an error message when trying to compile rows of code such as these:

Code: ags

import int x;
import int y;


The error message I get says: "Script link failed: Runtime error: unresolved import 'x'"

If it matters, in the script file (.asc), these variables has a value of 0:

Code: ags

int x = 0;
int y = 0;


Is there something I should do, that I didn't?
"We do not stop playing because we grow old, we grow old because we stop playing."

Gilbert

Functions don't need to be exported, but variables have to be, before they can be imported to other scripts.
Code: ags

int x = 0;
int y = 0;
export x, y;


LostTrainDude

Thanks a million, now works perfectly :)
And I confirm that it was simplier than I thought.

Thanks again!
"We do not stop playing because we grow old, we grow old because we stop playing."

SMF spam blocked by CleanTalk