Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Trent R on Wed 12/11/2008 23:40:12

Title: unresolved import with struct [RESOLVED] (sorry for wasting space)
Post by: Trent R on Wed 12/11/2008 23:40:12
Found the answer at this thread (http://www.adventuregamestudio.co.uk/yabb/index.php?topic=23133.0), but it was titled "how to do "blah.blah" functions", which wasn't very descriptive.

~Trent




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

//module header

//enum StatEnum is declared here.

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

//..later on
MyStruct  Stat;


//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 (http://www.americangirlscouts.org/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
Title: Re: unresolved import with struct [RESOLVED] (sorry for wasting space)
Post by: Khris on Thu 13/11/2008 00:41:01
Just for reference, it's supposed to say
function MyStruct::Add(...)
Title: Re: unresolved import with struct [RESOLVED] (sorry for wasting space)
Post by: Trent R on Thu 13/11/2008 02:13:30
Quote from: KhrisMUC on Thu 13/11/2008 00:41:01
Just for reference, it's supposed to say
function MyStruct::Add(...)

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

~Trent