FindSubstance array

Report core bugs regarding the Ultima Online Emulator Core release (version 097). You can attach your Core Dump. One bug per post.

Moderator: POL Developer

Locked
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm
Contact:

FindSubstance array

Post by OldnGrey » Sat Aug 02, 2008 5:25 am

When I use FindSubstance, a successful return array always has just one itemref in it.

From my reading of the documentation, shouldn't it be returning an array of all found itemrefs in the container that equals or exceeds the amount you specify. Or is that just my wrong reading of it? I don't see why it would be returning an array if it stops looking after it finds the first match.

User avatar
CWO
POL Expert
Posts: 1136
Joined: Sat Feb 04, 2006 5:49 pm
Location: Chicago, IL USA
Contact:

Post by CWO » Sat Aug 02, 2008 6:57 am

I think it fills the array until it at least satisfies the amount you want. Like what if you want an item that doesn't stack but you want 5 of them. The array should now have 5 elements if the container has all 5 items in it.

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm
Contact:

Post by OldnGrey » Sat Aug 02, 2008 6:04 pm

That's a nuisance - it would be so handy to let the script choose which one from an array of matches. I hate to use EnumerateItemsInContainer but it seems I will have to do it to get what I need.

User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn » Sun Aug 03, 2008 1:11 am

OldnGrey, why would you need it? I'm just curious, I don't have a polished solution to offer.

User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm
Contact:

Post by OldnGrey » Sun Aug 03, 2008 5:00 am

Sometimes my ingredients in crafting are non-stackable items that can have cprops or colours depending on their use in the game. I don't want to use an ingredient in crafting if it is marked for some other use.

FindSubstance has no way to find a match except by starting container, objtype and amount.

If I'd known of the a while ago I would have coded items differently!

Locked