Sort out

Bug reports and feature requests. New features can only be added to the current development version. Bug-fixes may be back-ported.

Current release: 099 / Current development: 100
Post Reply
Alwir
New User
Posts: 27
Joined: Sat Aug 26, 2017 2:50 am

Sort out

Post by Alwir »

Hi there
It's me again, and I want strange things :D

Sometimes I need to sort out all mobs or all items. I know how I can do it.

I can take ListMobilesInBox or ListObjectsInBox and have gotten very very big array. But it is without items in storages! And I have to do it some times for different realms.

Or I can do it in cycle
for (i:=0;i:=endSerialNumber;i++)
var item:=SystemFindObjectBySerial(i);
endfor

But it's very heavy solutions :(

I know we have "magic word" in foreach

Code: Select all

foreach val in something
  var numberOfIteration:=_val_iter;
endforeach
Can you add some new magic words for "foreach"?
I mean something like "_world_items" and "_world_mobiles" and "_world_objects"

and the iteration doesn't return me the big array but I can have access to the objects

Code: Select all

foreach object in _world_objects
 if (object.isa(POLCLASS_MOBILE))
//do nothing
 endif
endforeach
Thanks to advance
Yukiko
Distro Developer
Posts: 2825
Joined: Thu Feb 02, 2006 1:41 pm
Location: San Antonio, Texas
Contact:

Re: Sort out

Post by Yukiko »

These are useful suggestions. If they can be done.

As someone who has very little knowledge of the Core internal operation they look pretty easy to implement :D

They might still cause server heavy processor use though, but it most certainly would be less than if you programmed them in eScript.
DevGIB
Grandmaster Poster
Posts: 248
Joined: Mon Feb 06, 2006 6:12 am

Re: Sort out

Post by DevGIB »

I guess i'd need to know why you want to search for those things or what you're looking to achieve so i could make a recommendation.

In an old version of POLHOOK we had an item searcher and it was super heavy on resources and would lock the whole shard up trying to find things. Was a horrible idea, and never really got used.

You should join Discord from the Chat page and we might be able to get an understanding of what you're looking for and help you :)
Turley
POL Developer
Posts: 670
Joined: Sun Feb 05, 2006 4:45 am

Re: Sort out

Post by Turley »

This is possible with a loop over all realms and listitemsinbox plus an iteration over the storage area.
My opinion is that shouldn't be made easier via a core function, since this will produce a heavy load on you server till all objects gets modified/iterated. So only do this with very specific reasons.
If I were you I would question why you need this, what is the usecase?
Alwir
New User
Posts: 27
Joined: Sat Aug 26, 2017 2:50 am

Re: Sort out

Post by Alwir »

Hi Turley.
We have interesting discussion in discord about this.

If you want I can repost all. I don't know how be right.
Post Reply