Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as Lua by Ace ( 15 years ago )
include("karaskel.lua")


script_name = "Usagi_OP"

script_description = "Taka tam zabawa"

script_author = "Sir_Ace"

script_version = "0.5"




function KARA(subs)



 aegisub.progress.task("Getting header data...")

 local meta, styles = karaskel.collect_head(subs)

 

 aegisub.progress.task("Applying effect...")

 local i, ai, maxi, maxai = 1, 1, #subs, #subs

 while i <= maxi do

  aegisub.progress.task(string.format("Applying effect (%d/%d)...", ai, maxai))

  aegisub.progress.set((ai-1)/maxai*100)

  local l = subs[i]

  if l.class == "dialogue" and

    not l.comment then

   karaskel.preproc_line(subs, meta, styles, l)

   do_fx(subs, meta, l)

   maxi = maxi - 1

   subs.delete(i)

  else

   i = i + 1

  end

  ai = ai + 1

 end

 aegisub.progress.task("Finished!")

 aegisub.progress.set(100)

end

-----------------------------------------------------------------------------
--|                                                                       --|
--|                   Funkcja główna od efektu                            --|
--|                                                                       --|    
-----------------------------------------------------------------------------

function do_fx(subs, meta, line)


 for i = 0, line.kara.n do

   local syl = line.kara[i]



     if syl.duration > 0 then

        local l = table.copy(line)
        
       
        local x = line.left + syl.center
        local y = line.styleref.margin_t
        
        
  
        -----------------------------------------------------------------------------
        --|                                                                       --|
        --|                        Intro                                          --|
        --|                                                                       --|         
        -----------------------------------------------------------------------------

        l.layer = 1
        l.start_time = line.start_time - math.random(500,1000)
        l.end_time = line.start_time
        l.text = string.format("{\\an2\\move(%d, -20, %d, %d)}%s",x,x,y,syl.text_stripped)
        subs.append(l)
        
        -----------------------------------------------------------------------------
        --|                                                                       --|
        --|                        Efekt & Outro                                  --|
        --|                                                                       --|         
        -----------------------------------------------------------------------------
        l.layer = 2
        l.start_time = line.start_time + syl.start_time
        
        local start = syl.start_time
        local koniec = start + syl.duration
        
        local a1000 = koniec + 500
        local a1200 = a1000 + 200
        local out = a1200 + math.random(200, 700)
        local out2 = out + 500
        
        l.text = string.format("{\\an2\\t(%d, %d,\\fscy80\\fscx120\\1c&H32CB8D;&\\3c&H82FFFE;&)\\t(%d, %d,\\fscy120\\fscx80\\1c&H82FFFE;&\\\\3c&H32CB8D;&)\\t(%d, %d,\\fscx100\\fscy100)\\move(%d, %d, %d, -20, %d, %d)}%s",start,koniec,koniec,a1000,a1000,a1200,x,y,x,out,out2,syl.text_stripped) 
        
        l.start_time = line.start_time
        l.end_time = line.end_time + out2
        subs.append(l)
        
        
      end

 end

end


aegisub.register_filter("Usagi_OP", "", 2000, KARA)

 

Revise this Paste

Your Name: Code Language: