Datapack that has string operations sort of.
- strings: Reads strings into char arrays
- strings/substring: Can create "substrings" of char arrays
- strings/case: Has to lower, to upper case and get case functions
- string/ntca: Converts a number into a char array
- dictionary: WIP part for a tts module
- examples: Has some example functions (Ts)
- application/name: Shortens names using a set of rules, for occasions where messages may require names below a certain length
- base64: converts an array of base64 chars into an array of ascii chars (gibbs)
- parser: parses an array of chars formatted as a json object into name/value pairs (gibbs)
- application/cape: Detects which cape (if any) a player has
- application/unix: Converts unix timestamps into dates/times (Suso)
More modules are in development
data modify storage string:in input append value {string:"abcde"}to put in a stringfunction string:do/readto read the stringdata get storage string:out outto get the char array
- Replacement for Step 1:
data modify storage string:in input append value {string:"abcde",callback:{command:"function example:test",id:1}} - When the string is completely read the function in 'callback.command' is called and the score of 'callback string' is set to 'callback.id'. Both values are optional (see examples 3-4)
- Several strings can be handelled after each other with a queue by using Basic Step 1 and Step 2 several times after one another (see example 4)
- Replacement for Step 1:
data modify storage string:in input append value {string:"abcde",async:{iterations:10}} - After 'async.iterations' iterations the module stops processing and continues in the next tick. Can be combined with callbacks and the callback will be called once the entire string has been processed.
- Replacement for Step 1:
data modify storage string:in input append value {string:"abcde",async:{iterations:10,parallel:1}} - After 'async.iterations' iterations the module stops processing and continues in the next tick. The callback is called every tick with everything found in that tick, as well as once at the end with the entire string. This allows parallely already doing something with the start of the string while the rest of the string is still parsing.
data merge storage substring:in {string:["a","b","c"],start:0,length:2}inputfunction substring:do/startto executedata get storage substring:out stringto get a char array of the substring- Start determines where the substring starts, length determines how long it is
- Negative start, starts counting from the end instead (start=-1 starts at the last character)
- Negative length is equal to (string length)+(length) (length=-1 for a 10 character string would be 9)
- The char array for this function can be generate using the Strings module and put into this module via a callback (see Examples 8 and 9)
Explanation is coming soon
Explanation is coming soon
Module not final
Explanation is coming soon
Explanation is coming soon
/data modify storage base64:in string set value ["S", "G", "V", "s", "b", "G", "8", "g", "V", "2", "9", "y", "b", "G", "Q", "h"]/function base64:convert/data get storage ascii:main textto read the output/function print:tellrawgives a plaintext readout of the output array
/function base64:callwill copy the array of characters from the output array of the strings module, then convert them. (Good for converting player skull data)/function print:callconverts an array of bytes in thestorage ascii:main bytesinto ascii characters (ascii values 32 to 126)
/data modify storage parse:in in set value ["{",'"',"a",'"',":",'"',"b",'"',"}"]/function parser:call/data get storage parse:main outto read the output
- numbers longer than 9 digits are displayed in a specific way, for example the number
-3234567.8901would be displayed as[-1, 3, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 4]and if it is not in an array it's type would be"long_number" - the format for long numbers is
[p,n,d]
pis-1if the number is negitive, and1if it is positivenis the digits in orderdis the position of the decimal point from the right
- Integrated with this module is a base(x) converter, instructions for its use can be found here
- The output of this is formatted in name/value pairs inside of an output array, the notation is
{Value:[],Type:"",Extra:[],Name:[]}Minecraft itself orders the data like this, I do not have any control over how the data is ordered inside of the pair itself. - escape characters are avalible, you are going to want to escape any qotes (
") within the name or value entires. To enter a backslash (\) into a char array you need to use 2, so"\\".
Explanation is coming soon
- Input unix timestamp in seconds:
scoreboard players set second sUnix 1575491054 - Run
function unix:convert - Outputs as scores: Objective
sUnixfor playersday,month,year,hour,minute,second,weekday(0 for Thursday, 6 for Wednesday) - Outputs as CustomNames: month:
@e[type=minecraft:armor_stand,tag=month,tag=sUnix], weekday:@e[type=minecraft:armor_stand,tag=weekday,tag=sUnix] function unix:displayshows the result
- McTsts > String Reading
- gibbsly > Advanced String Operations
- Suso > Unix
Please credit McTsts, Suso and gibbsly if you use any of the modules
- Zonteek > Original Concept (to get timestamp)
- SirBenet > "a, b, c" tag step explanation
- Onnowhere > /help step concept
- Oskar > Asking about the /tag list bug
- Misode > Recursive nbt for dictionary solution