///////// YAYA Ghost Template ///////// Menu Processing Dictionary //**** Caution ******************************************************************** // This dictionary is a collection of common processes required for ghost templates. // Normally, there is no need to change this. //**** Caution ******************************************************************** //****************************************************************************** // Startup ・Shutdown Initialization //****************************************************************************** OnSystemLoad.AYATEMPLATE { AYATEMPLATE.installedplugin_name = IARRAY AYATEMPLATE.installedplugin_id = IARRAY AYATEMPLATE.stroke = IARRAY AYATEMPLATE.strokeid = IARRAY AYATEMPLATE.stroketimer = IARRAY AYATEMPLATE.mikireflag = 0 AYATEMPLATE.LastTalk = '' } OnSystemUnload.AYATEMPLATE { //ERASEVAR('AYATEMPLATE.installedplugin_name') //ERASEVAR('AYATEMPLATE.installedplugin_id') ERASEVAR('AYATEMPLATE.stroke') ERASEVAR('AYATEMPLATE.strokeid') ERASEVAR('AYATEMPLATE.stroketimer') ERASEVAR('AYATEMPLATE.mikireflag') ERASEVAR('AYATEMPLATE.LastTalk') } //****************************************************************************** //Random Talk //****************************************************************************** OnAITalk { OnAiTalk } //------------------------------------------------------------------------------ //OnAiTalk Event //------------------------------------------------------------------------------ OnAiTalk { //---- Normal random talk, but chain talk during chains if SHIORI3FW.IsChain { AYATEMPLATE.LastTalk = ChainTalk } else { AYATEMPLATE.LastTalk = RandomTalk } AYATEMPLATE.LastTalk } //****************************************************************************** //Menu related //****************************************************************************** //------------------------------------------------------------------------------ //Event processing //You can now write option ID/anchor ID as the function name. //------------------------------------------------------------------------------ OnChoiceSelect { if ISFUNC(reference[0]) { EVAL(reference[0]) } } OnAnchorSelect { if RE_SEARCH(reference[0],'^(http|https)://') { if basewarename == 'SSP' { '\C' } -- "\j[%(AYATEMPLATE.EscapeText(reference[0]))]" } else { if ISFUNC(reference[0]) { EVAL(reference[0]) } } } //------------------------------------------------------------------------------ //Flip one line of the menu horizontally //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ //Normal menu AYATEMPLATE.MenuItem { _linefeed = 100 _n = _argc if _n >= 3 { if GETTYPE(_argv[_n-1]) == 1 {//整数 _linefeed = _argv[_n-1] _n -= 1 } } _lftext = '' while _linefeed > 0 { if _linefeed >= 100 { _lftext += '\n' } else { _lftext += '\n[half]' } _linefeed -= 100 } _lftext -- '\![*]\q[' -- AYATEMPLATE.EscapeText( SHIORI3FW.MakeJustText(_argv[0],46) ) -- _s = '' for _i = 1 ; _i < _n ; _i++ { _s += ',' + AYATEMPLATE.EscapeText(_argv[_i]) } _s -- ']' } //------------------------------------------------------------------------------ //escape AYATEMPLATE.EscapeText { _r = _argv[0] if RE_SEARCH(_r,'[,"\[\]]') { '"' + REPLACE(_r,'"','""') + '"' } else { _r } } //****************************************************************************** //Link Menu //****************************************************************************** AYATEMPLATE.LinkMenuConvert { _text = '' _data = IARRAY for _i = 0 ; _i < _argc ; _i++ { _data = (RE_SPLIT(_argv[_i],'[ \t]*\|[ \t]*'),'','')//ダミー _text += "%(_data[0])%(CHR(1))%(_data[1])%(CHR(1))%(_data[2])%(CHR(1))%(CHR(2))" } _text } //****************************************************************************** //Switching Core //****************************************************************************** AYATEMPLATE.ExecuteChangeCallTalk { AYATEMPLATE.ExecuteGhostNameFunc(_argv[0],reference[0],_argv[1]) } //****************************************************************************** //Switching/Community Common Core (Function call with ghost name) //_argv[0] Function name base //_argv[1] Ghost name (system character escaped automatically) // If ghost name is empty, evaluate _argv[2] // If there is no function with "Function name base + ghost name", use "Base Other" //_argv[2] If the above function does not exist, the name of the function to call (Optional) //****************************************************************************** AYATEMPLATE.ExecuteGhostNameFunc { _ghostname = SHIORI3FW.TranslateSystemChar(_argv[1]) if _ghostname != '' { _funcname = "%(_argv[0])_%(_ghostname)" if ISFUNC(_funcname) { _script = EVAL(_funcname) if STRLEN(_script) != 0 { _script return } } _funcname = "%(_argv[0])Other" if ISFUNC(_funcname) { _script = EVAL(_funcname) if STRLEN(_script) != 0 { _script return } } } if _argc >= 2 { _funcname = _argv[2] if (STRLEN(_funcname) > 0) && ISFUNC(_funcname) { _script = EVAL(_argv[2]) if STRLEN(_script) != 0 { REPLACE(_script,"\-","") return } } } } //****************************************************************************** //Community relations //****************************************************************************** //Start a conversation AYATEMPLATE.ExecuteTalkToTalk { //First, decide who to talk to _ghostname=AYATEMPLATE.GetRandomSakuraName() res_reference0=_ghostname DUMPVAR() //Function calls using a common core AYATEMPLATE.ExecuteGhostNameFunc('TalkTo',_ghostname,'TalkToNobody') } //Respond to conversations AYATEMPLATE.ExecuteReplyToTalk { AYATEMPLATE.ExecuteGhostNameFunc('ReplyTo',_argv[0]) } //Randomly choose who to talk to AYATEMPLATE.GetRandomSakuraName { _ghostlist=IARRAY //If FMO is available, read from FMO if ISFUNC('SHIORI3FW.RefreshFMOTable') { SHIORI3FW.RefreshFMOTable _ghostlist=SHIORI3FW.SakuraNameList }else{ _ghostlist=ghostexlist } if ARRAYSIZE(_ghostlist)>0 { ANY(_ghostlist) }else{ '' } } //Get ghost list during startup On_otherghostname { // Create a list of currently active ghosts ghostexlist = reference ghostexcount = ARRAYSIZE(ghostexlist) SHIORI3FW.RegisterTempVar('ghostexlist', 'ghostexcount') } //****************************************************************************** //Mouse Event Core //****************************************************************************** AYATEMPLATE.MouseEventExec { _fname = _argv[0] + TOSTR(reference[3]) + TOSTR(reference[4]) if ISFUNC(_fname) { EVAL(_fname) return } _fname = _argv[0] + TOSTR(reference[3]) if ISFUNC(_fname) { EVAL(_fname) return } } AYATEMPLATE.MouseMoveWheelFunc { _side = TOINT(reference[3]) if _argv[0] { _side += 10 } if AYATEMPLATE.strokeid[_side] == reference[4] { if (GETTICKCOUNT - TOINT(AYATEMPLATE.stroketimer[_side])) > 1500 { AYATEMPLATE.stroke[_side] = 1 } AYATEMPLATE.stroketimer[_side] = GETTICKCOUNT _stroke = TOINT(AYATEMPLATE.stroke[_side]) _stroke += 1 AYATEMPLATE.stroke[_side] = _stroke if _stroke >= _argv[1] { if 'talking' !_in_ status { AYATEMPLATE.MouseEventExec(_argv[2]) AYATEMPLATE.stroke[_side] = 1 } } } else { AYATEMPLATE.stroke[_side] = 1 AYATEMPLATE.stroketimer[_side] = GETTICKCOUNT AYATEMPLATE.strokeid[_side] = reference[4] } } //------------------------------------------------------------------------------ //Plugins //------------------------------------------------------------------------------ On_installedplugin : void { _n = ARRAYSIZE(reference) AYATEMPLATE.installedplugin_name = IARRAY AYATEMPLATE.installedplugin_id = IARRAY for _i = 0 ; _i < _n ; _i++ { _a = RE_SPLIT(reference[_i],'[,\x1]') AYATEMPLATE.installedplugin_name ,= _a[0] AYATEMPLATE.installedplugin_id ,= _a[1] } } AYATEMPLATE.IsPluginExist { if _argc == 0 { 0 return } if ASEARCH(_argv[0],AYATEMPLATE.installedplugin_id) >= 0 { 1 return } if ASEARCH(_argv[0],AYATEMPLATE.installedplugin_name) >= 0 { 1 return } 0 }