|
发表于 2019-3-8 11:40:25
|
显示全部楼层
任惊鸿,我帮你重新编辑一下,方便对MUSH不懂的筒子们
function exe(cmd)
if GetConnectDuration() == 0 then
return Connect()
end
if cmd==nil then cmd='look' end
local l_strCmd=cmd..';'
local l_thisCmdCnt=0
for v in string.gmatch(l_strCmd,"[^;];") do
--print(v)
l_thisCmdCnt=l_thisCmdCnt+1
end
local l_waitTime=0.0001
--print(l_thisCmdCnt)
local l_curTime=socket.gettime()
local l_lenTable=table.getn(lstCmdSend)
for i=1,l_lenTable -1 do
local l_tmp1=lstCmdSend[l_lenTable]-lstCmdSend[i]+l_thisCmdCnt
local l_tmp2=l_curTime-lstCmdSendTime[i]
if l_tmp1>80 and l_tmp2 < (l_tmp1/75.0)*3 then
if (l_tmp1/80.0)*3-l_tmp2 > l_waitTime then
l_waitTime=(l_tmp1/80.0)*3-l_tmp2
end
end
end
--print('l_waitTime='..l_waitTime)
if (l_waitTime>0.01) then
EnableTimer('walkwait',false)
wait.make(function()
wait.time(l_waitTime)
Execute(cmd)
if road.i<=table.getn(road.detail) then EnableTimer('walkwait',true) end
end)
else
Execute(cmd)
end
if l_thisCmdCnt<5 then
l_CmdCnt=l_CmdCnt+l_thisCmdCnt
lstCmdSend[l_lenTable]=l_CmdCnt
lstCmdSendTime[l_lenTable]=l_curTime
else
if table.getn(lstCmdSend)>=10 then
table.remove(lstCmdSend,1)
table.remove(lstCmdSendTime,1)
end
l_CmdCnt=l_CmdCnt+l_thisCmdCnt
table.insert(lstCmdSend,l_CmdCnt)
table.insert(lstCmdSendTime,l_curTime)
end
--print("curTime="..l_curTime.." cmd="..cmd.." l_CmdCnt="..l_CmdCnt)
end
以上这一段替换lujing.lu里的function exe(cmd),print我替你编辑的时候直接注释掉了
l_CmdCnt=0
lstCmdSend={}
lstCmdSendTime={} -------------------------这一段加在lujing.lua的顶部
shujian.lua里的顶部:require "socket"
shujian.lua里找到function main(),加入下面的内容,不是替换啊,只是加进去下面这一段
l_CmdCnt=0
lstCmdSend[1]=0
lstCmdSendTime[1]=socket.gettime()
|
评分
-
1
查看全部评分
-
|