PenUltima Online

It is currently Fri Oct 10, 2008 11:15 am

All times are UTC - 8 hours




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: ListRootItemsInContainer(container)
PostPosted: Thu Sep 14, 2006 11:22 am 
Offline
User avatar

Joined: Sun Feb 05, 2006 1:34 pm
Posts: 58
Location: Italy
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... ;)

_________________
Developer Silver
Faerun's Legends scripter
http://www.faerunslegends.it/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 3:08 pm 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 420
Location: San Diego, California
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?

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 3:38 pm 
Offline
User avatar

Joined: Sun Feb 05, 2006 1:34 pm
Posts: 58
Location: Italy
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... :)

_________________
Developer Silver
Faerun's Legends scripter
http://www.faerunslegends.it/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 6:13 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 836
Location: Indiana, USA
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.

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 1:22 am 
Offline
User avatar

Joined: Sun Feb 05, 2006 1:34 pm
Posts: 58
Location: Italy
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

_________________
Developer Silver
Faerun's Legends scripter
http://www.faerunslegends.it/


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 2:04 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 420
Location: San Diego, California
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"

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 3:17 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 420
Location: San Diego, California
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.

_________________
-Austin


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 3:21 am 
Offline

Joined: Mon Jun 19, 2006 4:48 pm
Posts: 79
ignore locked wouldnt be bad too ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 3:23 am 
Offline
POL Developer
User avatar

Joined: Wed Jan 25, 2006 2:30 am
Posts: 420
Location: San Diego, California
That flag already exists.

_________________
-Austin


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: Google [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl