1
-- Aegisub Automation demonstration script
2
-- Original written by Niels Martin Hansen
3
-- Given into the public domain
5
name = "Karaoke skeleton demo"
6
description = "This script demonstrates the use of the karaskel.lua include file, to avoid writing almost identical code for every karaoke effect script."
7
version, kind, configuration = 3, 'basic_ass', {}
9
-- Include the "magic" karaskel.lua file. It also includes utils.lua for you.
10
-- karaskel.lua defines the process_lines function, so you'll usually not have to write that yourself
11
include("karaskel.lua")
13
-- Instead, a do_syllable function is written. This is called by karaskel for every syllable, to get the text replacement for that syllable.
14
function do_syllable(meta, styles, config, line, syl)
15
-- First check if it's the first syllable on the line; if it is don't bother doing anything special
17
-- Remember you have to return the text of the syllable as well as any formatting tags you want
20
-- For other syllables, apply a little effect
21
return string.format("{\\r\\k%d\\t(%d,%d,\\1c&H%s&)}%s", syl.duration, syl.start_time, syl.end_time, line.styleref.color2, syl.text)
25
-- Exercise for the reader: Rewrite this script in "classic style", ie. the same way as demo 6.
26
-- See how few lines you can get it down to, while still producing the same effect.