PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
ListRootItemsInContainer(container)

 
Post new topic   This topic is locked: you cannot edit posts or make replies.    PenUltima Online Forum Index -> Feature Suggestions
Display posts from previous:   

Author Message
Developer Silver



Joined: 05 Feb 2006
Posts: 58
Location: Italy

PostPosted: Thu Sep 14, 2006 3:22 pm    Post subject: ListRootItemsInContainer(container) Reply with quote

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

Even if this can done with a simple eScript function, POL core should certainly be much faster... especially if container has many items... Wink

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 355
Location: San Diego, California

PostPosted: Thu Sep 14, 2006 7:08 pm    Post subject: Reply with quote

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?

Author Message
Developer Silver



Joined: 05 Feb 2006
Posts: 58
Location: Italy

PostPosted: Thu Sep 14, 2006 7:38 pm    Post subject: Reply with quote

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... Smile

Author Message
MuadDib
POL Developer


Joined: 13 Feb 2006
Posts: 830
Location: Indiana, USA

PostPosted: Thu Sep 14, 2006 10:13 pm    Post subject: Reply with quote

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.

Author Message
Developer Silver



Joined: 05 Feb 2006
Posts: 58
Location: Italy

PostPosted: Fri Sep 15, 2006 5:22 am    Post subject: Reply with quote

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

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? Razz

I thought it was fast to implement... if not, never mind, I'll go on as usual and I'll post other suggestions Very Happy

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 355
Location: San Diego, California

PostPosted: Fri Sep 15, 2006 6:04 am    Post subject: Reply with quote

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: 355
Location: San Diego, California

PostPosted: Fri Sep 15, 2006 7:17 am    Post subject: Reply with quote

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.

Author Message
DeiviD



Joined: 19 Jun 2006
Posts: 79

PostPosted: Fri Sep 15, 2006 7:21 am    Post subject: Reply with quote

ignore locked wouldnt be bad too Wink

Author Message
Austin
POL Developer


Joined: 30 Jan 2006
Posts: 355
Location: San Diego, California

PostPosted: Fri Sep 15, 2006 7:23 am    Post subject: Reply with quote

That flag already exists.

Post new topic   This topic is locked: you cannot edit posts or make replies.    PenUltima Online Forum Index -> Feature Suggestions All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty