How many items of a given objtype
Moderator: POL Developer
How many items of a given objtype
It is possible to know how many items of a given objtype exists in a realm?
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: How many items of a given objtype
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.
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
Thanks for the answer Yukiko.
I was hoping that I will not need to look on item.txt.
I was hoping that I will not need to look on item.txt.
Re: How many items of a given objtype
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
When the function would run it would literally lock up the whole shard. It wasn't used very often