• 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!

Solved Not enough memory

Daky

Active Member
Joined
Jun 5, 2013
Messages
495
Reaction score
39
So this is the error I get on startup:

N9zZ5ZB.png


Shortly after, it crashes. I'm able to bypass the crash & errors if I delete the npc lib folder, a long with the files inside of it.

I've tested multiple things. I'm using 0.3.6,

I've tested with 0.3.7 and 0.3.5 (replacing lib folders), nothing worked. Weird part is, I haven't made any changes to those files.
I tried deleting all my NPCs and leave the lib folder, but didn't work either.

Error started after some map edits. My map is 2MB.

running with 6gb ram
 
PHP:
-- Include the Advanced NPC System
dofile(getDataDir() .. 'npc/lib/npcsystem/npcsystem.lua')

function selfIdle()
    following = false
    attacking = false

    selfAttackCreature(0)
    target = 0
end

function selfSayChannel(cid, message)
    return selfSay(message, cid, false)
end

function selfMoveToCreature(id)
    if(not id or id == 0) then
        return
    end

    local t = getCreaturePosition(id)
    if(not t.x or t.x == nil) then
        return
    end

    selfMoveTo(t.x, t.y, t.z)
    return
end

function getNpcDistanceToCreature(id)
    if(not id or id == 0) then
        selfIdle()
        return nil
    end

    local c = getCreaturePosition(id)
    if(not c.x or c.x == 0) then
        return nil
    end

    local s = getCreaturePosition(getNpcId())
    if(not s.x or s.x == 0 or s.z ~= c.z) then
        return nil
    end

    return math.max(math.abs(s.x - c.x), math.abs(s.y - c.y))
end

function doMessageCheck(message, keyword)
    if(type(keyword) == "table") then
        return table.isStrIn(keyword, message)
    end

    local a, b = message:lower():find(keyword:lower())
    if(a ~= nil and b ~= nil) then
        return true
    end

    return false
end

function doNpcSellItem(cid, itemid, amount, subType, ignoreCap, inBackpacks, backpack)
    local amount = amount or 1
    local subType = subType or 1
    local ignoreCap = ignoreCap and true or false

    local item = 0
    if(isItemStackable(itemid)) then
        item = doCreateItemEx(itemid, amount)
        if(doPlayerAddItemEx(cid, item, ignoreCap) ~= RETURNVALUE_NOERROR) then
            return 0, 0
        end

        return amount, 0
    end

    local a = 0
    if(inBackpacks) then
        local container = doCreateItemEx(backpack, 1)
        local b = 1
        for i = 1, amount do
            item = doAddContainerItem(container, itemid, subType)
            if(itemid == ITEM_PARCEL) then
                doAddContainerItem(item, ITEM_LABEL)
            end

            if(isInArray({(getContainerCapById(backpack) * b), amount}, i)) then
                if(doPlayerAddItemEx(cid, container, ignoreCap) ~= RETURNVALUE_NOERROR) then
                    b = b - 1
                    break
                end

                a = i
                if(amount > i) then
                    container = doCreateItemEx(backpack, 1)
                    b = b + 1
                end
            end
        end

        return a, b
    end

    for i = 1, amount do
        item = doCreateItemEx(itemid, subType)
        if(itemid == ITEM_PARCEL) then
            doAddContainerItem(item, ITEM_LABEL)
        end

        if(doPlayerAddItemEx(cid, item, ignoreCap) ~= RETURNVALUE_NOERROR) then
            break
        end

        a = i
    end

    return a, 0
end

function doRemoveItemIdFromPos (id, n, position)
    local thing = getThingFromPos({x = position.x, y = position.y, z = position.z, stackpos = 1})
    if(thing.itemid == id) then
        doRemoveItem(thing.uid, n)
        return true
    end

    return false
end

function getNpcName()
    return getCreatureName(getNpcId())
end

function getNpcPos()
    return getCreaturePosition(getNpcId())
end

function selfGetPosition()
    local t = getNpcPos()
    return t.x, t.y, t.z
end

msgcontains = doMessageCheck
moveToPosition = selfMoveTo
moveToCreature = selfMoveToCreature
selfMoveToPosition = selfMoveTo
selfGotoIdle = selfIdle
isPlayerPremiumCallback = isPremium
doPosRemoveItem = doRemoveItemIdFromPos
doNpcBuyItem = doPlayerRemoveItem
doNpcSetCreatureFocus = selfFocus
getNpcCid = getNpcId
getDistanceTo = getNpcDistanceTo
getDistanceToCreature = getNpcDistanceToCreature


try
 
sebastian

PHP:
local keywordHandler = KeywordHandler:new()
        local npcHandler = NpcHandler:new(keywordHandler)
        NpcSystem.parseParameters(npcHandler)
      
      
      
        -- OTServ event handling functions start
        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
        -- OTServ event handling functions end
      
      
        -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
        local travelNode = keywordHandler:addKeyword({'liberty bay'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Liberty Bay is not what it used to be. Want to go back there for 50 gold pieces?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 50, destination = {x=32316, y=32701, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Oh.'})
          
            local travelNode = keywordHandler:addKeyword({'nargor'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ah, I see. Ready to go to Nargor for 50 gold pieces?'})
            travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 50, destination = {x=32025, y=32812, z=7} })
            travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Oh.'})
  
        npcHandler:addModule(FocusModule:new())
 
Thanks, looks like it wasn't the npc lib after all though. I deleted my Sebastian NPC from my map and it works fine now :/ I'm guessing it's in need of an update. ;)

and now it doesn't work anymore (with the npc deleted) lol. I'm lost. Same error, different NPC, though. I'm guessing this is correct >.<

Code:
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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
npcHandler:addModule(FocusModule:new())
 
Last edited:
It doesn't have to do with that. 0.3.6 is known for it's corrupted libs in some people's downloads. If he replaces those libs with the ones I provided, it should work flawlessly.

Tried, can't open the server, gets all kind of errors when I replace them.

I'm using this shit atm: http://otland.net/threads/8-60-the-forgotten-server-0-3-6-crying-damson-v8.147913/

If someone could teach how to compile 3777 or 3884, I'd happily switch. Tutorials didn't work out too well for me. :[
 
You can try change the lib, but when I encouter these "Not enough memory" its because u either dont have engouh of ram.
Try to use LAAtido.

Note: This worked for me atleast.


Same goes for you.


What is LAAtido and how do i use it? I get several crashes due too "Not enough memory"..
 
I tried Latido but then it still refused to work. After a while though it started to work again.. why? I have no idea :p

Sorry, but can't remember if I ever knew :D
 
Back
Top