From Aegisub Wiki
-- Aegisub Automation script
-- Original written by Ivan Tanev aka Crafty_Shadow
--Requires this style in the .ass file to work:
--Style: heart,Arial,40,&H00191AE3,&H0000FFFF,&H00000000,&H00000000,0,0,0,0,100,100,0,0,1,0,0,2,10,10,10,0
name = "Mamoru Opening"
description = "Mamoru op with HEARTS :)"
configuration = {}
version, kind = 3, 'basic_ass'
-->--includes and global variables
include("karaskel-adv.lua")
br=0
time=1
--<--end include
function do_syllable(meta, styles, config, line, syl)
-->>FUNCTION FOR RESULT PARSING>>--
local result = {n=0}
function result.add() local l = copy_line(line); table.insert(result, l); return l end
--<<FUNCTION FOR RESULT PARSING<<--
-->--check for empty line
if syl.text == "" then
return { n=0 }
end
if syl.text == " " then
return { n=0 }
end
--<--end check
-->-- x and y coordination definition
local x=syl.center + line.centerleft
local y=line.styleref.margin_v + 13
--<-- end def
-->--check if a new line has started, and zero the counter if it has; increase the counter
if time ~= line.start_time then
time=line.start_time
br=-1
end
br=br+1
--<--end of check
--Check the line for . , " and don't apply effect if it's one of then
if (syl.text_stripped == ".") then elseif (syl.text_stripped == ",") then elseif (syl.text_stripped == "\"") then else
--hearts spin intro
l=result.add()
l.style = "heart"
l.text = string.format("{\\an5\\org(%d,%d)\\pos(%d,%d)\\fry90\\t(\\fry360)}{\\p1}m -4 -9 b -3 -9 -4 -9 -4 -9 b -4 -9 -4 -9 -4 -9 b -9 -13 -12 -11 -13 -9 b -15 -6 -11 -1 -8 2 b -8 2 -6 4 -4 6 b -2 4 0 2 0 2 b 3 -1 7 -6 5 -9 b 4 -11 1 -13 -4 -9 {\\p0}",x,y+13,x+15,y+14)
l.start_time = line.start_time -65 +br*10
l.end_time = line.start_time + br*10 -15
l=result.add()
l.style = "heart"
l.text = string.format("{\\an5\\org(%d,%d)\\pos(%d,%d)}{\\p1}m -4 -9 b -3 -9 -4 -9 -4 -9 b -4 -9 -4 -9 -4 -9 b -9 -13 -12 -11 -13 -9 b -15 -6 -11 -1 -8 2 b -8 2 -6 4 -4 6 b -2 4 0 2 0 2 b 3 -1 7 -6 5 -9 b 4 -11 1 -13 -4 -9 {\\p0}",x,y+13,x+15,y+14)
l.start_time = line.start_time + br*10 -15
l.end_time = line.start_time + syl.start_time/10
--finish hearts spin intro
end
--sylls spin in intro
l=result.add()
l.text = string.format("{\\an5\\pos(%d,%d)\\fry270\\t(\\fry360)}%s",x,y,syl.text_stripped)
l.start_time = line.start_time -28 +br*1
l.end_time = line.start_time + br*10 -15
--sylables after intro, and before effect
l=result.add()
l.layer=10
l.text = string.format("{\\an5\\pos(%d,%d)}%s",x,y,syl.text_stripped)
l.start_time = line.start_time +br*10 -15
l.end_time = line.start_time + syl.start_time/10
--sylables effect
l=result.add()
l.layer=11
l.text = string.format("{\\an5\\pos(%d,%d)\\t(0,30,\\fscx140\\fscy160\\1c&HFDF0EE&\\3c&HFFFFFF&)\\t(30,%d,\\3c&H000000&\\fscx100\\fscy100\\alpha&HFF&)}%s",x,y,syl.duration*10+200,syl.text_stripped)
l.start_time = line.start_time + syl.start_time/10
l.end_time = line.start_time + syl.start_time/10 + syl.duration + 20
--Make hearts fly about
for i=0,30 do
l = result.add()
l.style = "heart"
l.layer=0
l.text = string.format("{\\an5\\move(%d,%d,%d,%d)\\alpha&H80&\\fscx65\\fscy65\\t(\\alpha&HF7&\\fscx20\\fscy20)}{\\p1}m -4 -9 b -3 -9 -4 -9 -4 -9 b -4 -9 -4 -9 -4 -9 b -9 -13 -12 -11 -13 -9 b -15 -6 -11 -1 -8 2 b -8 2 -6 4 -4 6 b -2 4 0 2 0 2 b 3 -1 7 -6 5 -9 b 4 -11 1 -13 -4 -9 {\\p0}", x+math.random(-8,8)+15, y+math.random(-8,8)+10, x+math.random(-40,10)+15, y+math.random(-15,30)+10, syl.text)
l.start_time = line.start_time + syl.start_time/10
l.end_time = line.start_time + syl.start_time/10 + syl.duration + i*4
end
return result
end