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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Tue Apr 09, 2002 8:04 pm   

list commands and more!
 
Okay, here's a fun one:

is there a way, using
 %addnitem 
and
 %delnitem 
to dictate WHERE in a list the new list item goes? Or, if not, can you make a trigger that goes through and if a certain element is somewhere in it, do that one before anything else?

e.g.

If i had a list "herbsinlist" that contained {eba|ec|el|as}, all of which are aliases, and i used
%addnitem to add "eb" to the list, it'd go to the end ({eba|ec|el|as|eb}). Can I make it be the first item? If not, can I fire 'eb' before the rest somehow?

*grin* sorry about the redundancy and repetition :)
Reply with quote
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Tue Apr 09, 2002 8:06 pm   
 
Doh, forgot to mention that i use zMud 5.55, not 6.14...not sure if that'll make a difference.

thanks!
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Apr 09, 2002 8:25 pm   
 
If your problem is that you want to add it ad the first item in the list instead of the last one, then you can do this:
#VAR @list %concat("newItem|", @list)

If, however, you want to add it to some arbitrary place in the list, then this won't work.

Kjata
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Apr 10, 2002 1:03 am   
 
It's quite possible for the version to make a difference. You'll have to check everything for yourself since most of us won't have the 5.55 helps readily available.

6.16 does not have a %delnitem or a %addnitem. It does have #DELNITEM but not a #ADDNITEM. I suspect the same is true for 5.55.

To add an item at the beginning of the list, do as Kjata suggested. To check for the existence of an item in the list, in order to process it first, use #IF with the %ismember function.

#IF (%ismember("eb",@herbsinlist) > 0) {#DELNITEM herbsinlist {%ismember("eb",@herbsinlist)};eb} {%item(@herbinlist,1);#DELNITEM herbsinlist 1}

LightBulb
All scripts untested unless otherwise noted
Reply with quote
razo
Newbie


Joined: 11 May 2002
Posts: 2

PostPosted: Wed Apr 10, 2002 2:14 am   
 
ooer!

i used the %ismember command by itself, didn't seem to care if i used the > 0 part. After a wee bit of tweaking it worked! Yay!

Thanks guys!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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