Import Export of a Struct - Issues

Started by Ryan Timothy B, Mon 05/09/2011 19:58:37

Previous topic - Next topic

Ryan Timothy B

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:
Code: ags

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


Script:
Code: ags

__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.

Khris

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"?

Ryan Timothy B

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.

SMF spam blocked by CleanTalk