Page 1 of 1

How many items of a given objtype

Posted: Fri Nov 24, 2017 3:21 pm
by Duttones
It is possible to know how many items of a given objtype exists in a realm?

Re: How many items of a given objtype

Posted: Fri Nov 24, 2017 7:42 pm
by Yukiko
First there is no built in function that returns a an instant array of the objtypes in a realm. There are a couple of options that you can use. ListObjectsInBox and specify the X, Y, and Z possibilities in the realm you wish to search. This will return an array of all objects which you could search for the objtype. This method is slow. The other method is to read items.txt in the data folder for the objtype and realm member. This would probably be faster. Another reason to search the file rather than using the ListMultisInBox function is that searching the file will not slow your server down.

Keep in mind if you are searching on a running server with players logged in that while you are retrieving the list of items new items might be created. For example if you are looking for the objtype of plate mail legs some blacksmith might create more plate mail legs.

Re: How many items of a given objtype

Posted: Tue Nov 28, 2017 1:57 am
by Duttones
Thanks for the answer Yukiko.

I was hoping that I will not need to look on item.txt.

Re: How many items of a given objtype

Posted: Wed Nov 29, 2017 4:41 am
by DevGIB
We had something similar in the old Pol Hook dll that was around for zulu servers.
When the function would run it would literally lock up the whole shard. It wasn't used very often :P

Re: How many items of a given objtype

Posted: Sun Apr 08, 2018 7:17 am
by atreiu
Duttones wrote: Tue Nov 28, 2017 1:57 am Thanks for the answer Yukiko.

I was hoping that I will not need to look on item.txt.
same question. i didn't found easier way than item.txt. so just little parser