This page describes the inline variables also known as dollar variables available in Karaoke Templater.
All inline variables start with a dollar-sign. They only work in template lines, not in code lines. You can, however, use them in code blocks on template lines.
Here is an example of how a template text using inline variables could look:
{\pos(**$x**,**$y**)\t(**$start**,**$end**,\bord0)}
The highlighted parts are the inline variables in the template.
When a template is applied, the first thing that happens is that all inline
variables are found and replaced with their value. E.g. in the above example
$x
and $y
are replaced with the X and Y coordinates of the syllable the
template is being applied to, and $start
and $end
are replaced by the start
and end times of the syllable.
Case does not matter for inline variables. $start
, $START
and $StArT
all
work and give the same result.
Inline variables are not "intelligent": they do the same no matter where you place them or use them and don't "know" what tag it's being used with. Not every variable can be used with success in all places, and the meaning of some are affected by usage of e.g. the retime function. In these cases, inline variables may not be appropriate and you need to use code blocks.
Because inline variables have their values determined as the very first thing when a template is applied you can't affect their values in any way.
Using inline variables is an easy way to get started with an effect, but for many advanced effects they might not be the best choice.
All positioning and sizing inline variables (such as $y
, $right
and
$width
are rounded to the nearest whole pixel, unlike the values in the
internal data structures which you can get in code blocks, which have sub-pixel
precision.
The inline variables exist in both "line" and "syllable" variants. The "line" variants contain information about the entire line being processed, the "syllable" variants contain information about the current syllable being processed.
There are also "automatic" variants of most of the variables, there are either the line or the syllable variant depending on what kind of template they are used in. In pre-line templates the automatic inline variables refer to the line variants, and everywhere else they refer to the syllable variants.
The line variables that also exist as automatic variants all start with a lowercase L ("ell") letter. The syllable variants start with the letter S.
Overview: | Automation Manager • Running macros • Using export filters • Standard macros |
---|---|
Karaoke Templater reference: | Declaring
templates • Execution
order • Modifiers • Inline-variables ($-variables)
Code lines and blocks • Execution envirionment |
Lua API reference: | Registration • Subtitles object • Progress reporting • Dialogs • Misc. APIs |
Lua Modules: | karaskel.lua • util • unicode • cleantags.lua • clipboard • re |
Karaskel concepts: | Style tables • Dialogue line tables • Syllable tables • Inline effects • Furigana |