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

TFS 1.X+ Storagemap Problem

leonardo ramos

Veteran OT User
Joined
Dec 7, 2016
Messages
190
Reaction score
369
My server is having a problem with the following part of monster.cpp

Code:
void Monster::addStorageValue(const uint32_t key, const std::string value)
{
    if (value != "-1") {
        storageMap[key] = value;
    } else {
        storageMap.erase(key);
    }
}

So we changed this part to .lua, directly in the server libs (creature.lua), as follows:
Code:
function Creature.getTemporaryValue(self, key)
  local storageMap = CREATE_STORAGE_TEMPORARY[self:getId()]
    
    if (storageMap) then
    return storageMap[key] or -1
    end
    
  return -1
end

We thought we had solved the problem, because for a long time the server had not crashed on it. But about 2 days ago we had the same problem again. Then we moved the server from windows to linux and realized that now, instead of crash, the server freezes indefinitely. Then we implemented a Delusion catchscript ([ANY TFS] Catch scripts that freeze server (https://otland.net/threads/any-tfs-catch-scripts-that-freeze-server.261466/)) and it returns that creature.lua It has a possible infinite loop in this part of the file.
 
Could you show us the full traceback by replacing my script with this:
Lua:
local start = os.time()
local linecount = 0
debug.sethook(function(event, line)
    linecount = linecount + 1
    if os.time() - start >= 1 then
        if linecount >= 30000 then
            print(string.format("possible infinite loop in file %s near line %s", debug.getinfo(2).source, line))
            print(debug.traceback())
            debug.sethook()
        end
        linecount = 0
        start = os.time()
    end
end, "l")

It should show the traceback like when an error occurs, showing what scripts are currently in execution, what functions have been called, etc.
 
Back
Top