Skip to main content
The Module system enables you to create persistent mods that receive events throughout the game’s lifecycle. Modules are scripted classes that can be active at all times or conditionally based on the current game state.

Overview

Modules are powerful because they:
  • Persist across states: Continue running when the player navigates between menus and gameplay
  • Receive all events: Can respond to any game event without needing specific context
  • Support priorities: Control the order in which modules receive events
  • Can be toggled: Activate/deactivate dynamically based on conditions
  • State-scoped: Optionally limit events to specific game states

Creating a Module

Modules are created as .hxc script files in your mod’s scripts directory.

Basic Module Structure

Module Parameters

moduleId
Unique identifier for your module. Use kebab-case by convention.
priority (default: 1000)
Determines event processing order. Lower numbers = higher priority (processed first).
params (optional)
Configuration object:
  • state: Limit module to only receive events when in this specific state

Example: State-Scoped Module

Module Properties

Active State

Controls whether the module receives events. Inactive modules are skipped.

Priority

Modules with lower priority numbers receive events first.

State Association

If set, the module only receives events when the game is in this state or substate.

Core Lifecycle Events

onCreate

Called when the module is first created, before the title screen appears.
It may not be safe to reference other modules in onCreate since they may not be loaded yet.

onDestroy

Called when a module is destroyed. Currently only happens when reloading modules with F5.

onUpdate

Called every frame.

onScriptEvent

Called for ANY script event. Use this as a catch-all or for custom events.

Gameplay Events

Modules implement IPlayStateScriptedClass and receive all gameplay events.

Note Events

Song Events

Countdown Events

BPM-Synced Events

Game State Events

Song Events

State Management Events

Modules implement IStateChangingScriptedClass for state transition events.

UI State Events

Freeplay Events

Character Select Events

Module Management

The ModuleHandler class manages all loaded modules.

Get Module by ID

Activate/Deactivate Modules

Call Events Manually

Complete Example: Combo Tracker

Best Practices

Choose Appropriate Priorities

  • 1-100: Critical mods that must run first (core gameplay changes)
  • 100-500: UI and visual mods
  • 500-1000: Tracking and analytics mods
  • 1000+: Low-priority cosmetic mods

Use State Scoping

Limit modules to specific states when possible to improve performance:

Handle Null Safely

Clean Up Resources