北大侠客行MUD论坛

 找回密码
 注册
搜索
热搜: 新手 wiki 升级
查看: 6227|回复: 15

有人会用zmud的mapper么?

[复制链接]
发表于 2008-5-24 22:38:39 | 显示全部楼层 |阅读模式
zmud 462的automapper可以用通配符配置,虽然不太直观但是够灵活。但是462的automapper不能解su、ed之类方向的问题,而且无法导出数据,所以没什么用处。

今天稍微试了试zmud 721的automapper,发现721抓取roomname什么的竟然是通过指定第几行第几段来实现,反而不会用了。有没有知道咋才能在721里实现像462那样的配置?

thanks~
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2008-5-24 22:54:49 | 显示全部楼层
一会我研究一下看看。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2008-5-25 00:29:01 | 显示全部楼层
又折腾了半天,搞不懂,像462那样多好。。。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2008-5-25 04:09:48 | 显示全部楼层
TAG

Syntax: #TAG line-kind [parameters]


Allows you to override the normal operation of the automapper.  This powerful command allows you to tell the mapper what kind of line it has received and specify optional parameters for that line type.  The line-kind argument is the type of line the MUD just sent.  It can contain one or more of the following values, separated by commas (no spaces):

name        the name of the room
desc        the room description
exit        the room exit information
vnum        the virtual room number
flags        flag settings for the room
prompt        the MUD prompt
descpara        the entire paragraph is the room description
exitpara        the entire paragraph is the exit information

When tagging a line, the mapper will normally use the entire line for the value of the tag.  For example, if you tag a line as a Name, the entire line will be used as the room name.  You can override this by specifying the room name as the optional parameter of the tag command.  Each line-type can take a parameter.  Parameters should be given in the same order that the line-kind values are given.  Normally, these parameters are not evaluated or expanded since they represent literal text from the MUD.  However, if an argument is a single variable reference, then the variable will be expanded.

Note that after setting up triggers using the TAG command, you should then Reconfigure the mapper so that it sets itself up properly.

TAG example

#TAG Name

Tags the current line as the name of the room

#TRIGGER {~[(*)~]} {#TAG name %1}

Sets up a trigger to look for the pattern: [text].  This line is flagged as a room name, and the text within the brackets is sent to the mapper as the actual name of the room

#TRIGGER {^~>} {#TAG prompt}

Tags a line starting with a > as the MUD prompt

#TRIGGER {(*) ~[(*)~] ~#(%d)} {#TAG name,exit,vnum {%1} {%2} {%3}}

This complex trigger looks for a line of the format:
Room Name [exits] #num
and captures the room name, exit information, and vnum information for the mapper.

#TRIGGER {^#(%d)} {#VAR RoomName %concat("Room ",%1);#TAG name {@RoomName}}

This will look for a line that starts with "#nnn" where nnn is a room number (like #123).  The number is captured and appended to "Room " and stored into the variable called RoomName.  So, if the line from the MUD was #123, then @RoomName will be "Room 123".  The #TAG command uses the value of @RoomName to set the room name.  Since the argument for #TAG is a single variable reference, it is expanded properly.
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2008-5-25 04:09:55 | 显示全部楼层
hiahia
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2008-5-25 08:19:00 | 显示全部楼层
这个命令俺也找着了,不过还是很麻烦,继续试吧。。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2008-5-25 14:50:52 | 显示全部楼层
有这个已经可以保证生成正确的ROOM NAME信息了。描述和出口我有个大概的思路,一会再试试。-
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2008-5-25 16:16:08 | 显示全部楼层
  1. #VAR vdesc "";
  2. #TRIGGER "EffCap" {(*)} {#additem vdesc "%1"} "" {disable};
  3. #TRIGGER {^(*) -} {#tag name %1;#var vdesc "";#t+ EffCap};
  4. #COND {^%s这里*出口是(*)} {#t- EffCap;#tag exit "%1";#tag desc @vdesc};
复制代码
这个已经差不多可以用了,不过还是有不完善的地方。
additem那一句抓不到空白行,像梅庄、少林、岳王墓一类的地方,有可能会出问题。
zmud的string list是用|当分隔符,简单replace成\n不知道好不好使,没找到zmud有像join那样的函数。
抓下来的描述信息里包括了出口和天色,出口是应该删掉的,天色因为可以用来判断室内室外,或许留个标记比较好。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
 楼主| 发表于 2008-5-25 16:22:27 | 显示全部楼层
BTW,462的mapper画出来会自动调整房间位置,防止覆盖,721反而不行了,也是个麻烦。。
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
发表于 2008-5-25 16:56:20 | 显示全部楼层
刚刚测试完,ZMUD下的regexp支持多行触发
北大侠客行Mud(pkuxkx.com),最好的中文Mud游戏!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|北大侠客行MUD ( 京ICP备16065414号-1 )

GMT+8, 2024-11-28 01:39 AM , Processed in 0.010652 second(s), 14 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表