Skip to content

Latest commit

 

History

History
126 lines (75 loc) · 9.54 KB

Условия.md

File metadata and controls

126 lines (75 loc) · 9.54 KB

Условия - это механизм Маппета, который позволяет определять и оценивать что-либо примерно как выражения, но с использованием визуального редактора и разных блоков условий. Если вы не сильно разбираетесь в программировании и кодинге в целом, можете попробовать перейти с выражений на условия.

Условия доступны в каждом компоненте проверщика.

Механики

У условий есть множественные блоки условий, которые проверяют текущий контект и возвращает значение в виде булева (что, в общих чертах, означает да или нет, вкл/выкл, допуск-недопуск, true или false, 1 или 0).

Condition goes over those blocks and evaluate them one by one from top to bottom. By default if all blocks return a positive then condition works and enables whatever it should've enabled (for example enabling redstone signal in an emitter). Individual blocks can be inverted or compared using OR (meaning instead comparing using OR instead of AND), and even nested by using condition block.

Demonstration

Let's say we have following condition:

Simple condition

By default, this will read as: if player "Holds a Grass Block" and "Is day?" Only in case when all of these conditions are true, i.e. the player is actually holding a block and it's day (the world time is between 0 and 12000).

This scenario can be summarized by following table:

Block Result
Holds Grass Block true
Is day? true

But once one of those becomes false, for example player stops holding a grass block, then the condition will return a negative result. But, if you want the player to hold grass block or it should be day, in that case you'll need to mark "Is day?" block as OR like this:

Marking as OR

Then the condition will send a positive result either, if the player will hold a grass block, or it's day. It will read as: if player "Holds a Grass Block" or "Is day?" The ❗ allows to invert the result returned by a block, so if we'll go to "Holds Grass Block" block and enable inversion:

Marking as NOT

Then the condition will read as: if player not "Holds a Grass Block" or "Is day?" So the emitter will emit the redstone signal, if the player doesn't hold a grass block, or it's day. If you'll add into this nested conditions, it will get even more crazier. What I would recommend in such situations is reading those blocks out loud, and seeing if it makes sense.

Editing

When a checker component is toggled in a condition state (when Edit condition... button is present) click on the Edit condition... button and it will open condition editor modal:

Empty condition editor

By right clicking where it says Right click here... and Add a condition... will allow you to add a condition. Try adding a World time condition block. After adding the block, on the left you will see condition block list, and on the right the condition block editor.

Condition editor

By right clicking you can also remove and copy/paste conditions. If you have multiple condition blocks in the list, you can also sort them by drag and dropping.

Condition blocks

At the moment of writing of this documentation, condition editor supports following condition blocks:

  • Quest block, this block allows to check whether player(s) (or the world) has no quests in-progress or completed (i.e. absent), in-progress quests or completed quests.
  • State block, this block allows to compare a state of a player or of the world.
  • Dialogue block, this block allows to check whether a player read a dialogue.
  • Faction block, this block allows to check player's relationship with a faction.
  • Item block, this block allows to check whether a player holds, equips or has an item in the inventory.
  • World time block, this block allows to check world's time.
  • Condition block, this block allows to setup nested conditions.

Every condition block has two icon buttons similar to ❗ and 🔀 emojis. ❗ allows you to inverse the result of the block, while 🔀 allows you to mark the block to be combined with previous result using OR instead of AND.

Quest block

In a quest block, you can pick quest's ID, the completion state (absent, present or completed) and the target player (see below for more information about target).

State block

In a state block, you can pick the key of a state, target where to look for the state (see below for more information about target) and comparison mode (see below for more information about comparison modes).

Dialogue block

In a dialogue block, you can pick dialogue's ID, the marker ID and the target player (see below for more information about target).

Faction block

In a faction block, you can pick faction's ID, faction comparison mode, the target player (see below for more information about target) and comparison mode (see below for more information about comparison modes)

Faction comparison mode can be:

  • Aggressive checks whether attitude towards found player is aggressive.
  • Passive checks whether attitude towards found player is passive.
  • Friendly checks whether attitude towards found player is friendly.
  • Score checks faction scare of the found player using comparison mode.

Блок предмета

В блоке предмета вы можете выбрать какой-либо предмет, режим сравнения предметов или нацелить игрока (see below for more information about target).

Item comparison mode can be:

  • Held (hands) checks whether the player must hold in hands (stack count isn't accounted for).
  • Equipment (armor) checks whether the player has an item stack equipped in an armor slot (i.e. helmet, chestplate, leggings or feet).
  • Inventory checks whether the player has an item stack in the inventory.

World time block

In a world time block, you can pick time condition mode, and range (but only if time condition range is Range).

Time condition mode can be:

  • Is day? checks whether it's day in the world (012000).
  • Is night? checks whether it's night in the world (1200024000).
  • Диапазон checks whether world's time is between minimum (the left field) and maximum (the right field).

Блок условия

В блок условия времени вы можете редактировать you can edit the nested condition by clicking Edit condition... button which will open another condition editor on top of current condition editor. There you can edit conditions.

Цель

В большинстве редакторов блоков условий есть кнопка Цель, которая позволяет переключаться между несколькими режимами целей.

  • Глобальная нацелена на мир/сервер.
  • Субъект нацелена на сущность-субъект в контексте события.
  • Объект нацелена на сущность-объект в контексте события.
  • Селектор нацелена на одного игрока посредством заданного селектора цели (если селектор цели найдет более чем одного игрока, то в проверку блока будет возвращен значение типа void).

Сравнение

В некоторых редакторах блоков условий есть режим Сравнения, который позволяет осуществить сравнение искомого значения found. Поле значения позволяет установить целевое значение target, с которым будет сравниваться значение found. Имейте в виду, что как found, так и target, являются переменными, а потому операторы их сравнения будут работать следующим образом:

  • found < target (<), true если found меньше чем target
  • found <= target (<=), true если found меньше чем или равно target
  • found == target (==), true если found равно target
  • found >= target (>=), true если found больше чем или равно target
  • found > target (>), true если found больше чем target