找回密码
 注册
搜索
楼主: llqwin@ts

mush教程谁有?

[复制链接]
门派:不明
发表于 2015-3-10 18:24:23 | 显示全部楼层
今天大概研究了一下,估计写个武馆问题不大了,但具体的还得研究
主要目标是画地图首先
门派:不明
发表于 2015-3-10 23:21:21 | 显示全部楼层
学习学习                  
门派:不明
发表于 2015-3-11 13:45:01 | 显示全部楼层
ltblue@tx 发表于 2015-3-10 18:24
今天大概研究了一下,估计写个武馆问题不大了,但具体的还得研究
主要目标是画地图首先

MUD地图都有了
书剑的现在有现成的
目前panxi、renlai、swf都有写过基础是秋猫的MC通用机器
门派:不明
发表于 2015-3-11 13:49:59 | 显示全部楼层
有兴趣可以一起研究MUSH,我也在研究。
门派:不明
发表于 2015-3-11 13:51:04 | 显示全部楼层
ice@test 发表于 2015-3-11 13:45
MUD地图都有了
书剑的现在有现成的
目前panxi、renlai、swf都有写过基础是秋猫的MC通用机器

多谢
不过貌似没人讨论这个问题
我只好去pku去学习
门派:不明
发表于 2015-3-11 14:16:59 | 显示全部楼层
ice@test 发表于 2015-3-11 13:49
有兴趣可以一起研究MUSH,我也在研究。

现在一个问题是
我能否在现有的插件中学到什么?
貌似只要封装到插件里,就没法看到各种触发了
只能看到个xml,感觉看起来特别累,而且看不懂
你是怎么研究的?讲讲经验呗
门派:不明
发表于 2015-3-23 08:55:09 | 显示全部楼层
ltblue@tx 发表于 2015-3-11 14:16
现在一个问题是
我能否在现有的插件中学到什么?
貌似只要封装到插件里,就没法看到各种触发了

其实各部分大侠们都弄好了
首先我们要了解LUA的构成,写法
然后我们看的就不会云里雾里了
你看大侠们封装的程序也基本能看明白了。
门派:不明
发表于 2015-3-23 08:56:41 | 显示全部楼层
ltblue@tx 发表于 2015-3-11 14:16
现在一个问题是
我能否在现有的插件中学到什么?
貌似只要封装到插件里,就没法看到各种触发了

  local l,w=wait.regexp("^(> |)你给(.*)一块未知矿石。$|^(> |)你身上没有这样东西。$",5)
                if l==nil then
                    self:reward()
                    return
                 end
                 if string.find(l,"一块未知矿石") then
                    if w[2]=="铁匠" then
                       self:jobDone()
                        else
                           self:giveup()
                        end
                    return
比如这就是MUSH中的触发。你应该就很清楚了
门派:不明
发表于 2015-3-23 09:00:04 | 显示全部楼层
这是我写的


function lookroom(where)
        if where=="" then       
                where=vil;
        end
        local roomnow={};
        local roomall={};
        roomnow.name="";
        roomnow.area="";
        roomnow.descriptions={};
        roomnow.exits={};
        roomnow.location={};
        local exithere="";
        Send("club ");
        if where then
                Send("look " .. where);
        else
                Send("look");
        end
        Send("@@");
        local i=0;
        l,w = wait.regexp("你晃动着手中的木棒,到处寻找目标。");
        while true do
              l,w = wait.regexp(".*");
        if string.find(l,"你的一双眼睛瞪得比铜铃还大!")  then
                        table.insert(roomall,"END");
                        break;
                end
                table.insert(roomall,l);
    end
        local descriptions_start_line,descriptions_end_line=9999,9999;                                                --初始设定描述行的起始和终点行数
        if string.find(roomall[1],"【你现在正处于(.+)】") then
                _,_,roomnow.area=string.find(roomall[1],"【你现在正处于(.+)】");                        --第一行是地区
        else
                print("警告!没找到本房间的地区");
                return;
        end
        i=1;
        while true        do                                                                                                                                        --从第二行开始搜索,直到找到房间名,并将之前确定为位置
                i=i+1;       
                if string.find(roomall[i],"^>*%s*(.-)%s%-%s*$") then
                        _,_,roomnow.name=string.find(roomall[i],"^>*%s*(.-)%s%-%s*$");
                        descriptions_start_line=i+1;
                        break;
                end
                if roomall[i]=="END" then
                        print("警告!没找到本房间的名称");
                        return;
                end
        end
       
        for i=2,descriptions_start_line-2 do                                                                                        --从第二行到房间名,都是位置
                table.insert(roomnow.location,cutstr(roomall[i]));
        end
       
        i=descriptions_start_line;                                                                                                                --从房间名的下一行开始,一直找到有空格的地方,都是描述
        while true do
                table.insert(roomnow.descriptions,cutstr(roomall[i]));
                if        string.find(roomall[i+1],"^>*%s%s%s+.*$") or string.find(roomall[i+1],"^>* .*$") then
                        descriptions_end_line=i;
                        --print(string.byte(roomall[i+1],1,10));
                        --print(roomall[i+1]);
                        break;
                else
                        i=i+1;
                        if roomall[i]=="END" then
                                print("警告!没找到本房间描述的末尾,错误");
                                return;
                        end
                end
        end
       
        i=descriptions_end_line+1;
        while true        do
                if string.find(roomall[i],"^>*%s*这里.-的出口是(.*)$") then
                        if string.sub(roomall[i],-2)=="。" then
                                _,_,exithere=string.find(roomall[i],"^>*%s*这里.-的出口是(.-)。$");
                               
                        else
                                _,_,exithere=string.find(roomall[i],"^>*%s*这里.-的出口是(.*)$");
                                exithere=exithere .. cutstr(string.sub(roomall[i+1],1,-3));
                        end
                        break;
                else
                        i=i+1;
                        if roomall[i]=="END" then
                                print("警告!没找到本房间的出口")
                                return;
                        end
                end
        end
        exithere=string.gsub(exithere,"和","、")
        while true do
                if splitstr(exithere,"、",1) then
                        local exit;
                        exit,exithere=splitstr(exithere,"、",1);
                        roomnow.exits[exit]={};
                        if exitcmds[exit] then
                                roomnow.exits[exit].cmd=exitcmds[exit];
                        else
                                print("方向" .. exit .. "的命令不存在");
                        end
                else
                        break;
                end
        end
        table.sort(roomnow);
        return 1,roomnow;
end
门派:不明
发表于 2015-3-23 09:00:54 | 显示全部楼层
ice@test 发表于 2015-3-23 08:56
local l,w=wait.regexp("^(> |)你给(.*)一块未知矿石。$|^(> |)你身上没有这样东西。$",5)
                if l==ni ...

触发真心看不懂,我觉得基本要放弃mush里的触发了,都改到lua里了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|书剑永恒MUD ( 闽ICP备14012032号|闽公网安备 35050202000162号 )

GMT+8, 2025-7-26 23:00 , Processed in 0.025002 second(s), 23 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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