|
teion Wanderer
Joined: 03 May 2005 Posts: 72
|
Posted: 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? |
|
|
|
shalimar GURU
Joined: 04 Aug 2002 Posts: 4691 Location: Pensacola, FL, USA
|
Posted: 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)} |
|
_________________ Discord: Shalimarwildcat |
|
|
|
teion Wanderer
Joined: 03 May 2005 Posts: 72
|
Posted: Thu Nov 08, 2018 4:34 pm |
thanks
|
|
|
|
|
|