找回密码
 注册
搜索
查看: 426|回复: 4

MUSH错误提示

[复制链接]
门派:星宿派
发表于 2019-8-6 09:01:49 | 显示全部楼层 |阅读模式
C:\MUSHS1\lua\show_switch.lua:1091: attempt to index field 'ENCB' (a nil value)
stack traceback:
        C:\MUSHS1\lua\show_switch.lua:1091: in function 'draw_bagwindow'
        [string "Script file"]:2768: in function <[string "Script file"]:2767>

请教一下这个要如何修改
门派:昆仑派
发表于 2019-8-6 13:28:06 | 显示全部楼层
调用checkbags出错了吧                  
门派:天龙寺
发表于 2019-8-6 14:28:18 | 显示全部楼层
show_switch.lua:1091: in function 'draw_bagwindow'

要贴出来看看具体代码
门派:星宿派
 楼主| 发表于 2019-8-6 14:38:57 | 显示全部楼层
以下是原码,论坛下的公版,我没修改过

function draw_bagwindow()
    if not flag_win_bag or flag_win_bag~=1 then
       if win_bag then
          WindowShow (win_bag, false)
       end
       return
    end
    if not Bag then
       return
    end
    local _bag_ch = {}
    local _bag_cn = {}
    for k,v in pairs(Bag) do
     if k~='ENCB' then
        table.insert(_bag_ch,k)
     end
    end
    for i=1,#_bag_ch do
            table.insert(_bag_cn,Bag[_bag_ch[i]]["cnt"])
    end
if win_bag_show == 0 then
    WINDOW_HEIGHT = 30
    WINDOW_WIDTH = 70
else
    WINDOW_HEIGHT = (math.ceil(#_bag_ch / 2) + 1)*15+40
    WINDOW_WIDTH = 190
end
    -- Create the window
--        WindowCreate (win_bag, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, WINDOW_POSITION, 4, 0x000010)  -- create window
  WindowCreate (win_bag,
                windowinfo_bag.window_left,
                windowinfo_bag.window_top,
                WINDOW_WIDTH,   
                WINDOW_HEIGHT,  
                windowinfo_bag.window_mode,
                windowinfo_bag.window_flags,
                0x000010)

        movewindow.save_state (win_bag)         
    -- define the fonts
        WindowFont (win_bag, "f1", FONT_NAME1, FONT_SIZE_12)
        WindowFont (win_bag, "f2", FONT_NAME2, FONT_SIZE_11)
        WindowFont (win_bag, "f3", FONT_NAME1, FONT_SIZE_12, true)
        WindowFont (win_bag, "f4", FONT_NAME3, FONT_SIZE_11, true)
        WindowFont (win_bag, "f5", FONT_NAME1, FONT_SIZE_11)

    -- work out how high the font is
        font_height = WindowFontInfo (win_bag, "f1", 1)   -- height of the font  

    -- draw the border of the whole box
        WindowCircleOp (win_bag, miniwin.circle_round_rectangle, 0, 2, WINDOW_WIDTH-2, WINDOW_HEIGHT, 0xc0c0c0, 0, 1,0, 0, 9, 9)

    -- ensure window visible
    local head_width   = (WINDOW_WIDTH - WindowTextWidth (win_bag, "f1", "物品列表"))/2
if win_bag_show == 0 then
  WindowAddHotspot(win_bag, "bag",  
                   0, 0, 0, 0,
                   "", -- mouseover (do nothing)
                   "", -- cancelmouseover (do nothing)
                   "",
                   "", -- cancelmousedown (do nothing)
                   "mouseup", -- mouseup (do nothing)
                   "点击关闭开启",    -- hint text if they hover over it              
                   0, 0)

    WindowText (win_bag, "f5",
                "物品列表",   -- text
                5, 9, 0, 0,        -- rectangle
                ColourNameToRGB ("yellow"), -- colour
                false)              -- not Unicode
else
  WindowLine (win_bag, 0, font_height + 15,WINDOW_WIDTH-2,font_height + 15,0xc0c0c0, 0,1)
  movewindow.add_drag_handler (win_bag, 0, 0, 0, font_height + 15)
  WindowAddHotspot(win_bag, "bag",  
                   0, font_height + 15, 0, 0,
                   "", -- mouseover (do nothing)
                   "", -- cancelmouseover (do nothing)
                   "",
                   "", -- cancelmousedown (do nothing)
                   "mouseup", -- mouseup (do nothing)
                   "点击关闭开启",    -- hint text if they hover over it              
                   0, 0)

    WindowText (win_bag, "f5",
                "物品列表",   -- text
                head_width, 9, 0, 0,        -- rectangle
                ColourNameToRGB ("yellow"), -- colour
                false)              -- not Unicode

   WindowText (win_bag, "f1",
               "共"..#_bag_ch.."件物品",   -- text
                5, 30, 0, 0,        -- rectangle
                ColourNameToRGB ("white"), -- colour
                false)              -- not Unicode
  if Bag["ENCB"].value then
   WindowText (win_bag, "f1",
               "负重".. Bag["ENCB"].value .."%",   -- text
                100, 30, 0, 0,        -- rectangle
                ColourNameToRGB ("white"), -- colour
                false)              -- not Unicode

  end
    for i = 1,#_bag_ch do
            if _bag_ch[i] == "" or _bag_ch[i] == nil then
                _bag_ch[i] = "数据丢失"
            end
            if _bag_ch[i] == "" or _bag_ch[i] == nil then
                _basic[i] = "数据丢失"
            end
               
        local txt2 = _bag_ch[i].." *".._bag_cn[i]
        local _high = math.ceil(i/2)*15 + 30
    if i/2 < math.ceil(i/2) then
      WindowText (win_bag, "f1",
                    txt2,   -- text
                    5, _high, 0, 0,        -- rectangle
                --  ColourNameToRGB (_colour), -- colour
                                 ColourNameToRGB ("green"), -- colour
                    false)              -- not Unicode
    else
      WindowText (win_bag, "f1",
                    txt2,   -- text
                    95+5, _high, 0, 0,        -- rectangle
                --  ColourNameToRGB (_colour), -- colour
                                 ColourNameToRGB ("green"), -- colour
                    false)              -- not Unicode
    end       
        end
end
if flag_win_bag and flag_win_bag==1 then
           WindowShow (win_bag, true)
else
           WindowShow (win_bag, false)
end
end
门派:天龙寺
发表于 2019-8-12 23:13:23 | 显示全部楼层
你是不是改其他地方了,这里一般不会有问题,可能哪里变量调用错误。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-6-22 00:32 , Processed in 0.023900 second(s), 21 queries .

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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