Facebook
From Baby Treeshrew, 7 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 319
  1. --Script Informationen
  2.  
  3. script_name = "Sora no Otoshimono ED2"
  4.  
  5. script_description = "Flying pantsu."
  6.  
  7. script_author = "Youka"
  8.  
  9. script_version = "1.0"
  10.  
  11. --Kara-Skelett einfügen
  12.  
  13. include("karaskel.lua")
  14.  
  15.  
  16.  
  17. --ROMAJI
  18.  
  19. function rom(subs,line,meta)
  20.  
  21.         --Variablen vorbereiten
  22.  
  23.         local ccolor = color_distro(line)
  24.  
  25.         local cpos = {}
  26.  
  27.         --Einblendung
  28.  
  29.         local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped)
  30.  
  31.         for c in unicode.chars(line.text_stripped) do
  32.  
  33.                 local l = table.copy(line)
  34.  
  35.                 ci = ci + 1
  36.  
  37.                 local cwidth,cheight = aegisub.text_extents(line.styleref, c)
  38.  
  39.                 local posx, posy = posxa + cwidth/2, line.middle
  40.  
  41.                 l.layer = math.random(1,cn)+cn
  42.  
  43.                 local in_t = math.random(line.infade+500,line.infade+800)
  44.  
  45.                 l.start_time = line.start_time - in_t
  46.  
  47.                 l.end_time = line.start_time
  48.  
  49.                 local movx, movy = math.random(line.width/2,line.width*2/3), math.random(line.margin_v*2/3,line.margin_v+cheight)
  50.  
  51.                 local wdur = fdur*10
  52.  
  53.                 local wush = math.ceil(in_t/wdur)
  54.  
  55.                 for wi=1,2 do
  56.  
  57.                         local cly1,cly2
  58.  
  59.                         if wi==1 then cly1,cly2 = 0, line.middle else cly1, cly2 = line.middle, meta.res_y end
  60.  
  61.                         l.text = string.format("{\fs%d\alpha&HFF&\t(0.5,\alpha&H00&)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d)\fs%d)\an5\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize+4,cly1+movy,meta.res_x,cly2+movy,cly1,meta.res_x,cly2,line.styleref.fontsize,posx-movx,posy+movy,posx,posy,ccolor[ci],c)
  62.  
  63.                         for s=1, wush do
  64.  
  65.                                 local aa, bb = (s-1)*wdur,s*wdur
  66.  
  67.                                 local frx = 70*row_test(s,2)*row_test(wi,2)
  68.  
  69.                                 if s == wush then frx = 0 end
  70.  
  71.                                 local wing = string.format("\t(%d,%d,2,\frx%d)}",aa,bb,frx)
  72.  
  73.                                 l.text = l.text:gsub("}",wing)
  74.  
  75.                         end
  76.  
  77.                         subs.append(l)
  78.  
  79.                 end
  80.  
  81.                 posxa = posxa + cwidth
  82.  
  83.         end
  84.  
  85.         --Standard
  86.  
  87.         local ci,cn = 0, unicode.len(line.text_stripped)
  88.  
  89.         local cdur, tolerance = fdur * 50, 8
  90.  
  91.         for k=1, #line.kara do
  92.  
  93.                 local syl = line.kara[k]
  94.  
  95.                 local posxa = line.left+syl.left
  96.  
  97.                 for c in unicode.chars(syl.text_stripped) do
  98.  
  99.                         ci = ci + 1
  100.  
  101.                         local l = table.copy(line)
  102.  
  103.                         local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  104.  
  105.                         local posx, posy = posxa + cwidth/2, line.top
  106.  
  107.                         local posx1, posy1 = posx, posy
  108.  
  109.                         local frames = math.ceil(line.duration/cdur)
  110.  
  111.                         l.layer = cn-ci+1
  112.  
  113.                         for fi=1, frames do
  114.  
  115.                                 local movx, movy, posx2, posy2
  116.  
  117.                                 repeat
  118.  
  119.                                         movx, movy = math.random(-2,2), math.random(-2,2)
  120.  
  121.                                         posx2, posy2 = posx1+movx, posy1+movy
  122.  
  123.                                 until (posx2<posx+cwidth/tolerance) and (posx2>posx-cwidth/tolerance) and (posy2<posy+cheight/tolerance) and (posy2>posy-cheight/tolerance)
  124.  
  125.                                 if fi == frames then posx2, posy2 = posx,posy end
  126.  
  127.                                 l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1,posy1,posx2,posy2,ccolor[ci],c)
  128.  
  129.                                 l.start_time = line.start_time + (fi-1) * cdur
  130.  
  131.                                 l.end_time = l.start_time + cdur
  132.  
  133.                                 if l.end_time > line.start_time+syl.start_time then
  134.  
  135.                                         l.end_time = line.start_time+syl.start_time
  136.  
  137.                                         if l.start_time>l.end_time then break end
  138.  
  139.                                         cpos[ci] = {
  140.  
  141.                                                 x = posx2,
  142.  
  143.                                                 y = posy2,
  144.  
  145.                                                 layer = l.layer
  146.  
  147.                                         }
  148.  
  149.                                 end
  150.  
  151.                                 posx1, posy1 = posx2, posy2
  152.  
  153.                                 subs.append(l)
  154.  
  155.                         end
  156.  
  157.                         posxa = posxa + cwidth
  158.  
  159.                 end
  160.  
  161.         end
  162.  
  163.         --Silben-Effekt
  164.  
  165.         local ci,cn = 0, unicode.len(line.text_stripped)
  166.  
  167.         for k=1, #line.kara do
  168.  
  169.                 local syl = line.kara[k]
  170.  
  171.                 for c in unicode.chars(syl.text_stripped) do
  172.  
  173.                         ci = ci + 1
  174.  
  175.                         local l = table.copy(line)
  176.  
  177.                         local posx, posy = cpos[ci].x, cpos[ci].y
  178.  
  179.                         l.layer = 0
  180.  
  181.                         local sdur = syl.duration + 500
  182.  
  183.                         l.start_time = line.start_time + syl.start_time
  184.  
  185.                         l.end_time = l.start_time + sdur
  186.  
  187.                         local xway, yway = math.random(line.width/2,line.width*2/3), -(line.styleref.margin_v+line.height/2)
  188.  
  189.                         local stribe = 1
  190.  
  191.                         local stribes = (line.height + 4)/stribe
  192.  
  193.                         for s=1, stribes do
  194.  
  195.                                 local py = line.top-2 + (s-1)*stribe
  196.  
  197.                                 local aa, bb = sdur - 500, sdur
  198.  
  199.                                 local frz = math.random(5,20)*0.001
  200.  
  201.                                 l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\fad(0,500)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d))\org(%d,100000)\t(%d,%d,\frz%.3f)}%s",posx,posy,posx+xway,posy+yway,ccolor[ci],py,meta.res_x,py+stribe,py+yway,meta.res_x,py+stribe+yway,meta.res_x/2,aa,bb,-frz,c)
  202.  
  203.                                 subs.append(l)
  204.  
  205.                         end
  206.  
  207.                 end
  208.  
  209.         end
  210.  
  211. end
  212.  
  213.  
  214.  
  215. function rom1(subs,line,meta)
  216.  
  217.         --Variablen vorbereiten
  218.  
  219.         local ccolor = color_distro(line)
  220.  
  221.         local cpos = {}
  222.  
  223.         --Einblendung
  224.  
  225.         local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped)
  226.  
  227.         for c in unicode.chars(line.text_stripped) do
  228.  
  229.                 ci = ci + 1
  230.  
  231.                 local l = table.copy(line)
  232.  
  233.                 local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  234.  
  235.                 local posx, posy = posxa + cwidth/2, line.top
  236.  
  237.                 l.layer = cn-ci
  238.  
  239.                 l.start_time = line.start_time-line.infade-500
  240.  
  241.                 l.end_time = line.start_time
  242.  
  243.                 for i=1, 2 do
  244.  
  245.                         local al = (i-1)*130
  246.  
  247.                         l.start_time = l.start_time + fdur*(i-1)
  248.  
  249.                         l.end_time = l.end_time + fdur*(i-1)
  250.  
  251.                         l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\alpha&H%x&\fad(500,0)}%s",posx-math.random(line.width,line.width*1.2),posy+math.random(line.margin_v*2/3,line.margin_v+cheight),posx-15,posy,ccolor[ci],al,c)
  252.  
  253.                         subs.append(l)
  254.  
  255.                 end
  256.  
  257.                 posxa = posxa + cwidth
  258.  
  259.         end
  260.  
  261.         --Standard
  262.  
  263.         local ci,cn = 0, unicode.len(line.text_stripped)
  264.  
  265.         local cdur, tolerance, way = fdur * 30, 6, 30
  266.  
  267.         for k=1, #line.kara do
  268.  
  269.                 local syl = line.kara[k]
  270.  
  271.                 local posxa = line.left + syl.left
  272.  
  273.                 for c in unicode.chars(syl.text_stripped) do
  274.  
  275.                         ci = ci + 1
  276.  
  277.                         local l = table.copy(line)
  278.  
  279.                         local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  280.  
  281.                         local posx, posy = posxa + cwidth/2 - way/2, line.top
  282.  
  283.                         local posx1 = posx
  284.  
  285.                         local frames = math.floor(line.duration/cdur)
  286.  
  287.                         l.layer = cn-ci
  288.  
  289.                         for fi=1, frames do
  290.  
  291.                                 local wstep1,wstep2 = math.ceil(way/frames)*(fi-1), math.ceil(way/frames)*fi
  292.  
  293.                                 local mini,maxi = posx-cwidth/tolerance, posx+cwidth/tolerance
  294.  
  295.                                 local movx, posx2
  296.  
  297.                                 repeat
  298.  
  299.                                         movx = math.random(-3,3)
  300.  
  301.                                         posx2 = posx1+movx
  302.  
  303.                                 until (posx2<maxi) and (posx2>mini)
  304.  
  305.                                 if fi == frames then posx2 = posx + way/2 - math.ceil(way/frames) end
  306.  
  307.                                 l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1+wstep1,posy,posx2+wstep2,posy,ccolor[ci],c)
  308.  
  309.                                 l.start_time = line.start_time + (fi-1) * cdur
  310.  
  311.                                 l.end_time = l.start_time + cdur
  312.  
  313.                                 if l.end_time > line.start_time+syl.start_time then
  314.  
  315.                                         l.end_time = line.start_time+syl.start_time
  316.  
  317.                                         if l.start_time>l.end_time then break end
  318.  
  319.                                         local t_mov = line.start_time+syl.start_time-l.start_time
  320.  
  321.                                         local pct_mov = t_mov/cdur
  322.  
  323.                                         local movx2 = (posx2-posx1)*pct_mov
  324.  
  325.                                         cpos[ci] = {
  326.  
  327.                                                 x = posx2+wstep2,
  328.  
  329.                                                 layer = l.layer
  330.  
  331.                                         }
  332.  
  333.                                 end
  334.  
  335.                                 posx1 = posx2
  336.  
  337.                                 subs.append(l)
  338.  
  339.                         end
  340.  
  341.                         posxa = posxa + cwidth
  342.  
  343.                 end
  344.  
  345.         end
  346.  
  347.         --Silben-Effekt
  348.  
  349.         local ci,cn = 0, unicode.len(line.text_stripped)
  350.  
  351.         for k=1, #line.kara do
  352.  
  353.                 local syl = line.kara[k]
  354.  
  355.                 for c in unicode.chars(syl.text_stripped) do
  356.  
  357.                         ci = ci + 1
  358.  
  359.                         local l = table.copy(line)
  360.  
  361.                         local posx, posy = cpos[ci].x, line.top
  362.  
  363.                         l.layer = cpos[ci].layer
  364.  
  365.                         local sdur = syl.duration + 500
  366.  
  367.                         l.start_time = line.start_time + syl.start_time
  368.  
  369.                         l.end_time = l.start_time + sdur
  370.  
  371.                         local xway, yway = math.random(line.width/2,line.width*2/3), -(line.margin_v+line.height+2)
  372.  
  373.                         l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\fad(0,300)}%s",posx,posy,posx+xway,posy+yway,ccolor[ci],c)
  374.  
  375.                         local fldur = fdur*4
  376.  
  377.                         local flak = math.ceil((sdur)/fldur)
  378.  
  379.                         for f=flak, 1, -1 do
  380.  
  381.                                 local alp = (row_test(f-1,2)+1)/2*85
  382.  
  383.                                 local aa, bb = (f-1) * fldur, f * fldur
  384.  
  385.                                 local altxt = string.format("{\t(%d,%d,\alpha&H%x&)",aa,bb,alp)
  386.  
  387.                                 l.text = l.text:gsub("{",altxt)
  388.  
  389.                         end
  390.  
  391.                         subs.append(l)
  392.  
  393.                         local frames = math.ceil(sdur/fdur)
  394.  
  395.                         for fr=1, frames do
  396.  
  397.                                 if row_test(fr,8)==1 then
  398.  
  399.                                         local pct = fr/frames
  400.  
  401.                                         local movxx, movyy = pct*xway, pct*yway
  402.  
  403.                                         local posxx, posyy = posx+movxx, line.middle+movyy
  404.  
  405.                                         l.text = string.format("{\an5\pos(%.2f,%.2f)\bord1\blur1\fad(200,600)\t(\fs%d)\1a&HFF&\3c&HB0B0B0&\3a&H20&}%s",posxx,posyy,line.styleref.fontsize+14,c)
  406.  
  407.                                         l.start_time = line.start_time + syl.start_time + (fr-1)*fdur
  408.  
  409.                                         l.end_time = l.start_time + 800
  410.  
  411.                                         subs.append(l)
  412.  
  413.                                 end
  414.  
  415.                         end
  416.  
  417.                 end
  418.  
  419.         end
  420.  
  421. end
  422.  
  423.  
  424.  
  425. --TRANS
  426.  
  427. function trans(subs,line,meta)
  428.  
  429.         --Variablen vorbereiten
  430.  
  431.         local ccolor = color_distro(line)
  432.  
  433.         --Einblendung
  434.  
  435.         local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped)
  436.  
  437.         for c in unicode.chars(line.text_stripped) do
  438.  
  439.                 local l = table.copy(line)
  440.  
  441.                 ci = ci + 1
  442.  
  443.                 local cwidth,cheight = aegisub.text_extents(line.styleref, c)
  444.  
  445.                 local posx, posy = posxa + cwidth/2, line.middle
  446.  
  447.                 l.layer = math.random(1,cn)+cn
  448.  
  449.                 local in_t = math.random(line.infade+500,line.infade+800)
  450.  
  451.                 l.start_time = line.start_time - in_t
  452.  
  453.                 l.end_time = line.start_time
  454.  
  455.                 local movx, movy = math.random(line.width/2,line.width*2/3), math.random(line.margin_v*2/3,line.margin_v+cheight)
  456.  
  457.                 local wdur = fdur*10
  458.  
  459.                 local wush = math.ceil(in_t/wdur)
  460.  
  461.                 for wi=1,2 do
  462.  
  463.                         local cly1,cly2
  464.  
  465.                         if wi==1 then cly1,cly2 = 0, line.middle else cly1, cly2 = line.middle, meta.res_y end
  466.  
  467.                         l.text = string.format("{\fs%d\alpha&HFF&\t(0.5,\alpha&H00&)\clip(0,%d,%d,%d)\t(\clip(0,%d,%d,%d)\fs%d)\an5\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize+4,cly1+movy,meta.res_x,cly2+movy,cly1,meta.res_x,cly2,line.styleref.fontsize,posx-movx,posy+movy,posx,posy,ccolor[ci],c)
  468.  
  469.                         for s=1, wush do
  470.  
  471.                                 local aa, bb = (s-1)*wdur,s*wdur
  472.  
  473.                                 local frx = 70*row_test(s,2)*row_test(wi,2)
  474.  
  475.                                 if s == wush then frx = 0 end
  476.  
  477.                                 local wing = string.format("\t(%d,%d,2,\frx%d)}",aa,bb,frx)
  478.  
  479.                                 l.text = l.text:gsub("}",wing)
  480.  
  481.                         end
  482.  
  483.                         subs.append(l)
  484.  
  485.                 end
  486.  
  487.                 posxa = posxa + cwidth
  488.  
  489.         end
  490.  
  491.         --Ausblendung
  492.  
  493.         local posxa, ci, cn = line.left, 0, unicode.len(line.text_stripped)
  494.  
  495.         for c in unicode.chars(line.text_stripped) do
  496.  
  497.                 local l = table.copy(line)
  498.  
  499.                 ci = ci + 1
  500.  
  501.                 local cwidth,cheight = aegisub.text_extents(line.styleref, c)
  502.  
  503.                 local posx, posy = posxa + cwidth/2, line.middle
  504.  
  505.                 l.layer = math.random(1,cn)
  506.  
  507.                 local out_t = math.random (line.outfade+500,line.outfade+800)
  508.  
  509.                 l.text = string.format("{\t(\fs%d\frx-80)\an5\t(2,\alpha&HFF&)\move(%.2f,%.2f,%.2f,%.2f)\bord1\be1%s}%s",line.styleref.fontsize-6,posx,posy,posx+math.random(line.width*2/3,line.width*1.33),posy+math.random(line.margin_v*2/3,line.margin_v+cheight),ccolor[ci],c)
  510.  
  511.                 l.start_time = line.end_time
  512.  
  513.                 l.end_time = l.start_time + out_t
  514.  
  515.                 subs.append(l)
  516.  
  517.                 posxa = posxa + cwidth
  518.  
  519.         end
  520.  
  521.         --Standard
  522.  
  523.         local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped)
  524.  
  525.         local cdur, tolerance = fdur * 50, 8
  526.  
  527.         for c in unicode.chars(line.text_stripped) do
  528.  
  529.                 ci = ci + 1
  530.  
  531.                 local l = table.copy(line)
  532.  
  533.                 local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  534.  
  535.                 local posx, posy = posxa + cwidth/2, line.bottom
  536.  
  537.                 local posx1, posy1 = posx, posy
  538.  
  539.                 local frames = math.ceil(line.duration/cdur)
  540.  
  541.                 l.layer = cn-ci
  542.  
  543.                 for fi=1, frames do
  544.  
  545.                         local movx, movy, posx2, posy2
  546.  
  547.                         repeat
  548.  
  549.                                 movx, movy = math.random(-2,2), math.random(-2,2)
  550.  
  551.                                 posx2, posy2 = posx1+movx, posy1+movy
  552.  
  553.                         until (posx2<posx+cwidth/tolerance) and (posx2>posx-cwidth/tolerance) and (posy2<posy+cheight/tolerance) and (posy2>posy-cheight/tolerance)
  554.  
  555.                         if fi == frames then posx2, posy2 = posx,posy end
  556.  
  557.                         l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1,posy1,posx2,posy2,ccolor[ci],c)
  558.  
  559.                         l.start_time = line.start_time + (fi-1) * cdur
  560.  
  561.                         l.end_time = l.start_time + cdur
  562.  
  563.                         if l.end_time > line.end_time then l.end_time = line.end_time end
  564.  
  565.                         posx1, posy1 = posx2, posy2
  566.  
  567.                         subs.append(l)
  568.  
  569.                 end
  570.  
  571.                 posxa = posxa + cwidth
  572.  
  573.         end
  574.  
  575. end
  576.  
  577.  
  578.  
  579. function trans1(subs,line,meta)
  580.  
  581.         --Variablen vorbereiten
  582.  
  583.         local ccolor = color_distro(line)
  584.  
  585.         --Ein-/Ausblendung
  586.  
  587.         local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped)
  588.  
  589.         for c in unicode.chars(line.text_stripped) do
  590.  
  591.                 ci = ci + 1
  592.  
  593.                 local l = table.copy(line)
  594.  
  595.                 local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  596.  
  597.                 local posx, posy = posxa + cwidth/2, line.bottom
  598.  
  599.                 local px1, py1, px2, py2, t1, t2
  600.  
  601.                 for fa=1, 2 do
  602.  
  603.                         l.layer = cn-ci
  604.  
  605.                         if fa==1 then
  606.  
  607.                                 l.start_time = line.start_time-line.infade-500
  608.  
  609.                                 l.end_time = line.start_time
  610.  
  611.                                 px1, py1 = -math.random(line.width,line.width*1.2), math.random(line.margin_v*2/3,line.margin_v+cheight)
  612.  
  613.                                 px2, py2 = -15, 0
  614.  
  615.                                 t1, t2 = 500, 0
  616.  
  617.                         else
  618.  
  619.                                 l.start_time = line.end_time
  620.  
  621.                                 l.end_time = l.start_time + line.outfade + 800
  622.  
  623.                                 px1, py1 = 30, 0
  624.  
  625.                                 px2, py2 = math.random(line.width,line.width*1.2), math.random(line.margin_v*2/3,line.margin_v+cheight)
  626.  
  627.                                 t1, t2 = 0, 800
  628.  
  629.                         end
  630.  
  631.                         for i=1, 2 do
  632.  
  633.                                 local al = (i-1)*130
  634.  
  635.                                 l.start_time = l.start_time + fdur*(i-1)
  636.  
  637.                                 l.end_time = l.end_time + fdur*(i-1)
  638.  
  639.                                 l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1\alpha&H%x&\fad(%d,%d)}%s",posx+px1,posy+py1,posx+px2,posy+py2,ccolor[ci],al,t1,t2,c)
  640.  
  641.                                 subs.append(l)
  642.  
  643.                         end
  644.  
  645.                 end
  646.  
  647.                 posxa = posxa + cwidth
  648.  
  649.         end
  650.  
  651.         --Standard
  652.  
  653.         local posxa,ci,cn = line.left, 0, unicode.len(line.text_stripped)
  654.  
  655.         local cdur, tolerance, way = fdur * 30, 6, 30
  656.  
  657.         for c in unicode.chars(line.text_stripped) do
  658.  
  659.                 ci = ci + 1
  660.  
  661.                 local l = table.copy(line)
  662.  
  663.                 local cwidth, cheight = aegisub.text_extents(line.styleref, c)
  664.  
  665.                 local posx, posy = posxa + cwidth/2 - way/2, line.bottom
  666.  
  667.                 local posx1 = posx
  668.  
  669.                 local frames = math.floor(line.duration/cdur)
  670.  
  671.                 l.layer = cn-ci
  672.  
  673.                 for fi=1, frames do
  674.  
  675.                         local wstep1,wstep2 = math.ceil(way/frames)*(fi-1), math.ceil(way/frames)*fi
  676.  
  677.                         local mini,maxi = posx-cwidth/tolerance, posx+cwidth/tolerance
  678.  
  679.                         local movx, posx2
  680.  
  681.                         repeat
  682.  
  683.                                 movx = math.random(-3,3)
  684.  
  685.                                 posx2 = posx1+movx
  686.  
  687.                         until (posx2<maxi) and (posx2>mini)
  688.  
  689.                         if fi == frames then posx2 = posx + way/2 - math.ceil(way/frames) end
  690.  
  691.                         l.text = string.format("{\move(%.2f,%.2f,%.2f,%.2f)\bord1%s\be1}%s",posx1+wstep1,posy,posx2+wstep2,posy,ccolor[ci],c)
  692.  
  693.                         l.start_time = line.start_time + (fi-1) * cdur
  694.  
  695.                         l.end_time = l.start_time + cdur
  696.  
  697.                         if fi==frames then l.end_time = line.end_time end
  698.  
  699.                         posx1 = posx2
  700.  
  701.                         subs.append(l)
  702.  
  703.                 end
  704.  
  705.                 posxa = posxa + cwidth
  706.  
  707.         end
  708.  
  709. end
  710.  
  711.  
  712.  
  713. --Testet, ob Zahl in Hit-Reihe ist; "Ja" = 1; "Nein" = -1
  714.  
  715. function row_test(int,hit)
  716.  
  717.         return -(math.ceil(math.ceil(int/hit)-int/hit)*2-1)
  718.  
  719. end
  720.  
  721.  
  722.  
  723. --Erstellt Farb-Table für Buchstaben
  724.  
  725. function color_distro(line)
  726.  
  727.         local ccolor, ci, colortest = {}, 0, ""
  728.  
  729.         for c in unicode.chars(line.text_stripped) do
  730.  
  731.                 ci = ci + 1
  732.  
  733.                 local color
  734.  
  735.                 repeat
  736.  
  737.                         color = pantsu_colors[math.random(1,table.maxn(pantsu_colors))]
  738.  
  739.                 until color~=colortest
  740.  
  741.                 if c~=" " then colortest = color end
  742.  
  743.                 ccolor[ci] = color
  744.  
  745.         end
  746.  
  747.         return ccolor
  748.  
  749. end
  750.  
  751.  
  752.  
  753. --Zeit für Ein- und Ausblendung
  754.  
  755. function in_and_outfade(subs,line,i)
  756.  
  757.         if i > 1 and ir>1 and it>1 then
  758.  
  759.                 line.infade = subs[i].start_time - subs[i-1].end_time
  760.  
  761.         else
  762.  
  763.                 line.infade = 800
  764.  
  765.         end
  766.  
  767.         if i<subs.n and ir<8 and it<8 then
  768.  
  769.                 line.outfade = subs[i+1].start_time - subs[i].end_time
  770.  
  771.         else
  772.  
  773.                 line.outfade = 1000
  774.  
  775.         end
  776.  
  777. end
  778.  
  779.  
  780.  
  781. --Zeit eines Frames
  782.  
  783. function framedur()
  784.  
  785.         local msa = aegisub.ms_from_frame(1)
  786.  
  787.         local msb = aegisub.ms_from_frame(101)
  788.  
  789.         local fd = (msb-msa)/100
  790.  
  791.         return fd
  792.  
  793. end
  794.  
  795.  
  796.  
  797. --HAUPTFUNKTION
  798.  
  799. function load_progress(subs)
  800.  
  801.         --Läd Prozess Display, sowie Meta- und Style-Daten
  802.  
  803.         aegisub.progress.title(script_name)
  804.  
  805.         aegisub.progress.task("Sammelt Style- und Meta-Daten")
  806.  
  807.         local meta, styles = karaskel.collect_head(subs)
  808.  
  809.         aegisub.progress.task("FX bearbeiten...")
  810.  
  811.         aegisub.progress.set(0)
  812.  
  813.         --Beginnt Durchgang der ASS-Lines und bereitet Variablen vor
  814.  
  815.         fdur = framedur()
  816.  
  817.         pantsu_colors = {
  818.  
  819.                 "\1c&H83AF66&\3c&H83AF66&",     --Green, green
  820.  
  821.                 "\1c&H1F1961&\3c&H1F1961&",     --Dark-red, dark-red
  822.  
  823.                 "\1c&HEDE3E0&\3c&H9F6849&",     --White, blue
  824.  
  825.                 "\1c&HA57FDC&\3c&HEFEAF7&",     --Bright-red, white
  826.  
  827.                 "\1c&H6EB3F0&\3c&H6EB3F0&",     --Orange, orange
  828.  
  829.                 "\1c&HF7F5F4&\3c&HF7F5F4&",     --White, white
  830.  
  831.                 "\1c&HE1D1CC&\3c&HE1D1CC&"      --Grey, grey
  832.  
  833.         }
  834.  
  835.         ir, it = 0, 0
  836.  
  837.         local li = 0
  838.  
  839.         for si = 1, #subs do
  840.  
  841.                 local sub = subs[si]
  842.  
  843.                 local ctest = 0
  844.  
  845.                 if sub.class == "dialogue" then
  846.  
  847.                         --Aktualisiert Index von Romaji, Trans und Line
  848.  
  849.                         li =  li + 1
  850.  
  851.                         if sub.style=="Romaji" then
  852.  
  853.                                 ir = ir+1
  854.  
  855.                         elseif sub.style=="Trans" then
  856.  
  857.                                 it = it+1
  858.  
  859.                         end
  860.  
  861.                         --Comment = Fehler-Meldung; ansonsten FX-Erstellung
  862.  
  863.                         if sub.comment then
  864.  
  865.                                 aegisub.log(2, string.format("%d: Comments werden nicht bearbeitet!n",li))
  866.  
  867.                                 sub.effect = "basic"
  868.  
  869.                         else
  870.  
  871.                                 --Werte zum Sub hinzufügen
  872.  
  873.                                 karaskel.preproc_line(subs, meta, styles, sub)
  874.  
  875.                                 --Line davor und dahinter bestimmen
  876.  
  877.                                 in_and_outfade(subs,sub,si)
  878.  
  879.                                 --Effekt nach Bedingung
  880.  
  881.                                 if sub.style=="Kara" then
  882.  
  883.                                         if sub.actor == "" then
  884.  
  885.                                                 rom(subs,sub,meta)
  886.  
  887.                                         else
  888.  
  889.                                                 rom1(subs,sub,meta)
  890.  
  891.                                         end
  892.  
  893.                                 elseif sub.style=="Trans" then
  894.  
  895.                                         if sub.actor == "" then
  896.  
  897.                                                 trans(subs,sub,meta)
  898.  
  899.                                         else
  900.  
  901.                                                 trans1(subs,sub,meta)
  902.  
  903.                                         end
  904.  
  905.                                 else
  906.  
  907.                                         ctest=1
  908.  
  909.                                 end
  910.  
  911.                                 --Wenn Original-Line bearbeitet -> Comment
  912.  
  913.                                 if ctest~=1 then
  914.  
  915.                                         sub.effect = "fx"
  916.  
  917.                                         sub.comment = true
  918.  
  919.                                 else
  920.  
  921.                                         sub.effect = "basic"
  922.  
  923.                                 end
  924.  
  925.                         end
  926.  
  927.                         subs[si] = sub
  928.  
  929.                 end
  930.  
  931.                 --Aktualisiert Display; unterbricht bei "Cancel" den Durchgang der Lines
  932.  
  933.                 aegisub.progress.set(si/subs.n*100)
  934.  
  935.                 if aegisub.progress.is_cancelled() then
  936.  
  937.                         break
  938.  
  939.                 end
  940.  
  941.         end
  942.  
  943.         --FX abgeschlossen; Undo-Point erstellen
  944.  
  945.         aegisub.progress.task("FX abgeschlossen!")
  946.  
  947.         aegisub.progress.set(100)
  948.  
  949.         aegisub.set_undo_point(script_name)
  950.  
  951. end
  952.  
  953.  
  954.  
  955. --Makro erstellen
  956.  
  957. aegisub.register_macro(script_name,script_description,load_progress)
  958.  
  959.