Code:
Problem description:
Basically i would like to compare an name to current names in the list and if there is more then one of the same name...remove leaving 1 and then adding it as a stack.
like say
Name
Name
would be
Name x2
any help would be appreciated.
ID:1157595
Feb 11 2013, 4:09 pm
|
|
Feb 11 2013, 4:33 pm
|
|
list.Find() and some loops could do just fine
|
In response to Metamorphman
|
|
Metamorphman wrote:
list.Find() and some loops could do just fine could you give me an example :( my mind is just blank atm...can't think lol :/ |
Read up on what list.Find() does, and its arguments. You can loop through items in the list, use another loop with list.Find to check for duplicates of the item past its index in the list, then do what you will.
|
In response to Metamorphman
|
|
Metamorphman wrote:
Read up on what list.Find() does, and its arguments. You can loop through items in the list, use another loop with list.Find to check for duplicates of the item past its index in the list, then do what you will. I know what it does im just confused on how i would compare multiple variables in a list and remove it if there is more than 1 and then stack it. |
Galactic Soldier wrote:
._. proc/stackList(array[]) That's all you really need. To access how many are in the stack you do .[type] or whatever. It's an associative list. mob/Login() Doesn't work for my case really for example i am trying to compare multiple objects in a list which calls a variable for their name i would need to compare 2 variables dName, dQuality i would need if(dName && dQuality == same as other) then to stack. |
inventory im trying to make the objects in this list stack |