Skip to main content

Action On Scroll Wheel (Power Type)

Runs an Entity Action when the player with the power scrolls the mouse wheel, optionally after a number of notches in one direction.

Type ID: apoli:action_on_scroll_wheel

Aliases: apoli:action_on_scroll

Fields

FieldTypeDefaultDescription
entity_actionEntity Action TypeThe action to run on the player.
directionStringanyThe way the wheel has to turn: up, down or any.
scroll_amountInteger1How many notches are needed before the action runs.
within_ticksInteger10How long a partial count lasts without another notch. 0 never expires.
reset_on_direction_changeBooleantrueWith direction: "any", scrolling the other way restarts the count instead of adding to it.
prevent_hotbar_changeBooleanfalseSwallows the scroll so the selected hotbar slot doesn't move.
cooldownExpression0Ticks before the power can fire again.
hud_renderHUD Rendernot renderedDraws the cooldown as a resource bar.

scroll_amount counts notches, not scroll events with a size. One click of a normal wheel is one notch in either direction. With scroll_amount: 3 and within_ticks: 10, the player has half a second to get three clicks in, and a fourth click starts a new count.

note

prevent_hotbar_change only holds while the power is active, and it is evaluated on the player's own client. It swallows the scroll in the world, not in menus, so scrolling a chest or a Creative tab works as usual.

Examples

Scroll in either direction to cycle an ability, without the hotbar moving:

{
  "type": "apoli:action_on_scroll_wheel",
  "prevent_hotbar_change": true,
  "entity_action": {
    "type": "apoli:change_resource",
    "resource": "example:selected_ability",
    "change": 1,
    "operation": "add"
  }
}

Three quick flicks upward to launch:

{
  "type": "apoli:action_on_scroll_wheel",
  "direction": "up",
  "scroll_amount": 3,
  "within_ticks": 8,
  "cooldown": 60,
  "hud_render": {
    "sprite_location": "apoli:textures/gui/resource_bar.png",
    "bar_index": 2
  },
  "entity_action": {
    "type": "apoli:add_velocity",
    "y": 1.2
  }
}

Notes

  • Scrolling is client input, so on a player this needs Apoli on the client. Any other entity can still be sent notches with /apoli:key scroll, which is also how you test the power without scrolling through your hotbar.
  • The power's condition is checked on the server, so every condition type works, including the ones a client can't answer. The client reports the scroll whenever the player has the power at all.
  • prevent_hotbar_change is the exception. The client has to decide whether to swallow the scroll before the server hears about it, so it reads the condition locally. Base that condition on something the client can see, such as a resource, a toggle or an entity flag, or it won't hold.