S3maphoreDocs
guide

Priority and Interruption

Resolve competing playlists without relying on special-case magic.

You are in the right place when two playlists can both play and you need to decide which one wins. Priority determines which valid playlist is preferred. Interrupt mode determines whether that newly preferred playlist may replace the track that is already playing.

You do not need to memorize the numbers. Start with a named PlaylistPriority value, then choose a named INTERRUPT value only when the default behavior is not what you want. Lower priority numbers are considered first.

Every PlaylistPriority value

ValueNumberTypical use
PlaylistPriority.Special50One-shot, quest, boss, or other deliberate special music.
PlaylistPriority.BattleMod190Modded or more specific combat music.
PlaylistPriority.BattleVanilla200Vanilla-style combat music.
PlaylistPriority.TimeOfDay300Music selected by time of day.
PlaylistPriority.MerchantType350Music tied to nearby merchant services.
PlaylistPriority.Class375Music tied to an actor class or similar category.
PlaylistPriority.Faction400Music tied to a faction.
PlaylistPriority.CellExact500Music for specific named cells.
PlaylistPriority.Tileset600Music identified by dungeon or architectural tiles.
PlaylistPriority.CellMatch700Music for a family of matching cells.
PlaylistPriority.City800Music for a city or settlement.
PlaylistPriority.Region900Music for a broad region.
PlaylistPriority.Explore1000General exploration music.
PlaylistPriority.Nevermath.hugeSentinel / lowest-priority fallback. If used, set interruptMode explicitly.

The priority value also determines which resolution deck a playlist enters: Explore, Battle, or Special. Keep a playlist in the band that matches its purpose. See Playlist Specification for the other fields and PlaylistEnvironment for the injected PlaylistPriority value.

When two playlists have the same priority, registration order breaks the tie. For playlists loaded from files, that means the VFS file order followed by the order of the playlist tables returned by each file. Do not rely on that as a hidden override; use a more specific priority when one playlist should reliably win.

Automatic interrupt modes

If interruptMode is omitted, S3maphore assigns it from the priority band:

Priority rangeDefault
<= PlaylistPriority.SpecialINTERRUPT.Never
<= PlaylistPriority.BattleVanillaINTERRUPT.Other
<= PlaylistPriority.ExploreINTERRUPT.Me
> PlaylistPriority.ExploreInvalid, except for the PlaylistPriority.Never sentinel, which requires an explicit interruptMode.

This default is a convenience, not a rule. Set interruptMode explicitly when the playlist's interruption behavior matters. Override is never assigned automatically.

Every INTERRUPT value

ValueNumberMeaning
INTERRUPT.Me0Normal exploration-style interruption behavior.
INTERRUPT.Other1Normal battle-style interruption behavior.
INTERRUPT.Never2Do not interrupt the track already playing.
INTERRUPT.Override3Bypass the normal interruption gate and replace the current track when selected.

INTERRUPT.Override is for deliberate moments such as quest stages, boss entrances, and one-shot cues. It bypasses the interruption gate, but the playlist must still be active, have tracks, pass its callback, and win normal priority resolution. In other words, Override is a permission to interrupt, not a shortcut around playlist selection.

Keep the journal lookup outside the callback. The same rule tables are used as cache keys by S3maphore. Playlist callbacks use the Playback binding from the PlaylistEnvironment.

local QuestStages = {
    MyQuest = { min = 10 },
}

return {
    {
        id = 'my-mod/boss-entrance',
        priority = PlaylistPriority.Special,
        interruptMode = INTERRUPT.Override,
        playOneTrack = true,
        tracks = {
            'music/my-mod/boss-entrance.mp3',
        },
        isValidCallback = function()
            return Playback.rules.journal(QuestStages)
        end,
    },
}