| 
UID2546积分161帖子30主题5论坛币888 威望0 EP值138 MP值0 阅读权限50注册时间2015-5-9在线时间52 小时最后登录2025-10-25
 
 
 | 
| 本帖最后由 Seekladoom 于 2021-8-26 04:01 编辑 
 【Aegisub:函数变量识别符为!!】
 
 注:!!是Aegisub的内置脚本语言AUTO4特有的函数变量识别符,原生Lua本身跟Python一样也是用()进行函数识别的,但在针对具体的嵌入式开发应用场景时会发生变化。复制代码[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: OPCN,思源宋体,70,&H00FFFFFF,&H00000000,&H003767E6,&H00000000,-1,0,0,0,100,100,6,0,1,2,0,2,0,0,10,1
Comment: 0,0:00:00.00,0:00:00.00,OPCN,,0,0,0,template char noblank,!retime("line",0,0)!{\an5\pos($center,$middle)\fry!math.random(30,60)!}
Comment: 0,0:00:0.00,0:00:01.00,OPCN,,0,0,0,karaoke,{\k100}字幕测试
 !!的函数识别逻辑在Aegisub的kara-templater.lua下,代码为:
 
 复制代码 -- Function for evaluating expressions
        local function expression_evaluator(expression)
                f, err = loadstring(string.format("return (%s)", expression))
                if (err) ~= nil then
                        aegisub.debug.out(2, "Error parsing expression: %s\nExpression producing error: %s\nTemplate with expression: %s\n\n", err, expression, template)
                        return "!" .. expression .. "!"
                else
                        setfenv(f, tenv)
                        local res, val = pcall(f)
                        if res then
                                return val
                        else
                                aegisub.debug.out(2, "Runtime error in template expression: %s\nExpression producing error: %s\nTemplate with expression: %s\n\n", val, expression, template)
                                return "!" .. expression .. "!"
                        end
                end
        end
 【TCAX:函数变量识别符为()】
 
 复制代码from tcaxPy import * #请用这个帖子(http://www.tcax.org/forum.php?mod=viewthread&tid=2120)中的tcaxPy.py文件
def tcaxPy_Init():
    pass
    
def tcaxPy_Main(_i, _j, _n, _BT, _ET, _SK, _KT, _X, _Y, _A, _TXT):
    ASS_BUF = []                # 用于保存ASS特效
    
    ass_main(ASS_BUF,SubL(_BT,_ET,0),an5+pos(_X,_Y)+fry(randint(30,60)),_TXT)
    
    return (ASS_BUF, None)
 | 
 |