ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: UOMaddog on September 22, 2011, 05:51:38 PM

Title: Finditem Ordering
Post by: UOMaddog on September 22, 2011, 05:51:38 PM
So I had a curious question. If I have a open bag with 100 items in it and I do finditem * C with it, it will find 100 items and they will all be in the #findindex from 1 through 100. Now, if I run the same finditem again, will every item be "found" in the exact same order or does it vary randomly???
Title: Re: Finditem Ordering
Post by: camotbik on September 22, 2011, 06:08:02 PM
why not just test it out?
Code: [Select]
menu Clear
menu Window Title TEST
menu Window Color BtnFace
menu Window Size 422 563
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Font BGColor Window
menu List Create EUOListBox1 0 0 209 573
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu List Create EUOListBox2 212 0 209 573
menu Show 421 270
finditem * C_ , #backpackid
for #findindex 1 #findcnt
{
  menu List Add EUOListBox1 #findid
}
finditem * C_ , #backpackid
for #findindex 1 #findcnt
{
  menu List Add EUOListBox2 #findid
}
halt


Seems exactly the same.
Title: Re: Finditem Ordering
Post by: Endless Night on September 22, 2011, 06:17:08 PM
i believe they are indexed in item id order...  so if you swapped one item out the index would change.
Title: Re: Finditem Ordering
Post by: UOMaddog on September 22, 2011, 09:20:29 PM
i believe they are indexed in item id order...  so if you swapped one item out the index would change.


You mean like alphabetical order by their id?

(Sorry I couldn't test this, I was at work and just had a thought and was curious of the answer. Also, even with a few tests, I wasn't sure if it was guaranteed every time)
Title: Re: Finditem Ordering
Post by: Neo on September 23, 2011, 03:11:37 AM
Well, I gave it a few tests here...



At first glance, I figured they were indexed by #findid, in inverse alphabetical order, if you read the id from right to left.

Then I found some exceptions.

Then I ran it for G_15 and found no logic behind the order whatsoever...

So, I really can't see a pattern here... If anyone can, please enlighten me! :)

neo



Title: Re: Finditem Ordering
Post by: Cerveza on September 23, 2011, 04:02:02 AM
In the order moved with the first identified item being the last one moved.

Maybe lol...

I'm pretty sure I played with this for like 10 minutes before. If you have 20 bandages in your pack unstacked, and move them one at a time into a container, then do a find for bandage, they will show up with the last one moved being the first one found.

I got bored with it and never revisited it, until this very post :P
Title: Re: Finditem Ordering
Post by: Crome969 on September 23, 2011, 06:59:00 AM
In the order moved with the first identified item being the last one moved.

Maybe lol...

I'm pretty sure I played with this for like 10 minutes before. If you have 20 bandages in your pack unstacked, and move them one at a time into a container, then do a find for bandage, they will show up with the last one moved being the first one found.

I got bored with it and never revisited it, until this very post :P
You are right!
I had these tests some years ago,too and it seems like the order comes up as the Datastream goes to client.
Example:
ID 1 -10 are in Bag a
now you Scan Bag a and getting an Index with an Order 1-10
then you move 2,3,7,5,4,1,6,8,9,10 in this queue to Bag b
doing Scanitems will give you exactly this Order!
Title: Re: Finditem Ordering
Post by: Cerveza on September 23, 2011, 07:32:27 AM
Yeah! What do I win?
Title: Re: Finditem Ordering
Post by: Endless Night on September 23, 2011, 07:40:46 AM
Yeah! What do I win?

A Hacksimus Extremus title   ;) :D ;D
Title: Re: Finditem Ordering
Post by: Crome969 on September 23, 2011, 08:36:03 AM
Yeah! What do I win?
I will Honor you until my end of life as the Administrator of this Site and praise your insane knowlegde about Easyuo ;D
Title: Re: Finditem Ordering
Post by: Cerveza on September 23, 2011, 08:39:52 AM
Yeah! What do I win?
I will Honor you until my end of life as the Administrator of this Site and praise your insane knowlegde about Easyuo ;D
I'll take it!
Title: Re: Finditem Ordering
Post by: NObama on September 23, 2011, 07:48:21 PM
The question is....how is it useful?  Perhaps for scanning your bag for drops, if scanjournal isn't an option?
Title: Re: Finditem Ordering
Post by: Crome969 on September 24, 2011, 12:38:26 PM
The question is....how is it useful?  Perhaps for scanning your bag for drops, if scanjournal isn't an option?
When u scan a Container or Ground, and want change the queue start from last not from first. So you have the option to say with your code how you want to use it. The Main Author asked for the ordering