在MushClient中抓取多行聊天信息并输出到另一个窗口
本帖最后由 xxhy 于 2021-10-27 06:56 AM 编辑对maper的聊天插件进行了升级,现在可以抓取到多行聊天信息了。
窃以为emote是Mud的精髓之一,以前的聊天插件只能抓取单行的聊天信息,不能抓取多行的,略有点遗憾,现在补齐。
具体用法可参见http://pkuxkx.net/forum/forum.php?mod=viewthread&tid=5292
我已经尽量列举了多行的emote,如果有遗漏,可以发到这里,或者自行在插件中添加:
multi_chat = {
"身形微晃,宛似晓风中一朵荷蕖,背影婀娜,姿态美妙,一阵",
"趴在地下,对空膜拜个不停,嘴里艾艾呀呀地嘟囔着",
"高兴的象一只快乐的小鸟,飞来飞去。",
"怒喝道:",
"确定一定以及肯定%S+是个猪头。",
"又在偷窥了.......",
"惊怒交集,立即拔出长剑,指着",
"祝北大侠客行所有玩家: ",
"对着%S+大叫道:",
"第三节 伸展运动",
"幽怨地唱道:",
"要饿死啦,走啦!吃饭啦!「人是铁,饭是钢!吃了才会硬梆梆!」,再见了!",
"跑来跑去,快乐得象一只小狗狗。",
"举起好大好大的铁锤!!哇!",
"一脸茫然~~~~~~~~~",
"愿意出卖良心,谁愿意出高价?出高点吧:",
"冲着众人露出那小馒头般的肌肉,高喊道:废才也有显摆的权利!!!",
"大叫一声:",
"埋头苦干,不一会敲出一段程序:",
"仰面朝天,一声怒吼:TNND,俺要拼命了!",
"送给%S+两个大字: ",
"揉了揉眼睛,高兴的做起了早操。",
"一言不发,掏出瑞士军刀唰唰七刀,留下了散落一地的",
"跳着脚义愤填膺地唱道:",
"忍俊不禁,笑道:你这不是癞蛤蟆想吃天鹅肉吗?",
"对著%S+狼嚎,呜~嗷~~,呜~嗷~~",
"正襟危坐,两手轻轻按在眉头,开始做眼保健操",
"猥琐地笑了...",
"得意的做出胜利的手势!",
"鄙视的看着%S+,大声说到:",
"飞起一脚,正好在%S+的屁股上贴上了一个明亮的鞋印。",
"把食指放在嘴边说道:嘘。。。小声点!大灰狼听到了会把你叼走的!",
"喃喃的说道:"
}
按上面的格式添加即可,正则可以用%S+来替代。
有问题请在这里反馈。
谢谢icer加精华{:7_280:} 窝的南瓜能抓了咩? 为啥不继续用maper啊 我简单测试了下
应该直接抓 【闲聊】 到下一个 > 就好了。
当然,> 会显示在 提示行,不回车,无法直接用触发处理
我自己的客户端是自己改了个回调出来。
mush的话需要做一个plugin
可以参考这个
<?xml version="1.0" encoding="iso-8859-1"?>
<muclient>
<plugin
name="prompt2newline"
id="9a541cf534fb864555f4cfba"
language="Lua"
author="jarlyyn"
date_written="2009-05-05 01:50:59"
requires="4.37"
version="1.0"
>
</plugin>
<script>
<![CDATA[
prompt=string.char("27").."%[256D"..string.char("27").."%[K"
function OnPluginPacketReceived(packet)
packet=string.gsub(packet,prompt,"\n")
return packet
end
]]>
</script>
</muclient>
https://github.com/jarlyyn/helllua/blob/master/prompt.xml
由于不是北侠的,实际的promot部分需要处理一下,你需要对ansi字符串有点了解
具体的函数介绍是
OnPluginPacketReceived
--
--MUSHclient has received the packet 'sText'
--
function OnPluginPacketReceived (sText)
end -- function
This function is called when each incoming packet (data) arrives from the MUD. A packet does not necessarily start or end on line boundaries, and may consist of partial text lines, or more than one line. If compression (MCCP) is active, the packet is the data after decompression.
Be warned that when compression is turned on, one packet may contain both uncompressed and compressed data (with the "turn on compression" sequence between them). Changing data in that packet may cause decompression to fail, if you alter the compressed part of the packet.
You can return data from this function (in version 3.59 onwards). If you do, then the returned data will replace the incoming data. In other words, you can change words, omit lines, add new lines, and MUSHclient will proceed as if the altered line had arrived from the MUD.
https://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks
farrr 发表于 2021-10-27 08:38 AM
窝的南瓜能抓了咩?
南帝是可以的 all 发表于 2021-10-27 08:39 AM
为啥不继续用maper啊
他已经转世重修了{:7_268:} jarlyyn 发表于 2021-10-27 08:37 PM
我简单测试了下
应该直接抓 【闲聊】 到下一个 > 就好了。
多谢大神提点,非常棒的思路!
页:
[1]