Page 1 of 1

Sort out

Posted: Sun Sep 03, 2017 4:38 pm
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

Re: Sort out

Posted: Sun Sep 03, 2017 9:51 pm
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.

Re: Sort out

Posted: Sun Sep 03, 2017 10:09 pm
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 :)

Re: Sort out

Posted: Mon Sep 04, 2017 6:25 am
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?

Re: Sort out

Posted: Mon Sep 04, 2017 6:34 am
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.