TyranoScript import
On this page
A list of how lim import (packages/ks-import) handles common tags other than sprites and visual effects.
TyranoScript’s actual behavior is recorded in tyrano-semantics.md.
The import records where in the .ks files each line of the written .lim came from, in a source map (import-sourcemap.json).
Writing changes back to .ks after .lim has become the source of truth is covered in tyrano-backport.md.
Making a new project from a TyranoScript project
Choose A TyranoScript or TyranoBuilder project under Start from in New Project on the start screen of the desktop app, or run lim new <folder> --from-tyrano <TyranoScript project>,
to make a new project with a one-time import (createFromTyrano in packages/cli/src/commands/import.ts).
When you choose a TyranoScript project (a folder with .ks files in data/scenario; choosing data or data/scenario also works) with Open Project, the desktop app also asks
whether to import it into a new project (tyrano in packages/studio-desktop/src/shared/folder.ts).
- A blank project is made, and the title and screen size are read from
data/system/Config.tjs(System.title,scWidth,scHeight) first.ksandtitle_screen.ksaren’t imported (Liminalia’s own startup and title screen are used). A[jump]without a condition to either of them becomes@title-screenentryinliminalia.json(New Game) is where the first[jump storage=…]after*startintitle_screen.ksgoes (the first jump if there’s no*start), or where the first jump infirst.ksgoes if there’s notitle_screen.ks. If neither is known, it’s the first script- Assets are copied from
bgimage,fgimage,image,bgm,sound,voice,videoandothersindatato the folders with the same names in the asset folder (notothers/plugin; only files with extensions in the media table; files already there aren’t overwritten; on APFS and similar, the copies share their contents) import.tyranoisn’t written (you keep editing the .lim files). The source, New Game and the asset results are added at the end of the report (import-report.md)- With
--cionlim new, it adds, as for a blank project, the GitHub Actions check template (.github/workflows/liminalia-check.yml; ci.md) and a test that checks the game runs from start to end (tests/start.limtest) - The desktop app opens the new project, then shows a summary and lets you open the report (as a page the default browser can read)
For a project with import.tyrano (one where you keep writing in TyranoScript and import again), lim import --assets also copies the assets (with the same rules as above).
Files that are imported
The .ks files under data/scenario are imported as the story. A .ks file in a subfolder becomes a .lim file whose name includes the folder
(data/scenario/part1/chapter2.ks becomes part1/chapter2.lim, and a jump to it is @jump part1/chapter2#label. These are the same names as in the engine’s list of scenarios).
The following aren’t imported (they’re listed under “変換しないファイル” (files not converted) in the report, which is in Japanese).
- Files under
system/(engine settings and macros; the macros are gathered into@define), and generated files whose names start with_ - Files listed in
skipFilesin the import settings (the path fromdata/scenariowithout the extension: just the name for a file directly inside it, or something like"part1/menu") - .ks files in subfolders that are only reached by
[call]or[jump]from files inskipFiles(system-side files, such as data loaded by the title screen or a notebook screen)
Writing back (lim backport) also writes a .lim file in a subfolder back to the .ks file at the same path. A newly added .lim file in a subfolder becomes a new .ks file at the same path.
Rather than replacing each tag one-to-one with a command, anything that existing .lim syntax can express is converted to that syntax. Tags fall into three categories.
- (a) Converted to existing syntax
- (b) New commands or syntax were added (specified in commands.md and format.md)
- (c) Not handled by this engine. They aren’t written, and a diagnostic with the reason is given instead. Tags whose loss changes the meaning need manual work (an
unsupported-tagerror, and “手作業が必要な箇所” (places that need manual work) in the import report). Tags that don’t change the flow when left out, such as appearance settings, give a warning. The report’s “このエンジンでは扱わないタグ” (tags this engine doesn’t handle) section shows how many there are and why.
Text
When the text of a speaker (#name) starts with 「 『 ( (, it becomes Name「…」, and when it starts with an English quotation mark " “, it becomes Name "…" (English dialogue; writing it back gives #name and text that starts with the quotation mark again).
Text that starts with none of these becomes narration, with a warning (speaker-without-bracket).
| Tag | Category | .lim |
|---|---|---|
[emb exp=…] | a | {= expr} |
[ruby text=…] | a | {r char|reading} on the next single character (ruby: small reading aids above characters) |
[er] [ct] | a | @clear (also resets [font] styling) |
[font] [resetfont] | a, b | Bold, italic and color become {b …} {i …} {c color …}, and size becomes the new {size px …}. Styling that continues across lines is reopened on each line (so each line is complete on its own). face, edge, shadow, gradient and effect aren’t converted (warning) |
[mark] [endmark] | b | {mark color …} |
[nowait] [endnowait] | a | {speed 0ms …} if it closes on the same line. If it spans lines, @text-speed 0ms and then the original speed (@text-speed … / @text-speed-reset) |
[lr] (TyranoBuilder) | a | {click}{br} |
[hidemessage] | b | @peek |
[deffont] | c | The default look of characters is set with the text’s appearance (TextTheme) or CSS (warning) |
[position] [message_config] | c | [position vertical=true/false] becomes @vertical on/off. The position and look of the message window are set in ui.message in liminalia.json (warning) |
[glyph] [glyph_auto] [glyph_skip] | c | The click-wait icon is TextTheme.glyph, and the marks shown during auto mode and skipping belong to the system screens (warning) |
[graph] | c | Images aren’t placed inside the text (manual work) |
Waiting
| Tag | Category | .lim |
|---|---|---|
[wbgm] [wse] | b | @wait-bgm @wait-se |
[wt] [wa] | — | As visual effects, these are converted to @liminalia/std commands by the standard command mapping (packages/ks-import/src/std-tags) (paired with [trans] they become @transition, and [wa] waits for the motion to finish). Without the standard mapping (when STD_IMPORT isn’t layered onto the import settings), a warning with the reason says to wait with wait=true on that command |
[wb] [wait_cancel] | c | There’s no mechanism for waiting on events, or for stopping @wait from the scenario (warning). @wait and effects jump to their end when the player clicks (TyranoScript’s [wait] doesn’t. To match it, set ui.input.skipEffects: false in liminalia.json, or skip=false for just that command) |
Macros and conditions
| Tag | Category | .lim |
|---|---|---|
[macro] … [endmacro] | a | @define (“Macros” below) |
[erasemacro] | c | @define can’t be removed (manual work) |
[ignore exp=…] … [endignore] | a | @if !(expr) … @end |
[plugin name=…] | a | Not written. Macros in init.ks are gathered into @define. The plugin’s JS is reported as manual work (plugin-js) |
[html] … [endhtml] (HTML only) | b | @html name x=left y=top … @end. The lines inside are copied as they are (lim check reports tags and attributes that can’t be used) |
[html] … [endhtml] (with JS or other tags) | c | Not converted if it contains <script>, on… attributes, javascript: or tags (such as [emb]) (manual work). Remove the JS and rewrite it with @html, or make it with a plugin |
[loadjs] [loadcss] | c | JS and CSS aren’t used as they are. Make it with a plugin (commands with @liminalia/sdk and rendering with @liminalia/sdk/web) (manual work) |
[trace] | c | Output for development. Follow the flow with lim trace (warning) |
Choices and input
| Tag | Category | .lim |
|---|---|---|
[link] … [endlink] and [s] | a | @choice. The text before it (the question) becomes one line ending in {noclick}, so the choices appear without waiting for a click. A [r] at the end of the question stays as {br} (writing back turns it into [r] again. The choices appear outside the message window, so it looks the same). [r] between the choices is removed |
[button] (fix=false, no role) and [s] | b | Image choices in @choice (- -> target image=… hover=… x=… y=…) |
[button fix=true] | b | @hud-button name image=… hover=… x=… y=… call=target (shown while playing; pressing it calls the scene, and the page is shown again when it returns). The name is name, or the image’s name if there’s none. cond= is checked only once, when the button is placed, so the line is wrapped in @if. exp and so on aren’t converted (lossy-param) |
[clearfix] | a | @hud-button-off (with that name if there’s name=) |
[button role=…] | c | Buttons for system features are made with the system screens (ui.menuBar or a plugin’s system) (manual work) |
[clickable] and [s] | b | Clickable areas in @choice (- -> target x=… y=… width=… height=…) |
[locate] | a | Used as the position of the next [button] or [clickable] (not written) |
cond= on [glink] [link] [button] [clickable] | b | if=(expr) on that choice’s line (the choice isn’t shown when it’s false; it isn’t wrapped in @if). The expression is converted the same way as in [if]. If it can’t be converted, the choice is written without the condition and needs manual work (manual-cond) |
[glink_config] | c | How choice buttons are arranged and appear is set with CSS (warning) |
[edit] [commit] | b | @text-input variable (waits until the player confirms). A text field paired with a single confirm button becomes @text-input and @jump, and [commit] isn’t needed |
[dialog] | b | @dialog "text" type=alert|confirm|input target=… cancel-target=… variable=… |
[cursor] | c | The look of the mouse cursor is set with CSS (warning) |
Requests to the system screens
Commands that ask the system screens to do something from the scenario. The runner only notifies the renderer, and the system screens (SystemController.request) handle the request.
If they don’t, the renderer’s minimal default behavior applies (packages/web/src/play.ts).
| Tag | Category | .lim |
|---|---|---|
[autostart] [autostop] | b | @auto start / @auto stop |
[skipstart] [skipstop] [cancelskip] | b | @skip start / @skip stop |
[showsave] [showload] [showlog] [showmenu] | b | @open-screen save|load|log|menu (waits until it closes) |
[showmenubutton] [hidemenubutton] | b | @menu-button show|hide |
[start_keyconfig] [stop_keyconfig] [tb_keyconfig] | b | @shortcuts on|off |
[autosave] [autoload] | b | @autosave @autoload |
[nolog] [endnolog] [pushlog] | b | @backlog off|on @backlog-add "text" join=… |
[configdelay] [autoconfig] | b | @config text-speed=… auto-wait=… auto-click-stop=… |
[screen_full] [close] [title] [web] | b | @fullscreen @quit ask=… @window-title "…" @open-url "…" |
[speak_on] [speak_off] | c | Players turn reading the text aloud on and off with “Read aloud” in Settings. The scenario doesn’t switch it (warning) |
Sound
| Tag | Category | .lim |
|---|---|---|
[fadeoutbgm] | a | @stop-bgm time=… (times shorter than 100ms become 100ms) |
[fadeinse] | a | @se … time=… |
[xchgbgm] | a | @bgm … time=… (time on @bgm also fades out the previous BGM over the same time) |
[pausebgm] [resumebgm] [pausese] [resumese] | b | @pause-bgm @resume-bgm @pause-se channel=… @resume-se channel=… |
[changevol] | b | @bgm-volume volume time=… / @se-volume volume channel=… time=… (the volume is 0 to 100) |
[bgmopt] [seopt] | b | volume becomes the Config volume, @config bgm-volume=…, and tag_volume becomes the volume of the sound that’s playing, @bgm-volume … |
[voconfig] [vostart] [vostop] | b | @voice-auto name pattern=… next=… folder=sound start=false / @voice-auto / @voice-auto-off (name is the name shown in the name box. {number} becomes {n}. sebuf isn’t converted) |
Variables and run state
| Tag | Category | .lim |
|---|---|---|
[clearvar] | b | @clear-vars all |
[clearvar exp=f.x] | a | @set game.x = null |
[clearsysvar] | b | @clear-vars system |
[clearstack] | b | @clear-stack (stack=if and anim have no meaning here, so they aren’t written) |
[sleepgame] [awakegame] [breakgame] | b | @sleep-game target @awake-game keep-variables=… keep-bgm=… @break-game |
[checkpoint] [rollback] [clear_checkpoint] | b | @checkpoint name @rollback name keep-variables=… keep-bgm=… @clear-checkpoint |
[sleepgame] can be expressed with the runner’s state. @sleep-game keeps the current state (the position, local variables, @call return points, game. and the screen)
in sleep in the save data and jumps to the target, and @awake-game restores it and rebuilds the screen. The state is kept separately rather than pushed onto the call
stack so that, as in TyranoScript, the game returns entirely to the kept point whatever happens during the detour (even with nested @calls).
@checkpoint uses the same mechanism and keeps a state for each name in checkpoints. Both are part of the save data, so you can return even if you save or load during the detour.
TyranoBuilder macros
| Tag | Category | .lim |
|---|---|---|
[tb_ptext_show] [tb_ptext_hide] | — | As visual effects, these are converted to @liminalia/std commands by the standard command mapping (packages/ks-import/src/std-tags). Without the standard mapping, they’re expanded into [ptext] on layer=2 ([mtext] if anim=true) and [freeimage] |
[tb_keyconfig] | b | @shortcuts on|off |
[tb_replay id=…] | b | @replay-unlock id and @awake-game (it only returns when the game is on a detour as a replay) |
[tb_replay_start] | c | The cleanup at the start of a replay is done by the system screens when they start the replay (warning) |
[tb_replay_image_button] [tb_cg_image_button] | c | Gallery buttons are made with the system screens (manual work) |
[tb_cg storage=…] | a | @cg-unlock image. A [tb_cg] for an image listed in extra.cg in the project’s liminalia.json (or in an extra.cgAuto folder) isn’t written when it’s in the same run as the [bg] that shows that image (with only tags in between), because showing the image with @bg unlocks it. The import report shows how many there are, and writing back keeps these [tb_cg] tags |
[tb_fuki_start] [tb_fuki_stop] | c | Speech balloons are made with TextTheme (manual work) |
[lr] | a | {click}{br} |
Macros
[macro] … [endmacro] becomes @define. The import gathers macros from the story files, from under data/scenario/system/, and from the init.ks of plugins loaded with [plugin] and [call],
puts them in one file (macros.lim by default), and writes @use macros at the top of each file that calls a macro.
TyranoScript macros can be called from anywhere once they’re defined, so .lim also keeps them in one place. When convert is used on a single file only,
that file’s macros become @define in that file.
- The parameters are the
%nameandmp.nameused in the body, plus, for macros that use*, the names the callers pass. - A parameter’s type is decided from the type of the command parameter it’s passed to (a duration for
[wait time=%t], a boolean for[chara_hide wait=%w]). Since some values are passed from macro to macro, this is repeated until no type changes. If the type can’t be decided, it’s a string. - Every macro parameter in .ks can be omitted (an omitted one becomes an empty string), so every
@defineparameter gets a default too: the default from%name|default, otherwise the default of the command parameter it’s passed to, otherwise the empty value for its type (""0false0ms#000000). _in parameter names becomes-(first_name→first-name). Expressions inside the body refer to it by the name with-turned back into_({= first_name}).%namebecomes(name),mp.namebecomesname, and[emb exp=mp.name]becomes{= name}.*passes all of the macro’s parameters to that tag.- A jump target in the body that leaves out the file (
[jump target=*x]) is a label in the file where the macro is written (TyranoScript runs a macro in that file). - A call such as
[greet who=Ren]becomes@greet who=Ren. Parameter values are written in the@definetype (300msfor a duration). &exprand%namebecome(expr)in the parameters of any tag, even outside macros. Outside a macro,%name|defaultbecomes the default (since there are no parameters).
Not converted (reported with the reason):
| Diagnostic | Meaning |
|---|---|
macro-direct (info) | A macro with the same name as a tag the conversion handles directly (such as TyranoBuilder’s tb_*). It doesn’t become @define, and calls use the direct conversion |
macro-shadowed (info) | A macro with the same name as a TyranoScript tag. TyranoScript doesn’t call it either |
macro-redefined | There are several macros with the same name and different bodies. The first one found is used (system/ and plugins are searched first) |
macro-name macro-param-name | A macro name or parameter name that can’t be a .lim name |
macro-label | A label inside a macro (labels can’t go inside @define, so it can’t be jumped to) |
manual-script | [iscript] inside a macro (JS that uses mp) |
manual-entity | &expr or %name used where it can’t be written as an expression (such as a jump target) |
entity-dropped (warning) | The value of &expr or %name wasn’t used by the conversion (for example, the conversion only used it for a comparison) |