Iterating through all items in inventory

Turias

New member
Hello! I have been searching through the forums and the documentation and I haven't been able to find anything about this, so I apologize if I missed it.

Basically, I am hoping to write an ASH script that iterates through all of the items in my inventory and then conditionally runs code depending on what it finds. I would like to be able to do this without explicitly listing all items that I would ever like to act upon. For example, I would rather not be forced to edit my script every time new items are added to the game.

Is there any way to do this? The only thing I can think of is something like the following (pseudo C-style code):

Code:
for (int i = 1; i <= MAX_ITEM_ID; i++)
{
    myItem = int_to_item(i);
    count = item_amount(myItem);
    if (count >= 1)
    {
        ....
    }
}

However, this doesn't seem very efficient. Is there a better way to do this? Any help would be greatly appreciated.
 

macman104

Member
That is sort of what Turias didn't want to do I gather. Turias, as far as I know, there is no way to grab an actual list/array/map type object that holds all of your items. The only way I can think would be iterating through the loop of item id's like you mentioned. That, or write something to parse your various item pages...
 
Top