2006-01-16 22:02:54 +01:00
-- Aegisub Automation demonstration script
-- Original written by Niels Martin Hansen
-- Given into the public domain
name = " Karaoke skeleton demo "
description = " This script demonstrates the use of the karaskel.lua include file, to avoid writing almost identical code for every karaoke effect script. "
version , kind , configuration = 3 , ' basic_ass ' , { }
2006-07-11 00:07:24 +02:00
-- Include the "magic" karaskel.lua file. It also includes utils.lua for you.
-- karaskel.lua defines the process_lines function, so you'll usually not have to write that yourself
2006-01-16 22:02:54 +01:00
include ( " karaskel.lua " )
2006-07-11 00:07:24 +02:00
-- Instead, a do_syllable function is written. This is called by karaskel for every syllable, to get the text replacement for that syllable.
2006-01-16 22:02:54 +01:00
function do_syllable ( meta , styles , config , line , syl )
2006-07-11 00:07:24 +02:00
-- First check if it's the first syllable on the line; if it is don't bother doing anything special
2006-01-16 22:02:54 +01:00
if syl.i == 0 then
2006-07-11 00:07:24 +02:00
-- Remember you have to return the text of the syllable as well as any formatting tags you want
2006-01-16 22:02:54 +01:00
return syl.text
else
2006-07-11 00:07:24 +02:00
-- For other syllables, apply a little effect
2006-01-16 22:02:54 +01:00
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 )
end
end
2006-07-11 00:07:24 +02:00
-- Exercise for the reader: Rewrite this script in "classic style", ie. the same way as demo 6.
-- See how few lines you can get it down to, while still producing the same effect.