Lists & Arrays
P_commandtolist
Syntax
@commandtolist({list}, {command})
Use Case:
Iterates through each item in a list and executes the specified command for each one. During execution, the current item is stored in the ‘@ListItem’ variable.
Arguments:
- {list} : The list name.
- {command}: The command to run (use semicolon for multiple).
Examples:
- /echo @commandtolist(myList, say hello $ListItem)
See Also:
loop
P_enum
Syntax
@enum({list}, {item})
Use Case:
Returns the 1-indexed position of an item within a list. Returns 0 if not found.
Arguments:
- {list}: The list name.
- {item}: The text to find.
Examples:
- /echo @enum(myList, orc)
See Also:
enumlist, inlist
P_getarray
Syntax
@getarray({array}, {r}, {c})
Use Case:
Retrieves the value stored at the specified row and column in a 2D array.
Arguments:
- {array}: The array name.
- {r} : Row index (0-indexed).
- {c} : Column index (0-indexed).
Examples:
- /echo @getarray(myMap, 5, 10)
See Also:
getarrayrows, getarraycols
P_getarraycols
Syntax
@getarraycols({array})
Use Case:
Returns the total number of columns defined for a specific array.
Arguments:
- {array}: The array name.
Examples:
- /echo Cols: @getarraycols(myMap)
See Also:
getarrayrows, getarray
P_getarrayrows
Syntax
@getarrayrows({array})
Use Case:
Returns the total number of rows defined for a specific array.
Arguments:
- {array}: The array name.
Examples:
- /echo Rows: @getarrayrows(myMap)
See Also:
getarraycols, getarray
P_getcount
Syntax
@getcount({list})
Use Case:
Returns the total number of items currently stored in the specified list.
Arguments:
- {list}: The name of the list.
Examples:
- /echo @getcount(myList)
See Also:
getitem, inlist
P_getitem
Syntax
@getitem({list}, {index})
Use Case:
Retrieves the item at the specified 1-indexed position in a list.
Arguments:
- {list} : The list name.
- {index}: The position (1 to count).
Examples:
- /echo @getitem(myList, 1)
See Also:
getcount, inlist
P_inlist
Syntax
@inlist({list}, {item})
Use Case:
Checks if a specific item exists within a list (case-insensitive). Returns 1 if found, 0 otherwise.
Arguments:
- {list}: The list name.
- {item}: The text to find.
Examples:
- /if {@inlist(myList, orc)} {attack}
See Also:
getcount, getitem