pizzagoo 发表于 2010-11-27 12:38:05

如果是mush的话,我这里有个现成的,我自己写的。
触发器:
<triggers>
<trigger
   enabled="y"
   match="^[&gt;]*\s*看起来(.*)想杀死你!.*$"
   regexp="y"
   send_to="12"
   sequence="999"
>
<send>BeKilledBy("%1")</send>
</trigger>
</triggers>

<triggers>
<trigger
   enabled="y"
   keep_evaluating="y"
   match="^[&gt;]*(\S*)\s*=\s*(\w*\s*\w*).*$"
   regexp="y"
   repeat="y"
   send_to="12"
   sequence="999"
>
<send>CheckKiller("%1","%2")</send>
</trigger>
</triggers>

脚本函数:
function BeKilledBy(name)
        Killername = name;
        DoAfter(0.3,"id here");
end

function CheckKiller(name,id)
        if (name == Killername) then
                temp = split(id,",");
                if (table.getn(temp) > 0) then
                        StartFight(temp,0.1);
                end
        end
end

function StartFight(name,tm)

        pfbusy = GetAliasInfo("pfbusy",2)
        if (pfbusy ~= nil) then
                if (string.sub(pfbusy,string.len(pfbusy)) == "1") then
                        pfbusy = string.sub(pfbusy,1,sttring.len(pfbusy) - 2) .. name;
                end
                DoAfterSpecial(tm,"RunBusyPerform(\"busy_timer\",\""..pfbusy.."\")",12);
        end
        pfbusy1 = GetAliasInfo("pfbusy1",2)
        if (pfbusy1 ~= nil) then
                if (string.sub(pfbusy1,string.len(pfbusy1)) == "1") then
                        pfbusy1 = string.sub(pfbusy1,1,string.len(pfbusy1) - 2) .. name;
                end
                DoAfterSpecial(tm+0.5,"RunBusyPerform(\"busy_timer1\",\""..pfbusy1.."\")",12);
        end

        AddTimer("ls_timer",0,0,1,"yun recover\nyun regenerate",1,"")
end

我这里没有叫杀,而是被叫杀的时候启动战斗。 战斗的话,就是设置出busy perform的timer(支持2个),以及每秒一次的吸气。

pizzagoo 发表于 2010-11-27 12:40:16

还有两个方法,

function RunBusyPerform(name,pfbusy)
        AddTimer(name,0,0,1,pfbusy,1,"")
end


function split(szFullString, szSeparator)
local nFindStartIndex = 1
local nSplitIndex = 1
local nSplitArray = {}
while true do
   local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
   if not nFindLastIndex then
    nSplitArray = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
    break
   end
   nSplitArray = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
   nFindStartIndex = nFindLastIndex + string.len(szSeparator)
   nSplitIndex = nSplitIndex + 1
end
return nSplitArray
end
页: 1 [2]
查看完整版本: 请教下一个抓id的触发难题