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
teion
Wanderer


Joined: 03 May 2005
Posts: 67

PostPosted: Thu Nov 08, 2018 2:33 pm   

executing items from a list
 
Hi everyone, on the mud I play there are quests that can have random actions associated with them and to perform these I populate a string list full of aliases.
These aliases in turn may add to the list depending on if the triggers they have associated with them fire.
My problem is the list itself has to be a LIFO list - last in first out, because the only list operations seem to favor the beginning of the list. I use Pop and push extensively and
would like the list to be a FIFO - first in first out list.

The most obvious answer is to sort the list after adding which can be done but can take time if the list is really big.

TLDR: are there commands that work on the last item in a list?
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 3836
Location: Pensacola, FL, USA

PostPosted: Thu Nov 08, 2018 4:16 pm   
 
%pop is FIFO by default
you should be using %additem instead of %push, as it adds to the end of the list rather than the beginning.
%additem also allows repeat items in a list, whereas #ADDITEM does not
You could force LIFO with %item and %numitems, but then you would have to do manual cleanup with #DELN
oh, and #EXEC is what you need to make it recognize your local variables.

#EXEC {%pop(list)}
_________________
Windows 10 Home Premium 64-bit
AMD Phenom II x6 1055T 2.8GHz 16GB
CMUD Pro v3.34
Reply with quote
teion
Wanderer


Joined: 03 May 2005
Posts: 67

PostPosted: Thu Nov 08, 2018 4:34 pm   
 
thanks
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