ListRootItemsInContainer(container)

Archive of the older Feature Request Forum Posts

Moderator: POL Developer

Locked
Developer Silver
Apprentice Poster
Posts: 58
Joined: Sun Feb 05, 2006 1:34 pm

ListRootItemsInContainer(container)

Post by Developer Silver »

We think this could be usefull... or at least fast :P
A function to obtain items (array of UObject) placed directly in the container passed as parameter... like EnumerateItemsInContainer() without sub-container items :D

Even if this can done with a simple eScript function, POL core should certainly be much faster... especially if container has many items... ;)
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

Script it. Not everything is going to be put in the core.

Even though you most likely already know how to do it... for others and future requests:

Code: Select all


function ListRootItemsInContainer(container)
     var item_list := array;
     foreach item in ( EnumerateItemsInContainer(container)
          if ( item.container == container )
               item_list.Append(item);
          endif
          SleepMs(2);
     endforeach
     
     return item_list;
endfunction

Im going to coin the new term:

'Scriptaphobe' -A fear of scripting because everything (even 1+1) takes up too many cycles.

If everything was desired to be hardcoded into the executable for speed, wouldn't UOX still be on top?
Developer Silver
Apprentice Poster
Posts: 58
Joined: Sun Feb 05, 2006 1:34 pm

Post by Developer Silver »

No problem... we have that function from years, but I've seen that cycling through many many items in a container can slow things down, and I was thinking that reducing number of analyzed items could help system performance...
Never mind... :)
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

Firstly, unless it's just skeery as hell, containers usually have set max items to 125. By skeery, i mean, you make it something like 1234823402342 max items (GOD HELP ME).

And a search, with a sleepms(2) should go very fast anyway.
Developer Silver
Apprentice Poster
Posts: 58
Joined: Sun Feb 05, 2006 1:34 pm

Post by Developer Silver »

Even if max items is 125, a container with many subcontainers, with many subcontainers, ... results in a large array, no? :?

Anyway... just one last thing...

No new function, but what about adding a flag to EnumerateItemsInContainer()?
As ENUMERATE_IGNORE_LOCKED, something like ENUMERATE_IGNORE_SUBCONTAINERS...
Useless like above suggestion? :P

I thought it was fast to implement... if not, never mind, I'll go on as usual and I'll post other suggestions :D
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

Its still recursive... so if you have a container in a container, and insert something lower, it still counts towards the top... so you never go over the max item amount.

Example using MuadDib's standard backpack layout
The parenthesis shows its item count.

Code: Select all

  *BACK PACK* (6)
      *BAG* (5)
         *LOCKED STRONGBOX* (4)
            - Thong panties
            - Underwire bra
            - Wild Turkey bottle
            - Book titled "Lipstick on Sheep"
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

A flag for just that container could be fair..
ENUMERATE_ROOT_ONLY

The POLitburo will put your request into the queue and process it when the resources to do-so are available.
DeiviD
Expert Poster
Posts: 79
Joined: Mon Jun 19, 2006 4:48 pm

Post by DeiviD »

ignore locked wouldnt be bad too ;)
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

That flag already exists.
Locked