精華區beta mud_sanc 關於我們 聯絡資訊
小小的修正:讓它可以抓到背景顏色。 ---------------------------------------- <triggers> --捕獲to chat 訊息,name:chlogging <trigger enabled="n" expand_variables="y" group="chlog" keep_evaluating="y" match="^.*$" name="chlogging" script="color_chats" regexp="y" sequence="100" > </trigger> --結束捕獲to chat,關閉chlogging <trigger enabled="y" group="chlog" keep_evaluating="y" match="^﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎﹎$" name="chlogend" regexp="y" repeat="y" send_to="12" sequence="100" > <send>SetTriggerOption('chlogging','enabled','N')</send> </trigger> --開始捕獲to chat,打開chlogging <trigger enabled="y" group="chlog" lines_to_match="3" keep_evaluating="y" match="【閒聊─[^\n]+\n﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊﹊ \n.*\n" multi_line="y" script="color_chats" name="chlogopen" regexp="y" send_to="12" sequence="100" > <send> SetTriggerOption('chlogging','enabled','Y') --防止關閉to chat失敗,五秒後再關一次。 DoAfterSpecial(5,"SetTriggerOption('chlogging','enabled','N')",12) </send> </trigger> --捕獲一般單行訊息。 <trigger enabled="y" match="^(&gt;)*( )*(.*偷偷的告訴|〔隊伍頻道〕|.*大呼:|$友克鑫拍賣|【聖殿八 卦|.*\)說道:|.*頻道-|【閒聊)" omit_from_output="n" regexp="y" script="color_chats" sequence="100" > </trigger> </triggers> <!-- Script --> <script> <![CDATA[ local conversion= { ['black'] = ANSI (30,22), ['maroon'] = ANSI (31,22), ['green'] = ANSI (32,22), ['olive'] = ANSI (33,22), ['navy'] = ANSI (34,22), ['purple'] = ANSI (35,22), ['teal'] = ANSI (36,22), ['silver'] = ANSI (37,22), --以下高亮 ['gray'] = ANSI (30,1), ['red'] = ANSI (31,1), ['lime'] = ANSI (32,1), ['yellow'] = ANSI (33,1), ['blue'] = ANSI (34,1), ['magenta'] = ANSI (35,1), ['cyan'] = ANSI (36,1), ['white'] = ANSI (37,1), } -- 前景 local BACKconversion= { ['black'] = ANSI (40), ['maroon'] = ANSI (41), ['green'] = ANSI (42), ['olive'] = ANSI (43), ['navy'] = ANSI (44), ['purple'] = ANSI (45), ['teal'] = ANSI (46), ['silver'] = ANSI (47), } --背景 chat_world = "sanc_chat_list" --聊天訊息輸出視窗。 Listen_Player = 'hmml5'--補捉訊息的角色。 local first_time = true --不管它,不要改。 function color_chats (name, line, wildcards, styles) -- 試著找到 "chat_ world" local w = GetWorld (chat_world) -- get "chat" world -- 如果找不到,試著去打開它 if first_time and not w then local filename = GetInfo (67) .. chat_world .. ".mcl" Open (filename) w = GetWorld (chat_world) -- 再試一次 if not w then ColourNote ("white", "red", "無法打開指定的檔案:" .. filename) first_time = false -- don't repeatedly show failure message end -- 找不到 end -- can't find world first time around if w then -- 如果存在,w就是存著'chat_world' ID值的變數。 if GetAlphaOption("player") == Listen_Player then --顯示時間 w:Simulate(ANSI (32, 40,1)..os.date ("[%dD %H:%M>")) for _, v in ipairs (styles) do --顯示內容 Colour_Code = conversion[RGBColourToName(v.textcolour)].. BACKconversion[RGBColourToName (v.backcolour)] w:Simulate(Colour_Code..v.text) --內容 end -- for each style run end -- ID end -- world found end -- function redirect ]]> </script> ---------------------------------------- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.132.196.45