Posted: Thu Sep 14, 2006 3:22 pm Post subject: ListRootItemsInContainer(container)
We think this could be usefull... or at least fast
A function to obtain items (array of UObject) placed directly in the container passed as parameter... like EnumerateItemsInContainer() without sub-container items
Even if this can done with a simple eScript function, POL core should certainly be much faster... especially if container has many items...
Author
Message
Austin POL Developer
Joined: 30 Jan 2006 Posts: 354 Location: San Diego, California
Posted: Thu Sep 14, 2006 7:08 pm Post subject:
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:
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?
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...
Author
Message
MuadDib POL Developer
Joined: 13 Feb 2006 Posts: 830 Location: Indiana, USA
Posted: Thu Sep 14, 2006 10:13 pm Post subject:
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.
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?
I thought it was fast to implement... if not, never mind, I'll go on as usual and I'll post other suggestions
Author
Message
Austin POL Developer
Joined: 30 Jan 2006 Posts: 354 Location: San Diego, California
Posted: Fri Sep 15, 2006 6:04 am Post subject:
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:
*BACK PACK* (6)
*BAG* (5)
*LOCKED STRONGBOX* (4)
- Thong panties
- Underwire bra
- Wild Turkey bottle
- Book titled "Lipstick on Sheep"
Author
Message
Austin POL Developer
Joined: 30 Jan 2006 Posts: 354 Location: San Diego, California
Posted: Fri Sep 15, 2006 7:17 am Post subject:
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.