//---- あやりりすEX設定 -------------------------------------------------------------- #define CHAR0_HEADER '[ぽポ]' #define CHAR1_HEADER '[えエ]' //---- あやりりすEXトランスレータ -------------------------------------------------------------- OnTranslateInternal.AYLEX { ProcessSpecialSyntax(_argv[0]) } ProcessSpecialSyntax { _txt = _argv[0] _arr = RE_SPLIT(_txt,'\r\n[==]{4,}\r\n',2) //=====区切りでchain if STRLEN(_arr[1]) { SHIORI3FW.StartChainTalkScriptDirect(_arr[1]) } _txt = _arr[0] _arr = RE_SPLIT(_txt,'\r\n[-―ー−]{4,}\r\n') //-----区切りで複数トークRAND選択 if GETTYPE(_arr) == 4 { _txt = _arr[RAND(ARRAYSIZE(_arr))] } else { _txt = _arr } ProcessAYALilithSyntax(_txt) } ProcessAYALilithSyntaxSub { _text = _argv[0] _text = REPLACE(_text,'‥','…') if TOINT(_argv[1]) == 0 { _text = RE_REPLACEEX(_text, '([、…])(?=.)', '$1\\w5') _text = RE_REPLACEEX(_text, '([。!?])(?=[^。!?])', '$1\\w9') } _text = RE_REPLACE(_text,'[((](ユーザー?名?|ユーザさん|ユーザーさん)[))]',username) _text } OnSystemLoad.AYALilithEX { timeout_label = '' entering_passive_mode = 0 AYALilithEX = 1 } OnSystemUnload.AYALilithEX { ERASEVAR('timeout_label','entering_passive_mode','AYALilithEX') } ProcessAYALilithSyntax { timeout_label = '' _txtarray = IARRAY _txtarray ,= SPLIT(_argv[0],CHR(0xd,0xa)) _script = '' if (ARRAYSIZE(_txtarray) <= 1) && (RE_SEARCH(_txtarray[0],'^[^\\]*(' + CHAR0_HEADER + '|' + CHAR1_HEADER + ')[^\\]*[「「]') == 0) { if ISFUNC('NormalTranslator') { EVAL('NormalTranslator(_txtarray[0])') } else { _txtarray[0] } } else { _init_script = '' _talk_init = 0 _talk_init_side = IARRAY _talk_done_side = IARRAY _side = 0 _side_old = 0 _sync = 0 _is_exit = 0 _quick = 0 _passive_set = 0 _timeout_value = 0 _n = ARRAYSIZE(_txtarray) for _i = 0 ; _i < _n ; _i++ { _txt = _txtarray[_i] if _txt != '' { _txt_exit = RE_REPLACE(_txt,'(\\w[1-9])*\\-','') if _txt != _txt_exit { _is_exit = 1 _txt = _txt_exit } _txt = RE_REPLACE(_txt,'[」」]\s*?$','') if RE_SEARCH(_txt,'^[##]設定[::]') { //#設定:ほげほげ _txt = ERASE(_txt,0,4) if 'クイック' _in_ _txt { if _quick == 0 { _quick = 1 _script += '\_q' } } else { if _quick != 0 { _quick = 0 _script += '\_q' } } if '受動モード' _in_ _txt || 'パッシブモード' _in_ _txt { _passive_set = 1 if entering_passive_mode == 0 { _script += '\![enter,passivemode]' entering_passive_mode = 1 } } if RE_MATCH(_txt,'タイムアウト([0-90-9]*)[「「](.+)[」」]') { timeout_label = RE_GETSTR[2] if RE_GETSTR[1] != '' { _timeout_value = TOINT(ZEN2HAN(RE_GETSTR[1])) } } } elseif RE_SEARCH(_txt,'^[##]') { //#コメント ; //なにもしない } elseif RE_MATCH(_txt,'^(.*?)[「「](.+)$') { _main = RE_GETSTR[2] _cmd = RE_REPLACE(RE_GETSTR[1],'[  \t]','') _cmd_wait = _cmd _cmd = REPLACE(_cmd,'待ち無し','') _cmd = REPLACE(_cmd,'待ちなし','') _cmd_wait = (_cmd != _cmd_wait) _cmd_waitzero = _cmd _cmd = REPLACE(_cmd,'待ちゼロ','') _cmd_waitzero = (_cmd != _cmd_waitzero) _cmd_morewait = _cmd _cmd = REPLACE(_cmd,'待ち多め','') _cmd_morewait = (_cmd != _cmd_morewait) _cmd_line = _cmd _cmd = REPLACE(_cmd,'改行無し','') _cmd_line = (_cmd != _cmd_line) _cmd_click = _cmd _cmd = REPLACE(_cmd,'クリック待ち','') _cmd_click = (_cmd != _cmd_click) if _talk_init != 0 { if _cmd_click { _talk_done_side = IARRAY _script += '\x' } elseif _quick == 0 { if _cmd_waitzero { ; //NOOP } elseif _cmd_wait { //待ち無し _script += "\w3" } elseif _cmd_morewait { //待ち多め _script += "\w9\w9\w9\w9" } else { //待ち普通 _script += "\w9\w9" } } } while 1 { if RE_SEARCH(_cmd,'^' + CHAR0_HEADER + '([0-90-9消]*)') { if _sync { _sync = 0 _script += '\_s' } _cmd = ERASE(_cmd,0,RE_GETLEN[0]) _side = 0 _script += '\0' if RE_GETSTR[1] != '' { _talk_init_side[_side] = 1 _s = RE_GETSTR[1] if _s == '消' { _script += "\s[-1]" } else { _script += "\s[%(TOINT(ZEN2HAN(_s)))]" } } } elseif RE_SEARCH(_cmd,'^' + CHAR1_HEADER + '([0-90-9消]*)') { if _sync { _sync = 0 _script += '\_s' } _cmd = ERASE(_cmd,0,RE_GETLEN[0]) _side = 1 _script += '\1' if RE_GETSTR[1] != '' { _talk_init_side[_side] = 1 _s = RE_GETSTR[1] if _s == '消' { _script += "\s[-1]" } else { _script += "\s[%(TOINT(ZEN2HAN(_s)))]" } } } elseif SUBSTR(_cmd,0,2) == '二人' { _cmd = ERASE(_cmd,0,2) if _sync == 0 { _sync = 1 _script += '\_s' } } else { break } } if TOINT(_talk_done_side[_side]) != 0 { if _cmd_line == 0 { if _side_old != _side { _script += "\n\n[half]" } else { _script += "\n" } } } _side_old = _side if _talk_init == 0 { if TOINT(_talk_init_side[0]) == 0 { _init_script = '\0\s[0]' } elseif TOINT(_talk_init_side[1]) == 0 { _init_script = '\1\s[10]\0' } } _talk = ProcessAYALilithSyntaxSub(_main,_quick) if _talk != '' { _talk_done_side[_side] = 1 _script += _talk } _talk_init = 1 } else { if _quick == 0 { _script += "\w9" } _script += "\n"; _script += ProcessAYALilithSyntaxSub(_txt,_quick) } if entering_passive_mode != 0 { if _passive_set == 0 { _script += '\![leave,passivemode]' entering_passive_mode = 0 } } } } if _is_exit { _script += "\w9\-"; } if _timeout_value { _script = "\![set,balloontimeout,%(_timeout_value)]\![set,choicetimeout,%(_timeout_value)]" + _script } //これが必ず最後 if _init_script != '' { _script = _init_script + _script } _script } }