Placeholder for processing arrays
A multifunctional placeholder that allows you to process arrays (strings separated by separators).
Meaning
Allows you to process arrays (strings separated by separators) in any ways, simply and quickly. Like "1,2,3,4,5" - the array separated by comma, and you can get some element by index in it, remove it and so on.
Format
%CEP_array_<separator>_<operation>_<array>_(semi-mandatory) <start_index>_(semi-mandatory) <end_index>_(semi-mandatory) <value>_(semi-mandatory) <new_value>%<separator> – the separator which is separating data in the string (the more often separators are "," and ";"); (MANDATORY)
<operation> – may be GET (alias: G), GET-PART (alias: GP), GET-BY-INDEX (alias: GBI), GET-COUNT-BY-VALUE (alias: GCBV), GET-INDEXES-BY-VALUE (alias: GIBV), GET-LENGTH (alias: GL), CHECK (alias: C), ADD-BY-INDEX (alias: ABI), SET-BY-INDEX (alias: SBI), SET-BY-VALUE (alias: SBV), SET-RANGE (alias: SR), REMOVE-BY-INDEX (alias: RBI), REMOVE-BY-VALUE (alias: RBV) or REMOVE-RANGE (alias: RR); (MANDATORY)
<array> – the array itself (string separated by specified separator, it also supports underscores); (MANDATORY)
<start_index> – the start index for the data, you can use "~" symbol to use the last index in the array (only in case of "GET-PART", "GET-BY-INDEX", "ADD-BY-INDEX", "SET-BY-INDEX", "SET-RANGE", "REMOVE-BY-INDEX" and "REMOVE-RANGE" actions); (SEMI-MANDATORY)
<end_index> – the end index for the data, you can use "~" symbol to use the last index in the array (only in case of "GET-PART", "SET-RANGE" and "REMOVE-RANGE" actions); (SEMI-MANDATORY)
<value> – the value for the data (only in case of "GET-COUNT-BY-VALUE", "GET-INDEXES-BY-VALUE", "CHECK", "ADD-BY-INDEX", "SET-BY-INDEX", "SET-BY-VALUE", "SET-RANGE" and "REMOVE-BY-VALUE" actions); (SEMI-MANDATORY)
<new_value> – the new value for the data (only in case of "SET-BY-VALUE" action). (SEMI-MANDATORY)
In case of "GET-COUNT-BY-VALUE", "GET-INDEXES-BY-VALUE", "CHECK", "SET-BY-VALUE" and "REMOVE-BY-VALUE" operations you can use any conditions in "value" values the same as here, you can also use "AND", "OR" and their combinations with brackets for priority defining!
Use $val@ placeholder in conditions for the current value.
See more in examples.
All placeholders which you want to make as the part of the conditions should being started with "$" and ended with "@" symbols!
You can escape these characters where you do not want to use placeholders with "\" symbol!
Table of required array parameters for different operations and operations meaning (checkmarks are what must necessarily be used (or optional if specified)):
GET
Get the whole array back
GET-PART
Get the part of the array back
GET-BY-INDEX
Get the element by index in the array
GET-COUNT-BY-VALUE
Get the amount of elements in the array
GET-INDEXES-BY-VALUE
Get the elements indexes in the array
GET-LENGTH
Get the length of the array
CHECK
Check if the value exists in the array
ADD-BY-INDEX
Add the element to the array by index
SET-BY-INDEX
Set the element in the array by index
SET-BY-VALUE
Set the certain values in the array to the new values
SET-RANGE
Set the range in the array to the new values
REMOVE-BY-INDEX
Remove the element in the array by index
REMOVE-BY-VALUE
Remove the certain values in the array
REMOVE-RANGE
Remove the range in the array
Use "ᵕ" symbol instead of underscores in <value> and <new_value>!
Use "␠" symbol instead of spaces in <value>, <new_value> and <array> if amount of spaces nearby are above 1!
The counting in the array is starting from 0, consider it!
Options that are not needed for one <operation> or another should be completely skipped, and not just left empty!
Where is useful
For example, you have a list of players that you need to process somehow: create another list, considering certain conditions for each player, and so on. Of course, you will also need to make some script in ConditionalEvents, but with this placeholder its size and complexity will be 100 times less, no exaggeration.
Examples
%CEP_array_,_GET-BY-INDEX_test1,test2,1,2,test5_2% # Get the third (counting from 0) element of the specified array, that is, number "1"%CEP_array_,_REMOVE-BY-INDEX_test1,test2,1,2,test5_1% # Remove the second (counting from 0) element in the specified array, that is, "test2" value%CEP_array_,_SET-BY-VALUE_test1,test2,1,2,test5_$val@contains5 OR $val@>1_NEW% # Set the last two values to the "NEW" value because only they are accomplish the conditions%CEP_array_,_GIBV_test1,test2,1,2,test5,goodOP2_($val@startsWithtest OR $val@startsWithgood) AND $val@contains2% # Get indexes of the first (counting from 0) and the last values because only they are accomplish the conditions%CEP_array_,_RBV_abcfe,dc,3,2,ofgswfe,lkdj,43d,t_$string_length_$val@@>=5 OR $string_length_$val@@<2 OR $CEP_isObject_number_$val@@==true% # Remove values which length is longer or equals to 5 or lower than 2, or which are numbers, that is all except "dc,lkdj,43d"Last updated
