> For the complete documentation index, see [llms.txt](https://zypec.gitbook.io/particles/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zypec.gitbook.io/particles/effects/creating-effect/tick-handlers.md).

# Tick Handlers

This page was last updated for version v1.2.0

## Description

Tick Handlers are the section where scripts are written. In addition, the number of times these scripts are run can also be set. Any number of Tick Handlers can be added, with the one added at the beginning running first (order sensitive).

Tick Handlers should be written inside the `on-tick` section. You can also change the interval of the effect.

```yml
interval: <INTEGER> # In ticks, default=1
on-tick:
  example-tick-handler: # Tick handler key
    event: <EVENT> # Required
    display-name: <STRING> # Optional, default="[<INDEX>]"
    interval: <INTEGER> # Optional, default="effect interval"
    times: <INTEGER> # Optional, default=1 
    mixer-options: # Optional
      private: <BOOLEAN> # Optional, default=false
      lock-event: <BOOLEAN> # Optional, default=true
      depend: <LIST> # Optional, default=empty list
    scripts:
      - ...
      - ...
```

## [Events](/particles/effects/creating-effect/tick-handlers/events.md)

## [Mixer Options](/particles/effects/creating-effect/tick-handlers/mixer-options.md)

## Examples

```yml
effects:
  example-effect:
    display-name: "%example%"
    variables: [ 'r', 'x','y' ]
    interval: 10 # in ticks
    on-tick:
      tick-handler-1:
        event: ELYTRA
        times: 32 # How many times will 'do' lines invoke
        scripts:
          - ...
          - ...
      tick-handler-2:
        event: PROJECTILE
        scripts:
          - ...
          - ...
```

```yml
effects:
  rainbow-circle:
    display-name: "Rainbow Circle"
    variables: [ 'r', 'x', 'y' ]
    interval: 1
    on-tick:
      spawn-particle:
        event: ELYTRA
        times: 32
        scripts: # Don't copy paste this code, use 'circle' script instead.
          - variable r=2*{PI}*{i}/32
          - variable x=cos({r})
          - variable y=sin({r})
          - particle [effect=minecraft:dust,direction=true,pos={x={x};y={y}},amount=10,origin=head*-1.25,color={name=rainbow;speed=0.75}]
      play-sound:
        event: ELYTRA
        scripts:
          - sound [name=entity.arrow.hit_player,client=true,volume=0.1,pitch=1]
      send-action-bar:
        event: ELYTRA
        scripts:
          - actionbar <rainbow><b>COOL RAINBOW EFFECT!
```
