|
发表于 2019-3-2 12:52:00
|
显示全部楼层
path_start里面:
function path_start()
--print("run path_start")
EnableTrigger("hp12",false)
EnableTimer("roadWait",false)
DeleteTimer("roadWait",false)
local l_road
road.i=road.i + 1
if flag.find==1 then return end
if road.i>table.getn(road.detail) then
locate()
--if job.name=='huashan' then
-- return road.act()
--else
return check_halt(go_confirm)
--end
end
l_road=road.detail[road.i]
if string.find(l_road,'#') then
local _,_,func,params = string.find(l_road,"^#(%a%w*)%s*(.-)$")
if func then
return _G[func](params)
end
else
local l_len=string.len(l_road)
if string.sub(l_road,-1,-1)==';' then l_road=string.sub(l_road,1,l_len-1) end
exe(l_road)
exe('yun jingli')
return walk_wait()
end
end
红色部分是我改动的
还有function path_create()
function path_create()
local l_set
local l_num=0
local l_cnt=1
local l_cntt=1
road.detail={}
l_sett=0
l_settt=0
l_path=path_cal()
--Note(l_path)
if type(l_path)~='string' then
if math.random(1,4)==1 then
l_path='stand;out;northeast;northwest;southeast;southwest;south;south;south;south;south'
elseif math.random(1,4)==2 then
l_path='stand;out;northeast;northwest;southeast;southwest;east;east;east;east;east;east'
elseif math.random(1,4)==3 then
l_path='stand;out;northeast;northwest;southeast;southwest;west;west;west;west;west;west'
else
l_path='stand;out;northeast;northwest;southeast;southwest;north;north;north;north;north'
end
end
l_set=utils.split(l_path,';') --一个alias里有几个命令
l_settt=table.getn(l_set)
--print(l_path)
if wdgostart==1 then
if l_settt<= wd_distance then l_settt=wd_distance end
for i=1,table.getn(l_set) do
if i<l_settt-wd_distance-2 then
if string.find(l_set,'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set
else
if string.sub(road.detail[l_cnt],-1,-1)==';' then
road.detail[l_cnt]=road.detail[l_cnt]..l_set
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set
end
end
l_num=l_num+1
if l_num>road.steps then
l_cnt=l_cnt+1
l_num=0
end
end
else
if string.find(l_set,'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set
else
if string.sub(road.detail[l_cnt],-1,-1)==';' then
road.detail[l_cnt]=road.detail[l_cnt]..l_set
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set
end
end
l_num=l_num+1
if l_num>0 then
l_cnt=l_cnt+1
l_num=0
end
end
end
end
else
for i=1,table.getn(l_set) do
if string.find(l_set,'#') then
if l_num>0 then
l_cnt=l_cnt+1
end
road.detail[l_cnt]=l_set
l_cnt=l_cnt+1
l_num=0
else
if l_num==0 then
road.detail[l_cnt]=l_set
else
if string.sub(road.detail[l_cnt],-1,-1)==';' then
road.detail[l_cnt]=road.detail[l_cnt]..l_set
else
road.detail[l_cnt]=road.detail[l_cnt]..';'..l_set
end
end
l_num=l_num+1
if l_num>road.steps then
l_cnt=l_cnt+1
l_num=0
end
end
end
end
end |
|