• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

NPCSystem error

HorosCopio

Member
Joined
May 4, 2013
Messages
8
Reaction score
5
Hello guys,

I'm removing all weird errors which I was getting on a server just to try stuff out, and I'm struggling to find the error for this one, and I was wondering if someone who is good at this might see the problem?

The error I get looks like this in console:
[Error - NpcScript Interface]
data/npc/scripts/default.lua
Description:
data/npc/lib/npcsystem/modules.lua:1077: attempt to index local 'v' (a boolean value)
[Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/default.lua

I uploaded the modules.lua file, and down below you can see the default.lua file.

default.lua
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)        npcHandler:onCreatureSay(cid, type, msg)        end
function onThink()                npcHandler:onThink()                    end

npcHandler:addModule(FocusModule:new())

I hope someone can find a minute to look into it for me, or explain me how to find this error :)

Best regards,
 

Attachments

In data/npc/lib/npcsystem/modules.lua
Above line 1131 add this
Lua:
print(getItemInfo(itemid), type(getItemInfo(itemid)))

Then upload an SS of the console
 
thanks WibbenZ for your help!!

Im very new at this and not very sure how to figure out which is line 1131... sorry for that but im a newbie at this.

Well if you use ex Notepad++ you can see what the line is on the left side.
But you should really download some type of editor to help you with things like this, im guessing you are using the Windows notepad? :p

In this case it's here:
Lua:
    function ShopModule:getCount(message)
        local ret, b, e = 1, string.find(message, PATTERN_COUNT)
        if(b ~= nil and e ~= nil) then
            ret = tonumber(string.sub(message, b, e))
        end

        return math.max(1, math.min(self.maxCount, ret))
    end
############################ Line 1131 #############################
    -- Adds a new buyable item.
    --    names = A table containing one or more strings of alternative names to this item. Used only for old buy/sell system.
    --    itemid = The itemid of the buyable item
    --    cost = The price of one single item
    --    subType - The subType of each rune or fluidcontainer item. Can be left out if it is not a rune/fluidcontainer. Default value is 0 and 1 (depending on shop mode)
    --    realName - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (getItemNameById will be used)
    function ShopModule:addBuyableItem(names, itemid, cost, subType, realName)
        if(type(subType) == 'string' and realName == nil) then
 
Well if you use ex Notepad++ you can see what the line is on the left side.
But you should really download some type of editor to help you with things like this, im guessing you are using the Windows notepad? :p

In this case it's here:
Lua:
    function ShopModule:getCount(message)
        local ret, b, e = 1, string.find(message, PATTERN_COUNT)
        if(b ~= nil and e ~= nil) then
            ret = tonumber(string.sub(message, b, e))
        end

        return math.max(1, math.min(self.maxCount, ret))
    end
############################ Line 1131 #############################
    -- Adds a new buyable item.
    --    names = A table containing one or more strings of alternative names to this item. Used only for old buy/sell system.
    --    itemid = The itemid of the buyable item
    --    cost = The price of one single item
    --    subType - The subType of each rune or fluidcontainer item. Can be left out if it is not a rune/fluidcontainer. Default value is 0 and 1 (depending on shop mode)
    --    realName - The real, full name for the item. Will be used as ITEMNAME in MESSAGE_ONBUY and MESSAGE_ONSELL if defined. Default value is nil (getItemNameById will be used)
    function ShopModule:addBuyableItem(names, itemid, cost, subType, realName)
        if(type(subType) == 'string' and realName == nil) then
yes you are indeed guessing right, I use windows pad :D lol
I will download Notepad++ or some editor.

I added this to the line you indicated but the error keeps being the same exactly.
 
yes you are indeed guessing right, I use windows pad :D lol
I will download Notepad++ or some editor.

I added this to the line you indicated but the error keeps being the same exactly.

Yes but upload an image of the log, the code you added will print 2 values in the log :p
 
Back
Top