|
发表于 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. |
|