How many items of a given objtype

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

How many items of a given objtype

Post by Duttones »

It is possible to know how many items of a given objtype exists in a realm?
Yukiko
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

Post 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.
Duttones
Apprentice Poster
Posts: 54
Joined: Tue Mar 27, 2012 8:56 pm

Re: How many items of a given objtype

Post by Duttones »

Thanks for the answer Yukiko.

I was hoping that I will not need to look on item.txt.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: How many items of a given objtype

Post 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
User avatar
atreiu
Grandmaster Poster
Posts: 151
Joined: Mon May 24, 2010 1:08 pm
Location: Russia, Moscow

Re: How many items of a given objtype

Post 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
Post Reply