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
Novice Poster
Posts: 45
Joined: Tue Mar 27, 2012 8:56 pm

How many items of a given objtype

Post by Duttones » Fri Nov 24, 2017 3:21 pm

It is possible to know how many items of a given objtype exists in a realm?

Yukiko
Distro Developer
Posts: 2292
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: How many items of a given objtype

Post by Yukiko » Fri Nov 24, 2017 7:42 pm

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.
Sincerely,
Yukiko

I would tell you a UDP joke but you might not get it.

Titus 2:13

Duttones
Novice Poster
Posts: 45
Joined: Tue Mar 27, 2012 8:56 pm

Re: How many items of a given objtype

Post by Duttones » 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.

DevGIB
Grandmaster Poster
Posts: 164
Joined: Mon Feb 06, 2006 6:12 am

Re: How many items of a given objtype

Post by DevGIB » Wed Nov 29, 2017 4:41 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests