作者hmml (hmml)
看板mud_sanc
标题Re: [心得] MUSHclient - Plugins:抓取聊天讯息
时间Wed Jun 19 22:01:14 2013
之前的抓讯息 plugin,再修改一下,让被抓到聊天视窗的讯息,
可以做为触发句使用。
做法是将ColourTell 改成以 Simulate 显示内容,两者都具备堆
叠句子不自动换行功能,所以小小修改一下,利用Color_Copy的做法
就能做到了。
如果没有在聊天视窗建立触发的需求,建议用原版的,两者显示上
,原版可以显示底色,这个就不行,原版的应该也比较稳。
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
<triggers>
<trigger
enabled="y"
match="^(>)*( )*\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