Templates:

What are templates?

Templates are how KM3 interprets each syllable in a line and are the most important part of KM3. Templates are designed with only one syllable in mind and then applied to all syllables to form a complete karaoke line.

How do I declare a template?

Like with Events, just add "Template" followed by the name you wish to give it (in the following example it's "blank") and finally "{}" to the script.

Template blank {}

The following shows each property set to its default value.

Template blank {
   template = [s];
   start = ; // Default value is empty.
   end = ; // Default value is empty.
   linemode = 0 (sl);
   pause = ; // Default value is empty.
   flags = 0;
   clip = ; // Default value is empty.
}

You can also pass parameters to templates allowing you to use the same template with different values.

Template notblank (param1, param2) {
   template = [param1][s][param2];
}

Parameters are used just like the other tags and as such should be given unique names. Their values can be set in the Run section of the script.

What properties are there?

  -template (Template)
  -start (Start Tags)
  -end (End Tags)
  -linemode (Line Mode)
  -pause (Pause Tags)
  -flags (Flags)
  -clip (Clipping)



template (Template)

The template property specifies the template to apply to each syllable.

Use:

template = string;

Examples: (Using the first 3 syllables of the line "{\k28}ka{\k33}ze {\k44}ga {\k22}i{\k23}ro {\k26}ni {\k22}na{\k23}t{\k67}te" with a default Event.)

"{\bord1}{\t("[0]","[0]",\bord3)}"[s] = {\bord1\bord3}ka{\bord1}{\t(280,280,\bord3)}ze {\bord1}{\t(610,610,\bord3)}ga

The two KM3 tags used in this basic example are "[s]" and "[integer]". You may have noticed I surrounded normal text with quotes. This is to ensure the parser doesn't mistake any brackets as part of the script or other tags.

start (Start Tags)

The start tags property specifies a string to add at the start of the line.

Use:

start = string;

end (End Tags)

The end tags property specifies a string to add at the end of the line.

Use:

end = string;

linemode (Line Mode)

The line mode property specifies the way the script should divide a line up.

Use:

linemode = integer {0, 1, 2};
linemode = string {sl, lps, lpc};

sl = single line
lps = line per syllable
lpc = line per character

When the line mode is set to "0" or "sl" all syllables will be on the same line. When the line mode is set to "1" or "lps", each syllable will get its own line allowing you to horizontal grow effects without moving the other syllables. Finally when the line mode is set to "2" or "lpc" each individual character gets its own line.

pause (Pause Tags)

The pause tags property specifies what to do when there is a pause in the timings. A pause being a timing with no syllable such as the first timing in "{\k30}{\k28}ka". If in single line mode the pause string will be added to the line; otherwise it will just read the tags and execute any procedures associated with them.

Use:

pause = string;

flags (Flags)

The flags property specifies certain attributes and condtions to consider when processing the template.

Use:

flags = 0 / flags = none; // Normal state; no flags are set.
flags = 1 / flags = removetags; // Removes all ASS tags except karaoke tags from the line.
flags = 2 / flags = removespecial; // Removes all special characters from the line. Special characters are "\N", "\n", and "\h".

You can set more then one flag by seperating them with an "|".

flags = removetags | removespecial

clip (Clipping)

The clipping property enables automatic clipping, allowing you to make gradients and / or patterns on your lines.

Use:

clip = (integer x1,integer y1,integer x2,integer y2);
clip = (integer x1,integer y1,integer x2,integer y2,integer orientation {0, 1, 2});
clip = (integer x1,integer y1,integer x2,integer y2,string orientation {horizontal, vertical, both});
clip = (integer x1,integer y1,integer x2,integer y2,integer orientation {0, 1, 2},integer width);
clip = (integer x1,integer y1,integer x2,integer y2,string orientation {horizontal, vertical, both},integer width);
clip = (integer x1,integer y1,integer x2,integer y2,integer orientation {2},integer width,integer height);
clip = (integer x1,integer y1,integer x2,integer y2,string orientation {both},integer width,integer height);

Example Script:

Event main {}

Template cliptest {
   template = [s];
   start = "{\clip(" [clip.x1] "," [clip.y1] "," [clip.x2] "," [clip.y2] ")}";
   clip = (0, 16, 640, 75, horizontal, 2);
   // Your line has to appear within the coordinates of the clip rectangle to be seen.
}

Run {
   main.cliptest();
   break();
}