Skip to content

Evaluator

Florian Fülling edited this page Aug 3, 2020 · 3 revisions

If a door is open or not is determined by a evaluator.

The evaluator uses the Conditions and combines their state which represents the door state.

The plugin provides three evaluator types.

Base Evaluator

These base evaluators are probably faster than the custom evaluator, but provide just simple methods to combine conditions. These take precedence and should be used if possible. They use a optimized evaluation order to reduce calcluation time.

OR

The OR operator will open the door if one of the door conditions is true.
It uses only conditions which are set.

Example: The item condition is true but the proximity condition is false the door will open.

AND

The AND operator will open the door if all of the door conditions are true.
It uses only conditions which are set.

Example: The item condition is true but the proximity condition is false the door will NOT open. The door will only open if the item contion and the proximity condition are fullfilled by one player.

CUSTOM

The custom evaluator is a bit more complex. It allows you to define your own boolean chain.
This is made by javascript. If you are not familiar with javascript you can use a simple syntax which doesnt support everything but at least a lot.

Variables

When working with the custom evaluator you can use several variables which represent the state of the condition.
If the condition of a variable is null the variable will be null as well.
Note: Time and weather conditions will be null as well when the force parameter is false.

Following variables can be used:

  • item: Represents the state of the item condition.
  • location: Represents the state of the location condition.
  • permission: Represents the state of the permission condition.
  • time: Represents the state of the timecondition. (Will be null without force when the time is between close and open)
  • weather: Represents the state of the weathercondition. (Will be null without force when the weather does not change)

Operator

To compare the results you can use several operators. This is restricted to some operators for security reasions. I dont wont to freeze server because someone execute a large for loop or calculates pi.

You can use if and else for branches.

Every operator has a simple form and a logical form. The simple form will be converted to the logical form. Allowed operators are (simple -> logical):

  • and -> &&
  • or -> ||
  • is not -> !=
  • is -> ==
  • not -> !=

Custom Evaluator Examples:

[coming soon]

Clone this wiki locally