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

[OTClient Mod] Loot stats

This is a link to the topic with the module:
https://otland.net/threads/otclient-mod-loot-stats.259075/


Trying to add the [OTClient Mod] Loot stats module to my otclient mehah version, downloaded from here and compiled from GitHub - mehah/otclient: An alternative tibia client for otserv written in C++20 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize (https://github.com/mehah/otclient)
Unfortunately, I have a problem, the first one I think I solved was the wrong path to the icons, here are the screenshots:

View attachment 80613
View attachment 80612
I copied the /img folder with its contents to the /-OTClient-Mod-loot_stats folder as shown in the screenshot:
View attachment 80614
Now when I turn on the client and log in, I have a second problem that I cannot solve, this is a screenshot of errors in otclient:
View attachment 80615
This is what the contents of the folder and the path to the files look like:





View attachment 80616


content of createStats.lua link file:
Create Stats.lua
Lines 1 to 65 that cause the error:
Lua:
function CreateStats()
    local createStats = {
        loadedVersionItems = 0;
        ownParser = false;

        _loadClientVersionItems = nil;
        _checkLootTextMessage = nil;

        init = function(self)
            self._loadClientVersionItems = function() self:loadClientVersionItems() end
            self._checkLootTextMessage = function(messageMode, message) self:checkLootTextMessage(messageMode, message) end

            connect(g_game, { onClientVersionChange = self._loadClientVersionItems })
            connect(g_game, { onTextMessage = self._checkLootTextMessage })

            if (self.loadedVersionItems == 0 and g_game.getClientVersion() ~= 0) or (g_game.getClientVersion() ~= 0 and self.loadedVersionItems ~= g_game.getClientVersion()) then
                self:loadClientVersionItems()
            end
        end;

        terminate = function(self)
            disconnect(g_game, { onClientVersionChange = self._loadClientVersionItems })
            disconnect(g_game, { onTextMessage = self._checkLootTextMessage })
        end;

        -- Load items

        loadClientVersionItems = function(self)
            local version = g_game.getClientVersion()

            if version ~= self.loadedVersionItems then
                if not directoryExists('items_versions/' .. version) then
                    pwarning("Directory: items_versions/" .. version .. "/ doesn't exist!")
                    pwarning("Add " .. version .. " directory to items_versions/ with correct version items.otb and items.xml!")
                    self.loadedVersionItems = 0
                    g_modules.getModule('loot_stats'):unload()
                    modules.client_modulemanager.refreshLoadedModules()
                    return
                end

                if not fileExists('items_versions/' .. version .. '/items.otb') then
                    pwarning("File: items_versions/" .. version .. "/ doesn't exist!")
                    pwarning("Add correct version items.otb to items_versions/" .. version .. "/!")
                    self.loadedVersionItems = 0
                    g_modules.getModule('loot_stats'):unload()
                    modules.client_modulemanager.refreshLoadedModules()
                    return
                end

                if not fileExists('items_versions/' .. version .. '/items.xml') then
                    pwarning("File: items_versions/" .. version .. " doesn't exist!")
                    pwarning("Add correct version items.xml to items_versions/" .. version .. "/!")
                    self.loadedVersionItems = 0
                    g_modules.getModule('loot_stats'):unload()
                    modules.client_modulemanager.refreshLoadedModules()
                    return
                end

                loadOtb('items_versions/' .. version .. '/items.otb')
                loadXml('items_versions/' .. version .. '/items.xml')
                self:checkParserType()

                self.loadedVersionItems = version
            end
        end;

Finally, I will add that no part of the module appears and it does not work at all. I am using TFS Engine 1.5 by nekiro Downgrade 8.6 with the latest release on github mehah otclient. And I have custom items.otb items.xml files, which means that I edited them by adding new items, but they work normally with the client, so it shouldn't pose a problem, I think.
 
Is it possible to display only icons of gilded items on the side?
Without statistics and other information ?
 
C++:
WARNING: Directory: items_versions/1098/ doesn't exist!
WARNING: Add 1098 directory to items_versions/ with correct version items.otb and items.xml!
ERROR: Lua error: /mods/loot_stats/ui/menuOption.lua:26: attempt to call field 'removeTab' (a nil value)
stack traceback:
    [C]: in function 'removeTab'
    /mods/loot_stats/ui/menuOption.lua:26: in function 'terminate'
    /mods/loot_stats/ui/ui.lua:48: in function 'terminate'
    /mods/loot_stats/loot_stats.lua:19: in function 'terminate'
    /mods/loot_stats/loot_stats.otmod:14:[@onUnload]:1: in main chunk
    [C]: in function 'unload'
    /mods/loot_stats/systems/createStats.lua:36: in function 'loadClientVersionItems'
    /mods/loot_stats/systems/createStats.lua:10: in function </mods/loot_stats/systems/createStats.lua:10>
    [C]: in function 'setClientVersion'
    /modules/client_entergame/entergame.lua:540: in function 'doLogin'
    /modules/client_entergame/entergame.otui:177: [@onClick]:2: in function </modules/client_entergame/entergame.otui:177: [@onClick]:1>
ERROR: Unable to unload module 'loot_stats': LUA ERROR:
/mods/loot_stats/ui/menuOption.lua:26: attempt to call field 'removeTab' (a nil value)
stack traceback:
    [C]: in function 'removeTab'
    /mods/loot_stats/ui/menuOption.lua:26: in function 'terminate'
    /mods/loot_stats/ui/ui.lua:48: in function 'terminate'
    /mods/loot_stats/loot_stats.lua:19: in function 'terminate'
    /mods/loot_stats/loot_stats.otmod:14:[@onUnload]:1: in main chunk
    [C]: in function 'unload'
    /mods/loot_stats/systems/createStats.lua:36: in function 'loadClientVersionItems'
    /mods/loot_stats/systems/createStats.lua:10: in function </mods/loot_stats/systems/createStats.lua:10>
    [C]: in function 'setClientVersion'
    /modules/client_entergame/entergame.lua:540: in function 'doLogin'
    /modules/client_entergame/entergame.otui:177: [@onClick]:2: in function </modules/client_entergame/entergame.otui:177: [@onClick]:1>
ERROR: protected lua call failed: /mods/loot_stats/systems/createStats.lua:37: attempt to index field 'client_modulemanager' (a nil value)
stack traceback:
    [C]: in function '__index'
    /mods/loot_stats/systems/createStats.lua:37: in function 'loadClientVersionItems'
    /mods/loot_stats/systems/createStats.lua:10: in function </mods/loot_stats/systems/createStats.lua:10>
    [C]: in function 'setClientVersion'
    /modules/client_entergame/entergame.lua:540: in function 'doLogin'
    /modules/client_entergame/entergame.otui:177: [@onClick]:2: in function </modules/client_entergame/entergame.otui:177: [@onClick]:1>
how do I add these features to the client?
 
my last version

All working good but - if you looting 1 gold coin - image OK.
But if you have 5 gold coin"s" - images not working.

For all items. carrot - OK , carrots - NOK.

And items image not visible on screen.
 
Last edited:
Back
Top