我贴下我写的遍历函数把.
function task.StartPath(cplace)
--中间一些初始化,根据cplace把地图路径存到task.PathTable
-- SlowWalk
Send("unset brief_all")
task[task.Type].Found = 0
task[task.Type].Step = 1
task.lijing.Judge = false
Execute("get jin dan from hua lan;get ren shen from hua lan;get ling zhi from hua lan;get jinchuang yao from hua lan;get hunyuan dan from hua lan")
task.FindPath()
end
function task.FindPath()
--slow walk first
if task[task.Type].Found == 1 then --找到怪了,停止走路
print("stop right now!")
EnableGroup("FindPath",false) --关走路class
EnableGroup("Task",true) --开灭妖class
Send("follow "..task[task.Type].EName) --follow怪
task[task.Type].HandleTarget() --开始灭妖
else
local PathTable = task.PathTable --没找到怪,指针加1
local PathStep = task.PathStep
PathStep = PathStep + 1
EnableGroup("FindPath",true)
if PathStep > #PathTable then --遍历整个地图都没找到,做异常处理
Execute("timeout")
else --否则继续走
task.PathStep = PathStep
Execute(PathTable[PathStep])
end
end
end