Skip to content

Shortcuts

The easy mode, and nothing to be ashamed of. One call each for the things charts do all the time: flash the screen, zoom, hide the HUD, flip the scroll, swap the fighters. You don't need to know anything about properties or tweens to use them - put them inside onEvent (or any other callback) and they just work.

format 2.0

event { name = "Chorus Hit" }

function onEvent(p)
    flash(#FF6EC7)        -- a pink flash
    shake(0.01)           -- a short shake
    zoom(1.1, beats(1))   -- zoom in over one beat, and stay
    hideHud(beats(2))     -- the score line fades out
end
Kind Shortcuts
Modifiers ease · set · add · setMod · customMod
Lanes and scroll flipScroll · setScroll · hideStrums / showStrums · hideLane / showLane · moveStrums · resetLanes
HUD hideHud / showHud · hideJudgments / showJudgments
Screen flash · fadeOut / fadeIn · zoom · shake · showTitle
Stage fights particle · worldParticle · lightning · mobWalk · mobAction · setBlock · clearBlocks
Sprite characters characterPose · characterPlay
Fighters focus · swapFighters · pose · setPose / clearPose · setSkin · setModel · setFigure · bind / unbind
Effects setShaderFloat
Health fights setHealth / addHealth
Sound playGameSound · stopSound · soundVolume
Events together trigger · call / callIn · preload
Debugging inspect

The duration is always optional. Left out, hiding, showing, moving and zooming happen at once; the flash, the fades, the shake, the camera's focus and the fighters' swap take one beat. Write durations with beats(2), steps(4), seconds(0.5) or ms(300). Everything a shortcut changes goes back by itself when the song ends.

A word a shortcut doesn't take (setScroll("sideways"), pose("plyer", "left")) or a lane that doesn't exist is an error when the file loads, with a "did you mean ...?" - not a surprise in the middle of the song.

Modifiers

The modifiers: numbers that bend how a field is drawn, planned on the song's beats. Usually all of it goes into onStart: one line per change, in any order. Seeking, watching from inside, replays and the editor all land on the same picture, because a modifier's value only depends on the beat. The guide: Modifiers.

The last two values are the same everywhere: the field (1 = yours, 2-7 = ones copyField() made, a text like "1 2" or "all"; left out = every field) and, for ease, where it starts from (left out = wherever it is at that beat).

ease

ease(beat, beats, easing, value, modifier[, field[, from]])

From beat on, over beats beats, the modifier eases to value. The easing is one of the usual names - "cubicOut", "sineInOut", "linear" ... - plus two of the modifiers' own: "instant" (there at once) and "arc" (out to the value and back where it was).

The latest change that started decides: an ease that starts while another one runs takes over from wherever the value is at that moment.

function onStart()
    ease(32, 2, "cubicOut", 100, "sway")         -- every field
    ease(32, 2, "cubicOut", -300, "z", 1)        -- only yours, 300 px back
    ease(40, 1, "arc", 45, "turnZ")              -- tip over and back in one beat
    ease(48, 4, "linear", 0, "sway", "all", 150)  -- from 150 down to 0
end

Psych modcharting tools: ease(32, 2, 'cubeOut', '100, drunk')

set

set(beat, value, modifier[, field])

At beat, the modifier jumps to value.

function onStart()
    set(64, 100, "downscroll")   -- the scroll flips at beat 64
    set(72, 0, "downscroll")
end

add

add(beat, beats, easing, amount, modifier[, field])

Like ease, but to amount more than the value is at that beat - for kicks that stack on whatever is going on.

-- Every bar the field turns a quarter further.
function onStart()
    for bar = 0, 15 do
        add(bar * 4, 1, "backOut", 90, "turnZ")
    end
end

setMod

setMod(modifier, value[, field])

The modifier is value right now - for values you work out yourself every frame (in onFrame) or that answer the player (in onHit). Calling it every frame is fine: it moves one entry along instead of piling them up.

-- The field leans toward the lane you just hit.
function onHit(n)
    setMod("turnZ", (n.lane - 1.5) * 4)
end

Psych modcharting tools: setMod('drunk', 1) · Kade: receptor.angle = ...

customMod

customMod(name[, default])

A modifier of your own: a number on the same timeline - eased with ease, read with mod() - that draws nothing by itself. Use it for values you turn into something else in onFrame, or to let two planned values add up. Declare it in onStart of every file that uses it (declaring it twice is fine) - customMod and mod() work in both kinds of file, ease only in a .modchart.

-- glitch.modchart: plans the value
function onStart()
    customMod("glitch")
    ease(64, 4, "sineOut", 1, "glitch")
    ease(72, 1, "sineIn", 0, "glitch")
end
-- glitch.event: turns it into a screen effect
function onStart()
    customMod("glitch")
end

function onFrame(dt)
    fx.glitch = mod("glitch")             -- a planned value driving a screen effect
end

With the No Mod modifier the .modchart doesn't run, so mod("glitch") stays 0.


Lanes and scroll

Lanes are numbered 0 (left), 1 (down), 2 (up), 3 (right). These shortcuts move the lanes, so they go in a .modchart file - like the modifiers above.

flipScroll

flipScroll([lane])

Downscroll becomes upscroll and the other way round - every lane, or just one.

flipScroll()      -- the whole strumline
flipScroll(2)     -- only the up lane

Psych: setPropertyFromClass("ClientPrefs", "downScroll", ...) · Changes strums.scroll / strum[lane].scroll

setScroll

setScroll(direction[, lane])

Sets the scroll direction: "up", "down", or "auto" (back to the player's own setting) - for every lane or one.

setScroll("down")        -- everybody scrolls down
setScroll("up", 0)       -- except the left lane

hideStrums

hideStrums([duration])
showStrums([duration])

Fades your whole strumline (receptors, notes, holds) out / in.

hideStrums(beats(2))
after(beats(8), function() showStrums(beats(1)) end)

Kade: showOnlyStrums / strumLine1Visible · Changes strums.alpha

hideLane

hideLane(lane[, duration])
showLane(lane[, duration])

Fades one lane out / in.

hideLane(1, beats(1))

moveStrums

moveStrums(x, y[, duration])

Moves the whole strumline by that many pixels (right, down). moveStrums(0, 0) = home.

moveStrums(-120, 0, beats(2))     -- slide left over two beats

Changes strums.x, strums.y

resetLanes

resetLanes([duration[, ease]])

Every lane back to normal: position, wobble, angle, size, opacity, colour, note opacity, scroll direction - and the ways in, speeds and note angles.

resetLanes(beats(1))

HUD

hideHud

hideHud([duration])
showHud([duration])

The score line, the song title and the hearts.

hideHud(beats(2))

Psych: setProperty("camHUD.alpha", 0) · Changes hud.alpha

hideJudgments

hideJudgments([duration])
showJudgments([duration])

The "Sick!" / "Good" popups, the combo and the ms label.

hideJudgments()

Changes judgments.alpha


Screen

flash

flash([colour[, duration]])

A flash over the whole picture that fades out - white unless you give a colour. One beat unless you give a duration.

flash()                          -- white, one beat
flash(#FF3040, beats(0.5))       -- red, half a beat

Psych: cameraFlash · Changes flash.color, flash.alpha

fadeOut

fadeOut([colour[, duration]])
fadeIn([duration])

Fades the picture to a colour (black unless given) and stays there; fadeIn fades back.

fadeOut(#000000, beats(0.5))                      -- a cut to black
after(beats(4), function() fadeIn(beats(2)) end)

Psych: cameraFade · Changes screen.color, screen.alpha

zoom

zoom(z[, duration])

Zooms to z (1 = normal, 1.2 = closer) and stays there. At once without a duration. In a fight the world camera zooms along.

zoom(1.15, beats(1))

Psych: doTweenZoom / setProperty("defaultCamZoom", ...) · Kade: cameraZoom · Changes camera.zoom

shake

shake(strength[, duration])

Shakes that hard (0.01 is a good start) and calms down over the duration.

shake(0.02, beats(2))

Psych: cameraShake · Changes camera.shake

showTitle

showTitle(text[, subtitle[, duration]])

A big title in the middle of the screen with a smaller line under it - Minecraft's /title look, over everything. It fades in, stays for the duration (2 seconds unless given) and fades out. A long title is made smaller to fit. The colour is title.color.

title.color = #FFD040
showTitle("ROUND 2", "fight!", beats(4))

Changes title.text, title.subtitle, title.alpha


Sprite characters

characterPose

characterPose(n, pose, animation[, x, y[, frames]])

Names a pose of sprite character n: the frames of its .xml called animation plus a number ("BF NOTE LEFT0000" ...). x / y move this pose, in the sprite's own pixels - a Psych character file's offsets work as they are. frames plays only those frames of the animation, in that order: "0-14", "30, 0, 1, 2" - a Psych character file's indices (a GF's two dances are halves of one animation). The poses MineFunkin plays by itself are listed on character[n]; any other name is yours for characterPlay.

characterPose(0, "idle", "BF idle dance")
characterPose(0, "left", "BF NOTE LEFT", 5, -6)
characterPose(0, "leftMiss", "BF NOTE LEFT MISS", 7, 19)
characterPose(2, "danceLeft", "GF Dancing Beat", 0, -9, "30, 0-14")
characterPose(2, "danceRight", "GF Dancing Beat", 0, -9, "15-29")

Psych: the animations of a character file · Changes nothing - it names a pose

characterPlay

characterPlay(n, pose[, duration])

Character n shows that pose now - for the duration (0.6 s unless given) - then dances again.

characterPlay(2, "cheer", beats(1))

Psych: playAnim on a character · Changes nothing


Stage

particle

particle(type, where[, count[, spread]])

Minecraft's particles at a fighter: where is "player", "opponent", "boyfriend", "dad" or "center" (between both). count = how many (8 unless given, at most 64), spread = how far around in blocks (0.5 unless given, at most 4).

They're stage particles: only the people in the song see them - both fighters and whoever watches the fight from inside. The players standing around see nothing. Practice and replays have no world, so nothing shows there.

Any particle that needs no extra values works: flame, soul_fire_flame, heart, note, end_rod, cloud, smoke, crit, enchanted_hit, happy_villager, angry_villager, totem_of_undying, firework, snowflake, glow, electric_spark, cherry_leaves ... A name that doesn't exist (or needs a colour or a block) is said once in the event log. The player's own Particles setting thins them out like any other particle, and a song can spawn at most 600 a second.

particle("flame", "opponent", 12, 0.6)
particle("heart", "player", 3)

Changes nothing - the particles only fly

worldParticle

worldParticle(type, where[, count[, spread]])

The same as particle, but real world particles: the players standing around the fight see them too, even without MineFunkin. One fighter's game asks the server, which checks them (the particle, the place near the fight, at most 600 a second) and shows them to everyone near - both fighters included, so nobody sees them twice. Whoever watches the fight from inside sees them from the song, in time with what they watch. Replays and practice show nothing.

worldParticle("flame", "center", 40, 3)

Changes nothing - the particles only fly

mobWalk

mobWalk(n, x, z[, duration]) · mobWalk(n, where[, duration])

mob[n] walks to x, z (blocks from the middle between the fighters: x = to your right, z = toward the opponent), or to a fighter: where is "player", "opponent", "boyfriend", "dad" or "center" - it stops just in front of them. It takes duration (1000 ms unless given), its legs move and it looks where it goes. For a path, start the next walk when one ends (after).

mobWalk(0, "opponent", beats(4))
mobWalk(1, -5, 2)

Changes nothing - only the picture

mobAction

mobAction(n, action)

mob[n] does something, now:

Action
"jump" a hop
"hurt" flashes red like when it's hit
"swing" swings its arm
"fall" falls over and stays down
"explode" explodes - the flash and the bang only, nothing breaks, nobody is hurt - and is gone
"vanish" vanishes in a puff
"appear" is back (after "fall", "explode" or "vanish")
mobAction(0, "jump")
mobAction(2, "explode")

Changes nothing - only the picture

setBlock

setBlock(n, x, y, z, block)

Puts one block into build[n], at x, y, z from the build's middle (x = to your right, z = toward the opponent, at most 24 out). block is Minecraft's name, with its state if you like: "stone", "glowstone", "oak_stairs[facing=east]", "minecraft:red_wool". "air" takes the block there away. Only a picture for the people in the song; at most 20 000 blocks on the stage.

setBlock(0, 0, 0, 0, "gold_block")
setBlock(0, 0, 1, 0, "oak_stairs[facing=east]")

Changes nothing - only the picture

clearBlocks

clearBlocks(n)

Every block setBlock put into build[n] goes (its .nbt file stays).

clearBlocks(0)

Changes nothing - only the picture

lightning

lightning(where[, spread])

A lightning bolt at a fighter: where is "player", "opponent", "boyfriend", "dad" or "center" (between both), spread = up to how many blocks off it strikes (0 unless given, at most 16).

Only a picture: the bolt, the sky's flash and its thunder, for the people in the song. Nothing burns, nobody is hurt, the players standing around see nothing. With "Reduce flashing" only the thunder is heard. Goes well with stage.weather = "thunder".

lightning("opponent")
lightning("center", 8)

Psych: — · Changes nothing - only the picture and the sound


Fighters

In a fight they work on the fighters in the world; in practice (the Retro TV) pose, setPose, setSkin, setModel and bind(who, x, y) work on the two puppets beside the lanes. focus, swapFighters and the places of bind need a fight fights.

who is a fighter name: "player", "opponent", "boyfriend", "dad", or "both" where it makes sense.

focus

focus(who[, duration])

The fight camera leans toward "opponent" or "player", or back to "center".

function onBeat(b)
    if song.singer == "opponent" then focus("opponent")
    elseif song.singer == "player" then focus("player") end
end

Psych: cameraSetTarget · Changes camera.x, camera.z, camera.yaw

swapFighters

swapFighters([duration])

The fighters jump over each other and trade places. Call it again to swap back.

swapFighters(beats(1))

pose

pose(who, name)

Plays one of the fighters' poses: "left", "down", "up", "right", "death", or "none" to let go. A pose holds like a held note until "none".

pose("opponent", "up")
after(beats(2), function() pose("opponent", "none") end)

Psych: playAnim / characterPlayAnim · Kade: playActorAnimation

setPose

setPose(who, pose, part, pitch[, yaw[, roll]])
clearPose(who[, pose])

The song's own pose for a fighter, built part by part: for "idle", "left", "down", "up" or "right" (poses), one body part ("head", "body", "leftArm", "rightArm", "leftLeg", "rightLeg") at these angles in degrees - the same signs as player.head.pitch. Call it once per part; the first call on a pose starts it from the rest pose.

From then on, when a note of that direction comes, the fighter pops into your pose (a little overdone), holds it and eases back - exactly like MineFunkin's own poses. A song idle stays still with a small dip every second beat. clearPose gives MineFunkin's pose back - one, or all five without a name. The song's end clears them too.

In a fight the players standing around see these poses too: your game sends them along.

-- Our own "up": both arms up, head back, a slight lean.
function onStart()
    setPose("both", "up", "leftArm", 0, 0, 160)
    setPose("both", "up", "rightArm", 0, 0, 160)
    setPose("both", "up", "head", -20)
    setPose("both", "up", "body", -8)
end

Psych: a character's animations in its JSON, playAnim · Kade: playAnim

setSkin

setSkin(who, skin)

A fighter's Minecraft skin: a 64x64 skin .png from the song folder, "opponent" / "player" (that fighter's own skin), or "" (back to its own).

setSkin("player", "opponent")       -- the fighters wear each other's skin
setSkin("opponent", "player")

Psych: the "Change Character" event · Kade: changeDadCharacter

setModel

setModel(who, model)

The arm shape: "slim" (Alex), "wide" (Steve) or "default" (what the skin says).

setModel("both", "slim")

setFigure

setFigure(who, mob) fights

A Minecraft mob stands in for the dummy: "creeper", "minecraft:iron_golem", a mod's mob. The one standing there is pushed out to the side, the new one pushed in from the other side - both keep facing you. "" = the dummy itself again. Only for the dummy - on a player it does nothing. Sets opponent.figure.

function onSection(n)
    setFigure("opponent", n % 2 == 0 ? "creeper" : "skeleton")
end

bind

bind(who, place)
bind(who, x, y[, height])
unbind(who)

A place: bind(who, "bf") puts a fighter on Boyfriend's place (in front, bottom right - the camera stands behind it), "dad" on the opponent's (far, left); the other fighter takes the other place. The camera never moves for it, and focus, atPlace and everything that asks for a place follow it.

A spot on the screen: bind(who, x, y[, height]) pins a fighter like a sprite: its feet at x, y (shares of the screen, 0-1), and with height that tall as a share of the screen. The same as setting pinned, screenX, screenY, screenHeight.

unbind(who) lets go of both: back on the fight's own places (you in front), off the screen spot.

-- The Boyfriend part always in front, whichever side the one watching plays.
function onStart()
    bind("boyfriend", "bf")
end
-- Like a Psych stage: Boyfriend bottom right, the opponent bottom left, half the screen tall.
bind("boyfriend", 0.8, 0.98, 0.5)
bind("dad", 0.22, 0.98, 0.5)

Psych: a stage's boyfriend / opponent positions, setCharacterX


Effects

setShaderFloat

setShaderFloat(slot, "name", value)

Sets a uniform float / int / bool of the song's shader in that slot - the way Psych scripts drive a .frag file. Up to 16 names per slot; a name the shader doesn't declare does nothing. A value that isn't set is 0, except iTime, which runs with the song's seconds.

function onStart()
    shader[0].file = "chroma.frag"
    setShaderFloat(0, "intensity", 0.5)
end

function onBeat(b)
    setShaderFloat(0, "intensity", 1.5)
end

Psych: setShaderFloat(tag, name, value) - with the slot instead of the tag


Health

setHealth

setHealth(share)
addHealth(share)

Your health bar: setHealth sets it (1 = full, 0 = empty, which fails you), addHealth changes it by that share of the bar - minus drains, plus heals. fights Practice has no health, so these do nothing there.

-- Health drain: the opponent's notes take a little, but never the last bit.
function onOpponentHit(n)
    if player.health > 0.1 then addHealth(-0.01) end
end

Psych: setHealth / addHealth · Read it as player.health


Sound

The sounds themselves start with the actions playSound and loopSound - see Sounds and music.

playGameSound

playGameSound(name[, volume[, pitch]])

One of Minecraft's own sounds by its name - the names /playsound takes (minecraft: may be left out). No file needed. Volume 0-1, pitch 0.5-2 (1 = normal). A resource pack's version counts. It plays at MineFunkin's volume, like playSound without a name.

playGameSound("block.note_block.bell", 0.8, 1.5)
playGameSound("entity.generic.explode")

Psych: — · Changes nothing

stopSound

stopSound("name")

Stops the sound started under that name.

stopSound("rain")

Psych: stopSound(tag)

soundVolume

soundVolume("name", volume[, duration])

Fades a named sound to that volume (0-1). At once without a duration.

soundVolume("rain", 0, beats(4))

Psych: soundFadeIn / soundFadeOut / setSoundVolume


Events together

trigger

trigger("Event Name"[, value1[, value2]])

Runs that event's onEvent right now, as if the chart had it here. The values are text, like a chart's. A name the song doesn't have does nothing - the event log says so once, with the name it probably should have been. Works in both kinds of file: a .event can start a .modchart this way (and a .event / .modchart pair of that name runs both halves). With the No Mod modifier a .modchart it names simply doesn't run.

function onSection(n)
    if n == 16 then trigger("Hide HUD", "0", "1") end   -- a built-in event, with its chart values
    if n == 24 then trigger("Spin") end                 -- your spin.modchart, from a .event
end

Psych: triggerEvent(name, value1, value2)

call

call("name"[, values...])
callIn("Event Name", "name"[, values...])

call runs your function of that name in every other event of the song that has one, with up to 6 values. callIn runs it in one event only, picked by its name or alias - an event added later with a function of the same name doesn't join in. Calls can go 64 deep.

call("bigHit", 2)                  -- every event with a function bigHit(strength) runs it
callIn("Impact", "hit", 1.5)       -- only the Impact event's hit(1.5)

Psych: callOnLuas(name, args)

preload

preload("picture.png")

Starts loading a picture now, so it shows the moment you first use it. Put it in onStart.

function onStart()
    preload("stage/fire.png")
end

Psych: precacheImage


Debugging

inspect

inspect("property")

Writes to the event log what a property is right now and why: its value and default, its range and unit, which event set it, the tween moving it, and what other events wrote under it. "strum[2].x" for one slot. The answer to "why is my HUD invisible?".

function onSection(n)
    if n == 8 then inspect("hud.alpha") end
end

The chart editor's State panel shows the same for every property at the playhead, without a script.


What a shortcut changes

Every shortcut is made of properties - the same ones you can set yourself. That matters when you mix them with your own code: the last thing that sets a property wins. So hideHud() and a tween(hud.alpha, ...) of your own at the same time fight each other.

Shortcut Changes
flipScroll, setScroll strums.scroll, strum[lane].scroll
hideStrums, showStrums strums.alpha
hideLane, showLane strum[lane].alpha
moveStrums strums.x, strums.y
hideHud, showHud hud.alpha
hideJudgments, showJudgments judgments.alpha
flash flash.color, flash.alpha
fadeOut, fadeIn screen.color, screen.alpha
showTitle title.text, title.subtitle, title.alpha
particle, playGameSound nothing - they only show / play
characterPose, characterPlay nothing - the character's poses
zoom camera.zoom
shake camera.shake
focus camera.x, camera.z, camera.yaw
swapFighters player. / opponent. x, y, z, turn
pose, setSkin, setModel, setFigure player.pose, .skin, .model, .figure (and the same for opponent.)
setPose, clearPose no property - the fighter's pose designs
bind, unbind player.place / opponent.place, or .pinned, .screenX, .screenY, .screenHeight
setShaderFloat the shader's own values (not shader[n].a ... d)
inspect nothing - it only writes to the log
setHealth, addHealth your health (read it as player.health)
stopSound, soundVolume only the named sound
trigger, call, callIn whatever the event or function they run changes
preload nothing - it only loads