Skip to content

Functional Substitutions

9yz edited this page Aug 6, 2025 · 5 revisions

These substitutions are built into the program. To use them, wrap the substitution target in double brackets in one of the supported fields, then run the script through the right-click (context) or Tools menu. Different from built-in substitutions, these substitutions take arguments and calculate a return value based on them. Arguments are separated with semicolons.

Example: [[fAdd;5;3]] would evaluate to 8.

Notes:

  • Built-in substitutions cannot be overwritten by user-created substitutions.
  • Built-in substitutions are all case-insensitive.

Math

fAdd, f+

fAdd;val1;val2[;...;valN]

Adds together the arguments. Non-numbers are treated as 0.

fSub, f-

fSub;val1;val2[;...;valN]

Subtracts the arguments from each other. Non-numbers are treated as 0.

fMul, f*

fMul;val1;val2[;...;valN]

Multiplies the arguments together. Non-numbers are treated as 1.

fDiv, f/

fDiv;val1;val2[;...;valN]

Divides the arguments by each other. Returns 0 if any argument is 0. Non-numbers are treated as 1.

fMod, f%

fMod;val1;val2

Returns the modulo of the first number by the second number. Non-numbers are treated as 1.

fFloor

fFloor;val1

Returns the argument, rounded down.

fCeil

fCeil;val1

Returns the argument, rounded up.

fRound

fRound;val1

Rounds the argument to the nearest integer.

String Operations

fPrefix, fPfx

fPrefix;string;int

Returns the first int characters of string.

fSuffix, fSfx

fSuffix;string;int

Returns the last int characters of string.

fSubstring, fSubstr

fSubstr;string;int1;int2

Returns the characters between the int1 and int2 indices of string.

fLength, fLen

fLength;string

Returns the number of characters in string.

fGetIndexOf, fIndexOf, fIndex

fGetIndexOf;string1;string2[;int]

Returns the index of the int-th occurrence of string2 in string1. Returns -1 if not found. int defaults to 1 if not specified.

fGetLastIndexOf, fLastIndexOf, flastIndex

fGetLastIndexOf;string1;string2[;int]

Returns the index of the int-th occurrence of string2 in string1, counting from the end. Returns -1 if not found. int defaults to 1 if not specified.

fFindReplace, fReplace

fFindReplace;string1;string2;string3

Replaces all instances of string2 in string1 with string3. String3 defaults to "" (empty string) if not specified.

fToUpperCase, fToUpper

fToUpperCase;string

Returns string with all characters in upper case.

fToLowerCase, fToLower

fToLowerCase;string

Returns string with all characters in lower case.

fToTitleCase, fToTitle

fToTitleCase;string

Returns string, capitalized following these steps:

  1. Make the whole string lowercase
  2. Capitalize the first letter of all words that are not a, an, and, or the
  3. Capitalize the first letter of the first and last words

Logical Operations

fEquals, fEq, f=

fEquals;val1;val2[;...;valN]

Returns 1 if all arguments are equal, 0 otherwise.

fAnyEquals, fAnyEq

fAnyEquals;val1;val2[;...;valN]

Returns 1 if val1 is equal to any val(N>1), 0 otherwise.

fNotEquals, fNeq, f!=

fEquals;val1;val2[;...;valN]

Returns 1 if any arguments are different, 0 otherwise.

fGreaterThan, fGt, f>

fGreaterThan;val1;val2[;...;valN]

Returns 1 if all arguments valN are greater than val(N-1).

fLessThan, fLt, f<

fLessThan;val1;val2[;...;valN]

Returns 1 if all arguments valN are greater than val(N+1).

fGreaterEqual, fGeq, f>=, f=>

fGreaterEqual;val1;val2[;...;valN]

Returns 1 if all arguments valN are greater than or equal to val(N-1).

fLessEqual, fLeq, f<=, f=<

fLessEqual;val1;val2[;...;valN]

Returns 1 if all arguments valN are greater than or equal to val(N+1).

Boolean Logic

fOr, f||

fOr;val1;val2[;...;valN]

Returns 1 if any argument evaluates to true. 0 otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.

fAnd, f&&

fAnd;val1;val2[;...;valN]

Returns 1 if all arguments evaluate to true. 0 otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.

fNot, f!

fNot;val1

Returns 0 if the argument evaluates to true, 1, otherwise. 0 and "" (the empty string) evaluate to false. All other values are true.

Conditionals

fBranch, fBch

fBranch;val;string1[;string2]

If val evaluates to true, returns string1. Otherwise, if string2 was specified, returns that. Otherwise, returns "" (empty string). 0 and "" (the empty string) evaluate to false. All other values are true.

fSubstExists, fSubExists, fExists, fSex

fSubstExists;string

Returns 1 if string is a valid substitution, 0 otherwise.

fSafeExecute, fSafe

fSafeExecute;val1;val2[;...;valN]

Checks each value to see if it is a valid substitution. If a value is a valid substitution, it is returned without being processed. If no values are valid substitutions, "" (empty string) is returned.

Ex. [[fSafe;banana;apple;cCamera;potato]] would return cCamera (assuming apple, banana, and potato are not valid substitutions). [[[[fSafe;banana;apple;cCamera;potato]]]] would return cCamera from fSafe, and then the surrounding brackets would cause it to be processed, returning the model of the camera used to take the photo.