|
楼主 |
发表于 2010-1-7 08:44:03
|
显示全部楼层
原帖由 cid 于 2010-1-6 10:46 PM 发表
maper 老大,告诉我,这个东西怎么用?你放19个出来,教教我。。。
var mapper = new ActiveXObject("mapper.path");
function findpath_ready() {
cTrigger("findpath_ready","^(.*)\\((.*)\\)告诉你:(.*)$","","findpath");
}
/**查找路径**/
function findpath(name, line, wildcards) {
var wcs = VBArray(wildcards).toArray();
var msg = wcs[2].split(/\s/);
var replytxt = "";
if (msg[0] == "path") {
var p = msg[1].split("-");
if (p.length == 2) {
if (p[0] == p[1]) {
replytxt += "消遣大爷啊,已经到了,还查!";
} else {
mapper.getidfrname(p[0]);
var res0 = mapper.result;
mapper.getidfrname(p[1]);
var res1 = mapper.result;
if (res0.split(";").length != 2 || res1.split(";").length != 2) {
if (res0.split(";").length != 2) {
replytxt += p[0] + "不存在或不唯一";
}
if (res1.split(";").length != 2) {
replytxt += p[1] + "不存在或不唯一";
}
replytxt += ",请往四周走走,找到唯一存在的房间!";
} else {
mapper.search(res0.split(";")[0],res1.split(";")[0]);
var res = mapper.result;
replytxt += p[0] + "->" + p[1] + ":" + res.replace(/\\/g,";");
}
}
} else {
replytxt += "tell xxx path 地名1-地名2";
}
Send("reply " + replytxt);
//debug("path","(" + wcs[9] + "):::" + replytxt);
world.AppendToNotepad("path", Date() + "-" + "(" + wcs[9] + "):::" + replytxt + "\r\n");
}
}
/**创建一个临时触发器**/
function cTrigger(t_name, t_match, t_response, t_function) {
var ret = 0;
//t_name += GetUniqueNumber();
ret = AddTriggerEx(t_name, t_match, t_response, 1 | 8 | 32 | 1024 | 16384,
-1, 0, "", t_function, 0, 100);
if (ret > 0) {
Note("--建立持续性触发器【" + t_name + "】失败 ," + "错误号:" + ret);
}
} |
|