Home | AGI Documentation | AGI Tutorials | AGI Tools | AGI Wiki | Community

Multiple Inventory Items

So, anyway, in Voodoo Girl, I decided to give the player the ability to carry around more than one of each particular item. But how to do so?! I wracked my brain, stayed up all night, and pulled my hair out. Eventually, I just turned on my computer and typed in some code. Hmm, guess I should have tried that first.

Anyway, first I added the name of my item as a variable in defines.txt.

#define moss v60

Then I created a new logic that is called from Logic.000 at the end of every cycle.


In the body of this new logic I wrote a little something like this:

#include defines.txt
    if (moss > 0 && !has("moss"))

    if (moss == 0 && has("moss"))

Last, and certainly least, to add a nice touch, I altered the description of my inventory in the view editor:

You have %v60 pieces of moss.

Yes, indeed, just prefix the variable with % to have it print out with your show.obj() description or to embed it in a string (i.e. print("You have %60 pieces of moss");).

Happy coding!

by helping to defray some of the costs of hosting this site. If it has been of help to you, please consider contributing to help keep it online.
Thank you.

© 2013 to present The Sierra Help Pages. All rights reserved. All Sierra games, artwork and music © Sierra.