作者rsliang (rsliang)
看板mud_jy
标题[心得] Mushclient撷取频道讯息的触发
时间Tue Sep 29 17:26:04 2015
说明:
一、弱弱的新手常常死,所以把频道讯息抓下来存档,只抓频道格式的讯息,tell
和reply也可以抓,但是找不到太好的方法避免tell的误抓,所以直接放弃,
以後有机会再来改XD
二、存档的判断句1073741824,是1GB左右的档案大小,用vi开就很吃力了,可以
改成1048576(1MB左右)。
PS1. 底下「.. logtime .. ".txt", 0)」这一段的断句是因为超出页面,如果贴上後不
能用,请在mushclient中移到上一行的最後面。
===================================触发======================================
<trigger
enabled="y"
group="Chatlog"
match="^(\> )*【(\S+)】(.*)$"
name="tunnel01"
regexp="y"
send_to="12"
sequence="100"
>
<send>
world = GetWorldById(GetWorldID())
if world.GetNotepadList() then
for k,v in pairs(world.GetNotepadList()) do
if v == "Jins-ChatLog" then
acted = 1
break
end
acted = 0
end
if acted == "0" then
world.ActivateNotepad("Jins-ChatLog")
end
else
world.ActivateNotepad("Jins-ChatLog")
end
tunnel = "%2"
msg = "%3"
if tunnel == "论道江湖" or tunnel == "谣言四起" or tunnel == "神话传说"
or tunnel == "天灾人祸" then
logtime = os.date("%Y-%m-%d-%H-%M-%S")
logmsg = logtime .. " 【" .. tunnel .. "】 " .. msg
world.AppendToNotepad("Jins-ChatLog", "\\r\\n" .. logmsg)
loglength = world.GetNotepadLength("Jins-ChatLog")
if tonumber(loglength) > 1073741824 then
world.SaveNotepad("Jins-ChatLog", "D:/MushClient/worlds/jins/Logs/"
.. logtime .. ".txt", 0)
world.CloseNotepad("Jins-ChatLog", 0)
end
end
</send>
</trigger>
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 112.104.181.23
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/mud_jy/M.1443518767.A.69C.html
※ 编辑: rsliang (112.104.181.23), 09/29/2015 17:31:07