Chucl

Member
ServUO Version
Publish Unknown
Ultima Expansion
None
I know how to look for items, but it looks whole backpack, is there a way to look for first level items? and avoid those inside containers? thanks
 
Depending on the method you are using to search for items, it should have a bool argument for "recursive".

FindItemsByType(type, false) for example.
 
One way I think is correct is to use the finditembytype and set the recurse boolean to false. Voxspire hit it while I was writing it.
 
If you are only looking for one time you can also use a boolean if statement.

C#:
if (from.Backpack.FindItemByType(typeof(Hides)false) == true)
{
    do things
}

If it is specific that uses say Hides as its base you might want to use

C#:
  var hidelist = from.Backpack.FindItemsByType<Hides>(false);
                foreach (Hides i in hidelist)
                {
                    do stuff 
                    if condition met u can leave with break;
                }

                hidelist.Clear();


At least that is how I would do it.
 

Active Shards

Donations

Total amount
$50.00
Goal
$1,000.00
Back