Activator ITEM_HELD

This activator is executed at the moment when the player changes the item in his hand.

To create an activator, you need to use the command:

/react add ITEM_HELD <ИмяАктиватора> [itemnew:<Item>] [itemprev:<Item>] [slotnew:<1..9>] [slotprev:<1..9>]

ElementPossible Values ​​Description
itemnew<Item> /''The item that the player chooses. itemnew: '' - any item
itemnprev<Item> /''The item that the player had in hand before choosing a new object. itemprev: '' - any item
slotnew<0..9>The slot number that the player chooses. slotnew: 0 - any slot
slotprev<0..9>The slot number that the player had before selecting a new slot. slotprev: 0 - any slot

Temporary placeholders active in this activator

PlaceholderDescription
%itemnew%A textual representation of the selected subject that can be used to recreate the subject again (with the help of ITEM_GIVE, ITEM_DROP, etc.)
%itemnew-str%Description of the selected subject, which includes name, value data and quantity
%itemprev%A textual representation of the previous subject in hand that can be used to recreate the subject again (with the help of ITEM_GIVE, ITEM_DROP, etc.)
%itemprev-str%Description of the previous item in the hand, which includes the name, the value of data and the number of
%slotmnew%The number of the slot that is selected
%slotmprev%Number of the previous slot

Examples

  1. We will deduce the result of the activator's work when changing the subject in hand:
    /react add ITEM_HELD ih
    /react add ih a message &cItemNew: &f%itemnew%
    /react add ih a message &cItemPrev: &f%itemprev%
    /react add ih a message &cSlotNew: &f%slotnew%
    /react add ih a message &cSlotPrev: &f%slotprev%
    or
ITEM_HELD:
  ih:
    item-new: ''
    item-prev: ''
    slot-new: 0
    slot-prev: 0
    flags: []
    actions:
    - 'message = &cItemNew: &f%itemnew%'
    - 'message = &cItemPrev: &f%itemprev%'
    - 'message = &cSlotNew: &f%slotnew%'
    - 'message = &cSlotPrev: &f%slotprev%'
    reactions: []
  1. Perform some actions in other slots and return to the previous slot:
    /react add ITEM_HELD ih2 slotprev: 1
    /react add ih2 f !COMPARE param:%slotnew% value1:%slotprev%
    /react add ih2 a message &awe perform some actions in the slot &e&l%slotnew%
    /react add ih2 a message &awe return to the slot &e&l%slotprev%
    /react add ih2 a cancel_event true
    or
ITEM_HELD:
  ih2:
    item-new: ''
    item-prev: ''
    slot-new: 0
    slot-prev: 1
    flags:
    - '!COMPARE = ​​param:%slotnew% value1:%slotprev%'
    actions:
    - message = &awe perform some actions in the slot &e&l%slotnew%
    - message = &awe return to the slot &e&l%slotprev%
    - cancel_event = true
    reactions: []