Re: [心得] MUSHclient - Plugins:抓取聊天訊息

看板mud_sanc (Sanctuary - 聖殿)作者 (hmml)時間12年前 (2013/06/19 22:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/5 (看更多)
  之前的抓訊息 plugin,再修改一下,讓被抓到聊天視窗的訊息, 可以做為觸發句使用。 做法是將ColourTell 改成以 Simulate 顯示內容,兩者都具備堆 疊句子不自動換行功能,所以小小修改一下,利用Color_Copy的做法 就能做到了。   如果沒有在聊天視窗建立觸發的需求,建議用原版的,兩者顯示上 ,原版可以顯示底色,這個就不行,原版的應該也比較穩。 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- <triggers> <trigger enabled="y" match="^(&gt;)*( )*\S*(偷偷的告訴|〔隊伍頻道〕|大呼:|$友克鑫拍賣|【聖殿八卦 |\)說道:|【封神榜頻道】|【閒聊)" omit_from_output="n" regexp="y" script="color_chats" sequence="100" > </trigger> </triggers> <!-- Script --> <script> <![CDATA[ chat_world = "Sanc_chat" Listen_Player = 'nsmv' local first_time = true local conversion = { ['black'] = ANSI(0)..ANSI (30), ['maroon'] = ANSI(0)..ANSI (31), ['green'] = ANSI(0)..ANSI (32), ['olive'] = ANSI(0)..ANSI (33), ['navy'] = ANSI(0)..ANSI (34), ['purple'] = ANSI(0)..ANSI (35), ['teal'] = ANSI(0)..ANSI (36), ['silver'] = ANSI(0)..ANSI (37), --以下高亮 ['gray'] = ANSI (30, 40,1), ['red'] = ANSI (31, 40,1), ['lime'] = ANSI (32, 40,1), ['yellow'] = ANSI (33, 40,1), ['blue'] = ANSI (34, 40,1), ['magenta'] = ANSI (35, 40,1), ['cyan'] = ANSI (36, 40,1), ['white'] = ANSI (37,40,1), } -- end conversion table function color_chats (name, line, wildcards, styles) -- 指定抓訊息的角色 if GetAlphaOption("player") == Listen_Player then -- 試著找到 "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值的變數。 w:Simulate(ANSI (32, 40,1)..os.date ("[%dD %H:%M>")) --時間 for _, v in ipairs (styles) do w:Simulate(conversion[RGBColourToName (v.textcolour)]..v.text) --內容 end -- for each style run w:Simulate('\n') -- 換行 end -- world found end -- ID end -- function redirect ]]> </script> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.233.202.51
文章代碼(AID): #1HmRcjY4 (mud_sanc)
文章代碼(AID): #1HmRcjY4 (mud_sanc)