Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Thu Aug 19, 2010 5:17 pm   

Removing Duplicates from Variable List?
 
I've searched through the help for awhile and can't quite find anything that might be of any use. I currently have a rather large variable that has a list of a large number of people from certain guilds on Discworld. The problem is every time I execute the command to add people to the list it duplicates people who are already in it. Is there any easy way to run through the list and purge the duplicates?

Here's an example of one of the variables:

http://fewyn.pastebin.com/Ld4wdQ5i

As you can see there are a lot of duplicates :(

Any help would be appreciated!
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Aug 19, 2010 5:44 pm   
 
I believe you are looking for the %dups function. That should do the trick.
_________________
Asati di tempari!
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Thu Aug 19, 2010 5:52 pm   
 
Sadly it removes all the duplicates and I need to keep at least one :(
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Thu Aug 19, 2010 6:03 pm   
 
Are you sure. It should keep one of each.

Try this for example.
Code:
 #SHOW %dups(Athos|Bertrand|Caesar|Bertrand|Caesar|Bertrand)


I'll also try your specific variable.

[Edit]I just did a test with your variable and it works as expected. Only instance of each name remains (I randomly checked a couple). Which one is in the original list but not the de-duped list?

Here is my test code

Code:
#SHOW %countlist(%dups(%sort(@DupTest)))
#show %countlist(%sort(@DupTest))


Note that DupTest is a variable containing your list.
_________________
Asati di tempari!

Last edited by Tech on Thu Aug 19, 2010 6:11 pm; edited 1 time in total
Reply with quote
Fewyn
Wanderer


Joined: 27 Sep 2002
Posts: 83

PostPosted: Thu Aug 19, 2010 6:11 pm   
 
Nevermind I'm a moron and setup the alias wrong :s Thanks Tech!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net