Choosing inventory items with an array [Solved - sorry :P ]

Started by ThreeOhFour, Sat 21/05/2011 05:41:48

Previous topic - Next topic

ThreeOhFour

Hello  ;D

In a flash of brilliantly inspired bad game design, I'd like to force users to look at their items before they're allowed to use them. I decided I could do this with a simple boolean flag of identified (there may be an easier way, but I only have 7 items :P ) but I am having a little bit of trouble getting it to work.

What I'd like to do is have a global array like idItem[7]; and use it to check which item I am using and whether it has been identified with something like:

Code: ags

function ItemCheck()
{
  if (idItem[player.ActiveInventory.ID] == true)
  {
    Identified = true;
  }
  else Identified = false;
}


Sadly, when I have this script in my game, I get a strange error stating "Unresolved import" without telling me a specific line. Commenting this line out allows me to run the game without getting the error, so I am certain it is this bit.

I've checked the import script in the script header follows the import bool idItem[7]; formatting, so I'd really love some help to show me what I am doing wrong.

Cheers!

Edit: Ok, so after posting this I thought "Hang on, why do I have the ItemCheck in the room script, shifted it to the global script and imported that instead of the idItem array and now of course it works fine. Sorry for wasting your time  :=

SMF spam blocked by CleanTalk