unresolved import with struct [RESOLVED] (sorry for wasting space)

Started by Trent R, Wed 12/11/2008 23:40:12

Previous topic - Next topic

Trent R

Found the answer at this thread, but it was titled "how to do "blah.blah" functions", which wasn't very descriptive.

~Trent




Code: ags
---------------------------
Adventure Game Studio
---------------------------
Script link failed: Runtime error: unresolved import 'MyStruct::Add^2'

---------------------------
OK   
---------------------------



I'm currently trying to organize my code, so I decided to write a module to contain my variables and functions. I get the error above when I try to run my game (no compile errors) and I have no idea what to do. My code:

Code: ags
//module header

//enum StatEnum is declared here.

struct MyStruct {
  import function Add(StatEnum param, int toAdd);
};

//..later on
MyStruct  Stat;


Code: ags
//module script

function Add (StatEnum param, int toAdd) {
  if (param == eStr)         { Stat_Strength += toAdd;     }
  else if (param == eInt)    { Stat_Intelligence += toAdd; }
  else if (param == eAgi)    { Stat_Agility += toAdd;      }
//etc
}



I read the AGSwiki Module programming guidelines a little bit, but most of it is if you're publishing a module. Basically I just want to be able to access Stat.Add and other functions (and other structs).

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

Khris

Just for reference, it's supposed to say
Code: ags
function MyStruct::Add(...)

Trent R

Quote from: KhrisMUC on Thu 13/11/2008 00:41:01
Just for reference, it's supposed to say
Code: ags
function MyStruct::Add(...)


Yeah, that's what I figured out. Now on to the next problem.

~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

SMF spam blocked by CleanTalk