Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Ryan Timothy B on Mon 05/09/2011 19:58:37

Title: Import Export of a Struct - Issues
Post by: Ryan Timothy B on Mon 05/09/2011 19:58:37
I was stealing an idea from Steve's Rope module. He has this public struct that he has in the header of a script. Looks exactly like this (just editing the redundant functions and changing the names):

Header script:

struct __Test
{
  import function whatever();
};
import __Test Test;


Script:

__Test Test;
export Test;

function __Test::whatever()
{
  player.Say("testing");
}


I have within a Room's AfterFadeIn:
Test.whatever(); 

I'm trying to make Test and its functions all public, but it seems to be throwing me an
Error: Unable to create local script: Runtime error: unresolved import 'Test'

What am I missing? It has zero problems compiling Steve's scripts, even after rebuilding all files (I was starting to think it was the new engine that was having issues), so what am I missing? I'm sure I did it exactly as he has it. I've even a search throughout the whole project in case I wasn't seeing any of his imports or exports.

I even tried moving around the import and exports, but have the same issue either way. I believe I have everything just like he has it. Or so it appears.
Title: Re: Import Export of a Struct - Issues
Post by: Khris on Mon 05/09/2011 21:46:32
I added a script to my default game and pasted the two blocks in there; it compiles flawlessly.

Do you have something else somewhere in the game also called "Test"?
Title: Re: Import Export of a Struct - Issues
Post by: Ryan Timothy B on Tue 06/09/2011 05:04:23
Nope. It's even a blank game just to see why it doesn't work.
I believe it only crashes when you call the function from within another script.