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 4
test-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 5
Operator
- The basic is the use of math operators in the expressions (
+
,-
,*
,/
, etc) - Examples:
amount: "5 + 7" # The amount will be 11
amount: "{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 5
Function
- 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 4
String Functions
- This addon also accepts comparing strings with String Functions
- It includes:
STRCT("this", "is")
check ifis
is inthis
(this
containsis
)STREDW("String", "ing")
check ifString
ends withing
STREQ("str1", "str1")
check ifstr1
equalsstr1
STREQIC("str1", "str1")
check ifstr1
equalsstr1
(case-insensitive)STRLEN("Hello World")
get the length ofHello World
STRMP("String", "String-?")
check ifString
matches the RegExr patternString-?
STRSTW("String", "Str")
check ifString
starts 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))}