Re: [心得] MUSHclient - Plugins:抓取聊天訊息
看板mud_sanc (Sanctuary - 聖殿)作者hmml (hmml)時間12年前 (2013/08/03 09:30)推噓1(1推 0噓 0→)留言1則, 1人參與討論串4/5 (看更多)
新增對指令 to chat 的支援。
-----------------------------------------------------------
<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="^(>)*( )*(.*偷偷的告訴|〔隊伍頻道〕|.*大呼:|$友克鑫拍賣|【聖殿八
卦|.*\)說道:|.*頻道-|【閒聊)"
omit_from_output="n"
regexp="y"
script="color_chats"
sequence="100"
>
</trigger>
</triggers>
<!-- Script -->
<script>
<![CDATA[
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),
} --色碼表。
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
w:Simulate(conversion[RGBColourToName(v.textcolour)]..v.text)
end -- for each style run
w:Simulate('\n')
end -- ID
end -- world found
end -- function redirect
]]>
</script>
-----------------------------------------------------------
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.132.196.45
推
08/06 10:16, , 1F
08/06 10:16, 1F
討論串 (同標題文章)
mud_sanc 近期熱門文章
PTT遊戲區 即時熱門文章
15
26