Eval Extra
Description
- This is an addon to apply math expressions in some settings of the menu
- With this, you can write advanced math in menu. Especially, this addon is useful to write advanced conditions in Condition Requirement
Example
stone:
id: stone
amount: "25 + 3"stone:
id: stone
amount: "FLOOR(SQRT(18))" # The amount will be the floor value of the square root of 18, which is 4test-view-requirement:
type: predicate
slot: 1
button:
id: exp_bottle
name: "&cA exp bottle"
lore:
- "You will see this icon when the level is higher than 5"
view-requirement:
level:
condition: "{level} > 5" # This will check if the player's level is higher than 5Operator
- The basic is the use of math operators in the expressions (
+,-,*,/, etc) - Examples:
amount: "5 + 7" # The amount will be 11amount: "{level} % 64 + 1" # The amount will be from 1 to 64, based on the level- Along with math operators, you can also use Boolean operators (
>,<,=,>=,<=, etc) to compare values. - Example:
condition: "{level} > 5" # This will check if the player's level is higher than 5Function
- Functions are the process of “input to output”, take the input and returns the corresponding output.
- Functions
- Example:
amount: "FLOOR(SQRT(18))" # The amount will be the floor value of the square root of 18, which is 4String Functions
- This addon also accepts comparing strings with String Functions
- It includes:
STRCT("this", "is")check ifisis inthis(thiscontainsis)STREDW("String", "ing")check ifStringends withingSTREQ("str1", "str1")check ifstr1equalsstr1STREQIC("str1", "str1")check ifstr1equalsstr1(case-insensitive)STRLEN("Hello World")get the length ofHello WorldSTRMP("String", "String-?")check ifStringmatches the RegExr patternString-?STRSTW("String", "Str")check ifStringstarts withStr
Skip the Evaluation
- If you want to skip your string from evaluation for some reason, put
[skip-eval]before your string- Example: If you want to skip
1 + 1, put[skip-eval]like this[skip-eval] 1 + 1
- Example: If you want to skip
Variable
You can evaluate an expression as a variable by using the variable {eval_<expression>}
For example:
{eval_1 + 2}{eval_{level} * 100}{eval_FLOOR(SQRT(18))}