22 | 01 | 2018
List Related
Article Index
List Related
CommandToList
All Pages
@CommandToList @GetCount @GetItem
@InList @EnumList @Enum

 


@CommandToList 

Format: @CommandToList(List Name,Commands)
Format: @CommandToList(List Number,Commands)

CommandToList lets you send a specific command for each of the items in the
list. For each item in the list as the command is processed the system
variable $ListItem is filled in with the current item.

   List Name - Name of the list to use. 
   List Number - Number of the list to use. 
   Command - Commands to execute for each item in the list.

@CommandToList(Friends,tell $ListItem Hi)
Assuming your list had the names Rand and Egwene in it the following text
would be sent: "tell Rand Hi" and "tell Egwene Hi"

@CommandToList(Stuff,$ListItem)
The above would simply process each of the items in the list.

@GetCount

Format: @GetCount(List Name)
Format: @GetCount(List Number)

GetCount returns the number of items in a list.

   list name - The name of the list from which you want to get the number
     of items. 
   list number - The number of the list from which you want to get the
     number of items.

@GetItem

Format: @GetItem(List Name,Number)
Format: @GetItem(List Number,Number)

GetItem retrieves an item from a list by number.

   list name - The name of the list from which you want to get an item 
   list number - The number of the list from which you want to get an item.
   number - The number of the item you want to get.

@GetItem(Friends,1)
Assuming you had a list called friends, this would give you the first item
in that list.

@Inlist

Format: @InList(List Name,Text To Find)
Format: @InList(List Number,Text ToFind)

Returns: 1 if the text is in the list, otherwise 0

InList determines if a specific text string is in a user defined list. InList
can be evaluated in an /if statement. While you can use the list number to
specify a list to search I don't recommend it. If you added a new list it
might change the number of the list are looking for.

   þ list name - The name of the list you want to check.
   þ list number - The number of the list you want to check.
   þ item text - The item you want to search for in the list.

/if {@InList(Friends,Rand){say Rand is in the list.} {say Rand is not in
the list.}
If the word "Rand" is in the list called "Friends" the text "say Rand is in
the list." would be sent to the mud, else the other string would be.

/if {@InList(Friends,Rand) = 0} {say Rand is not in the list.}
Searches for the word "Rand" in the list "Friends" and if it is NOT found the
text "say Rand is not in the list." is sent to the mud.

@Enumlist @Enum

Format: @EnumList(list,item)

Returns 1 based index of the item is found in the list otherwise 0 if not found. Very useful for using as array index so you can make them act like associative arrays.