Writing commands
On this page
@command unnamed… name=value …
Command names are lowercase letters, digits and -.
Value types
| How to write it | Type |
|---|---|
300ms 1.5s | Duration. The unit is required (300 alone is an error) |
3 -0.5 | Number |
true false | Boolean |
#000 #cc3333 #cc333380 | Color |
"a string with spaces" | String |
room_night.jpg Yuika | String (without spaces) |
(expression) | Expression, evaluated at run time (@wait (time), at=(temp.pos)) |
#label file file#label | Jump target (@sleep-game extra#gallery). The syntax check confirms that the label and file exist |
game.x system.x temp.x | Variable. Receives a command’s result (@text-input game.name) |
Parameter rules
To set a named boolean parameter to true, you can write just its name, as in @chara Yuika solo (the same as solo=true). To set it to false, write solo=false. When a line is read, the first unnamed parameter and any required unnamed parameters are filled first. If a word written as just a name could also be read as the value of an unnamed parameter that isn’t filled yet, the syntax check reports an ambiguous-bool-shorthand error. If you meant the boolean, write solo=true in full. Clashes that depend on the project’s definitions, such as variant names, are found when those definitions are available. To give only a boolean while leaving out the first unnamed parameter, write it as wait=true.
- Don’t write values that equal the default. This is a writing rule, and the syntax check doesn’t treat it as an error. A value equal to the project default (
commandDefaults) gets left behind when the default changes, so the check reports it as info (same-as-default) with a fix that removes it (Fix all in Studio removes them at once). - Unnamed parameters can’t be written with a name (
positional-by-name). Which parameters are unnamed is decided for each command. - In a command with two unnamed parameters, the two always have different types (in
@chara Yuika smile, a character and a variant). If you put them in the wrong order, the syntax check catches it.
Scene change (@scene-change)
@scene-change background time=1500ms fades out (@mask) → hides all sprites (@chara-hide-all) → changes the background (@bg) → fades back in (@mask-off), all in one command.
Set the fade-out and fade-in time with time (or separately with fade-out and fade-in), the time to stay covered with hold, and the fade color with color. If you omit the background, it only hides the sprites.
By default, the message window is hidden as soon as the fade-out starts and shown again with the next text (so the previous text isn’t seen during the fade in; hide-window=false keeps it shown).
The hidden previous text isn’t shown again, so even if @window show right after brings the window back, it’s empty, and in NVL the next text starts on a new page (the same goes for @mask and @bg hide-window=true).
@scene-change backgrounds/street_night.png time=1500ms hold=100ms
@scene-change time=1000ms hold=500ms hide-chara-at=start hide-fade=300ms
@scene-change time=1000ms hide-who=Yuika hide-chara-at=start hide-fade=300ms
@scene-change hide-chara=false hide-window=false
@scene-change backgrounds/office.png stop-bgm=true bgm-fade=300ms
@scene-change backgrounds/beach.png bgm=summer.ogg
@scene-change bg-color=#000000 time=800ms
-
For a solid background, write a color instead of a picture (
@bg color=#000000,@scene-change bg-color=#ffffff). You don’t need a black or white image, and saves keep it as a color (load and rewind bring back the same color). Don’t write a picture and a color together (redundant-param).@bgneeds one of them (missing-param). -
With
hide-chara-at=start, the sprites start to disappear as soon as the fade-out starts. If it’s omitted (covered), they start once the screen is fully covered.hide-fadeis the time the sprites take to disappear, separate from the fade-out and fade-in time (time).hide-who=Yuikahides only that character; without it, everyone is hidden.hide-chara=falsekeeps everyone. It doesn’t wait for the sprites to finish disappearing; that runs alongside the fade-out and fade-in. The old namehide-atstill works, but don’t write both. -
By default, the message window and the quick menu buttons are hidden as soon as the fade-out starts.
hide-window-at=coveredhides them once the screen is fully covered, andhide-window=falsedoesn’t hide them. -
To stop the BGM behind the fade, write
stop-bgm=true; to change it,bgm=track(looping; the volume isbgm-volume, default 100). Both start once the screen is covered and fade over thebgm-fadetime (default 0ms). Writingbgmreplaces the current track, so don’t write it together withstop-bgm(redundant-param). To set the volume or loop points, write a separate@bgm. -
The state (save, rewind, load) is how things look after the fade in; what happens in between isn’t kept. While skipping, it takes no time.
-
Where the screen is already fully faded out (such as at the top of a file reached by
@jumpafter@maskat the end of the previous file), it doesn’t wait for the fade-out time (timeorfade-out); it hides the sprites, changes the background, and fades in. -
If the background image is a CG in the extras, it’s unlocked (same as
@bg). -
It isn’t named
sceneso that it doesn’t clash with scene-change macros that projects wrote themselves (such as@define scenein the earlier template) (existing project macros keep working too). The current template uses@scene-change, with the fade time set incommandDefaults(below). -
A fade time for the whole project can be set in
scene-changeincommandDefaults(below) ("scene-change": { "time": "1500ms", "hold": "100ms" }). -
lim backportwrites it back as the sequence[mask][chara_hide_all][bg][mask_off]in .ks (holdbecomes thetimeof[bg], or[wait]when the background is omitted; BGM becomes[stopbgm]or[playbgm]right after[mask]).
Scene breaks
Things that shouldn’t interrupt the middle of a conversation or the moment right after an emotional peak, such as notifications (@notify when=scene-break), are held and shown at a scene break.
A scene break is the point where the running game has passed one of the following.
| Break | What it covers |
|---|---|
@scene-change | Including one without a background (one that only hides the sprites) |
| Changing the background | When @bg shows a picture different from the current one (showing the same picture again isn’t a break). Also when a plugin command changes the background |
| Fade to black | @mask |
| Changing files | When @jump or a choice (including default when time runs out) moves to another file. Chapters (chapters) are groups of files, so chapter breaks are included here. @call and @return, and moves by plugin commands (ctx.runtime.jump, callScene), aren’t breaks |
Sou "...Found it."
@notify "A new page was added to the notebook" kind=success when=scene-break
Akari "What is it, all of a sudden?"
@scene-change hill_night.webp
// ↑ After the fade in, the notification appears before the next text
- What’s held is shown after the break has been passed, before the first text or choice is shown (not during the fade out or fade in). Something held after a break waits until the next break.
- What’s waiting is kept in the save (
stage.sceneWait). It isn’t lost when you save and load while it’s waiting, and it isn’t in saves of pages after it was shown, so loading doesn’t show it twice. The same goes for the states kept by rewind and@sleep-game. - If the playthrough ends without passing a break (
@title-screenand so on), what was waiting isn’t shown. - Plugin commands can hold things the same way with
ctx.atSceneBreak(args)(instead ofctx.present) (docs/plugins.md).
Project command defaults (commandDefaults)
Write command name → parameter name → value (in .lim syntax: "400ms", "true", "default") in commandDefaults in liminalia.json,
and that value is used for parameters omitted in the scenario. It applies to both built-in and plugin commands.
"commandDefaults": { "chara": { "time": "400ms", "appearance": "default" }, "bg": { "time": "1s" } }
- A parameter you write always uses that value; writing
time=0ms, for example, takes priority over the default. - You can set them for
@definemacros too ("scene": { "time": "1500ms" }). Only parameters that have a default can be set (parameters without one are required, so they can’t be). Values are checked against the type (durationand so on). - If you set a default for a parameter that “keeps the current value when omitted” (
appearance,atand others of@chara), that value is used when it’s omitted too (the current value isn’t kept). - Changing the default of
waitalso changes whether that command waits for its effect to finish (in Studio’s timeline too). - Unknown commands, unknown parameters, required parameters, expressions and type errors are reported by the syntax check as
liminalia.jsonerrors (bad-command-defaults), and those values aren’t used. Sprite sets, variants and positions that aren’t written in the scenario are checked against the character definitions as values set by the defaults. lim reference <project>, completion and the parameter panel in Studio, and completion in VS Code show these values as the defaults (lim referencealso shows the standard default). In Studio, you can edit them in “Command defaults” in “Game settings” (they’re saved right away, and the preview runs with the new defaults from the next “New Game” or load).lim backportwrites the defaults into omitted parameters before writing back to .ks (values set by the defaults are written into the .ks tags, so TyranoScript behaves the same; macro calls too).
Waiting for effects
The default of wait depends on the kind of command. If you write wait=, that takes priority.
| Kind | Default | Commands |
|---|---|---|
| Building the scene (backgrounds, images, the whole screen, camera, shaking, movement) | Waits | @bg @scene-change @image @free-image @transition @mask @blend @camera @quake @chara-move and others |
| Showing and hiding sprites, expressions | Doesn’t wait | @chara @chara-hide @chara-hide-all |
| Repeating motion, overlaid video | Doesn’t wait | @anim @kanim @blend-movie |
| Sound | Doesn’t wait | @bgm @se @voice (to wait, use @wait-bgm @wait-se @wait-voice) |
Sprites usually change together with the dialogue, so they don’t wait. Changes to the background or the whole screen finish before the text appears.
The default for each command is under wait of that command in commands.md (commands that wait but have no wait say that they wait until they finish).
Skipping effects with a click
While the game waits for an effect that takes time, a click (or the Enter key, or a tap) by the player skips the running effect to its end state.
- What can be skipped: background and sprite changes, fading to black (
@mask), the camera, shaking, rule transitions, color tone and depth of field, the wait of@wait, and the effects of project commands (commands that have a time parameter and wait for their end). Until that command finishes drawing, motions that start after it (such as the second half of a sprite change that disappears and then reappears) also end at once. Other effects running without waiting (sprites withwait=falseand so on) end along with it. - What can’t be skipped: sound (it keeps playing), repeating motion, choices on screen, commands that wait for sound such as
@wait-bgm, and screens waiting for input. - One click skips only the effect being waited for at that moment. Click again for the next effect.
- For a command that shouldn’t be skipped, write
skip=false(the same name asskipof@movie;@movieisn’t skippable by default). To turn it off for the whole game, setui.input.skipEffects: falsein liminalia.json. @moviecan be skipped with a click even withskip=falseif the movie has been watched to the end once (the variablemovies_watched, shared by all saves), the same idea as read text. To exclude a single movie, writeskip-seen=false; to exclude them in the whole game, write"skip-seen": "false"undermovieincommandDefaults.- A skippable
@movie(skip=true, or a watched movie as above) ends with a click (the confirm key or a tap), doesn’t play while skipping, and ends if skipping starts while it plays. A@moviethat can’t be skipped plays even while skipping (the same as TyranoScript). To make movies skippable in the whole game, write"skip": "true"undermovieincommandDefaults. During the development fast-forward (?skip=N) and automated checks (lim playtest,lim shot), even movies that can’t be skipped don’t play. - While skipping, effect durations are 0 even if you don’t write anything (chapter 3).