I'll check that out, your time is much appreciated.
I'm having another small'ish issue... this one is definitely due to my ignorance.
- Code: Select all
Inventory inv = maid.getInventory("cupboard");
items = maid.getItems(inv);
bags = new ArrayList<Inventory>();
seeds = new ArrayList<Item>();
for(Item item : items)
{
if(maid.getName(item) == "Seedbag")
{
bags.Add((Inventory)item); ////////this cannot cast, for obvious reasons
}
}
The above doesn't work. It gets the first bag of type Item and cannot cast it to Inventory, because it's type Item. I believe perhaps I could get its base type widget, then cast that to Inventory, but I'm unsure how to go about that or if it would work.
The goal is to look in a cupboard, get the seedbags, get the seeds inside all the seedbags, sort the array, do a loop that pulls out the highest quality seeds from those bags into my inventory based on free slots. The issue is that seedbags are weird, they are inventories inside an inventory, and the getInventory helper method I believe only searches open widgets on the UI. I should be able to programmatically get the sack inventory data without opening them, and move them out of the sacks that way... if not I can probably do it the hard way: get the cupboard, get the sacks, open the sacks, memorize all the seeds, open the sacks with the best seeds, remove them.