找回密码
 注册
搜索
查看: 1210|回复: 14

求帮助啊。帮看看这个

[复制链接]
门派:古墓派
发表于 2017-7-18 08:18:15 | 显示全部楼层 |阅读模式
错误号: 0
事件:        Run-time error
描述:  C:\MUSHS\lua\lujinggm.lua:752: attempt to index field '?' (a nil value)

stack traceback:

        C:\MUSHS\lua\lujinggm.lua:752: in function 'FastDFS'

        C:\MUSHS\lua\lujinggm.lua:736: in function 'searchPre'

        C:\MUSHS\lua\lujinggm.lua:793: in function <C:\MUSHS\lua\lujinggm.lua:789>

        (tail call): ?

        (tail call): ?

        (tail call): ?

        (tail call): ?
调用者:    Function/Sub: haltok called by trigger

Reason: 正在处理触发器 "check_halt1"


一晚上出现十次左右。。。
门派:少林派
发表于 2017-7-18 09:18:01 来自手机 | 显示全部楼层
看不懂,等大神来                     
门派:少林派
发表于 2017-7-18 09:18:31 来自手机 | 显示全部楼层
反正我只知道这是你路径出问题了                        
门派:古墓派
 楼主| 发表于 2017-7-18 09:33:13 | 显示全部楼层
- - 我也知道是路径问题。。。。
门派:古墓派
 楼主| 发表于 2017-7-18 09:38:30 | 显示全部楼层
        visited={}

        for i=1 ,countTab(newrooms) do
                visited[i]=false --初始化所有节点未曾访问
        end
       
这是736--793 的数据。。帮看看
        if not visited[1] then
                FastDFS(myrt,1) --计算起点的连通图
        end
        for i=1 ,countTab(newrooms) do
                if visited[i]==false then--未曾访问的节点测试一下跟第一个起点的连通性,如果能联通,则递归这个节点
                        local path, len = map:getPath(myrt[1].index,myrt[i].index)
                        if path then
                                FastDFS(myrt,i) --继续遍历指定的myrt[i]这个节点
                                --messageShow("发现通路,遍历下一个节点!通路长度="..len,"red")
                        end
                end
        end
        --messageShow("【"..job.name.."】深度优先计算结束,遍历【"..roomsnum.."】个房间,用时【"..os.clock()-starttime.."】秒","SandyBrown")
end
function FastDFS(myrt,i)
        visited[i] = true          --设置下标为I的顶点为已访问  
    --Note("myrt["..i.."]="..myrt[i].index)  --输出顶点信息
    table.insert(road.rooms,myrt[i].index)
        local p = myrt[i].pnext --下一个边表结点  
        if p==nil then return end
    while p~=nil do   
      
        if(not visited[p.index]) then--如果是未访问的则递归
                        visited[p.index]=true
            FastDFS(myrt,p.index)
                end
        p = p.pnext
               
    end  
end
function dfs(from)
    for i=1,countTab(tmp.to) do
                if not tmp.to then
                        break
                end
                local l_dest,l_p=getNearRoom(from,tmp.to)
                if l_dest then
                        local l_check = true
                        for v in pairs(road.rooms) do
                                if v==l_dest then
                                        l_check = false
                                end
                        end
                        if l_check then
                                local path, len = map:getPath(from,l_dest)
                                if path then
                                   table.insert(road.rooms,l_dest)
                                   table.remove(tmp.to,l_p)
                                   dfs(l_dest)
                                end
                        end
                end
        end
end
function search()
        --Note("run search")
    tmp.find = true
    if flag.find==1 then return end
    searchPre()
        cntr1 = countR(15)
    exe('look;halt')
    return check_halt(searchStart,1)
end

门派:铁掌帮
发表于 2017-7-18 10:39:38 | 显示全部楼层
让风神帮你看吧 我看不懂
门派:铁掌帮
发表于 2017-7-18 10:40:16 | 显示全部楼层
woshicy@tj 发表于 2017-7-18 09:18
看不懂,等大神来

你不是大神嘛 你肯定看得懂
门派:铁掌帮
发表于 2017-7-18 10:40:51 | 显示全部楼层
woshicy@tj 发表于 2017-7-18 09:18
反正我只知道这是你路径出问题了

这个地球人都知道的   
门派:铁掌帮
发表于 2017-7-18 10:41:32 | 显示全部楼层
axxj@tj 发表于 2017-7-18 09:33
- - 我也知道是路径问题。。。。

那你就想想你改了什么地方了?
门派:铁掌帮
发表于 2017-7-18 10:47:53 | 显示全部楼层
axxj@tj 发表于 2017-7-18 09:38
visited={}

        for i=1 ,countTab(newrooms) do

恩就是鬼画符的天书啊 表示无奈
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-10 05:06 , Processed in 0.094924 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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