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
dime
Novice


Joined: 15 Dec 2002
Posts: 35

PostPosted: Tue Jun 03, 2003 5:33 pm   

reading then deleting from a list
 
i'd like to know if there's a way to read and then delete a name from a list of possible names...
either 1. i have a variable called names {namea|nameb|namec|named} and i can have a script call a name from the variable and then remove it from the list...
or 2. i have a file 1 {names.txt} and i read 1 1 and again, have it delete that specific line after i use the name..

thanks
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Jun 03, 2003 6:10 pm   
 
Yes. The list variable would be easier. You can delete items from a list using #DELITEM , %delitem, or #DELNITEM as the situation calls for.
#DELITEM temp1 test1
#VAR temp1 %delitem( "test1", @temp1)
#DELNITEM temp1 1

You can get a particular item (the first item, for instance) from a list using %item.
#SAY %item( @temp1, 1)

You can also use %pop to retrieve and delete the first item from a list variable.
#SAY %pop( temp1)

LightBulb
Advanced Member
Reply with quote
dime
Novice


Joined: 15 Dec 2002
Posts: 35

PostPosted: Tue Jun 03, 2003 6:26 pm   
 
thanks.. was having a hard time finding that.. ended up with a script to use #tab and #untab to create lists, write to log files and then pick random names from the text files..

btw, %pop is a new feature? since which version? i'd like the script i'm working on to be backwards compatible to at least 6.16
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Jun 03, 2003 9:55 pm   
 
%pop first appeared in version 6.22 or so off the top of my head.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jun 04, 2003 12:32 am   
 
You can look it up in the Version History.

LightBulb
Advanced Member
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