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

Anyway to get a list of storages?

BahamutxD

Jack of all trades, master of none
Joined
Jun 8, 2009
Messages
922
Solutions
19
Reaction score
512
Location
Spain
So I'm having a hard time organizing my storages, mostly because when I started doing them I never planned anything and just threw whatever storage number came to my mind. Now I have so many things going on that it's a real mess to not make mistakes/doubles etc.

Is there any way/tool to get all the storages used by a server that parses them into a list? Like something that reads through your scripts hunting storage values and posting them in txt...?
Or any tips on how to deal with this?
 
check all the current storages in the database, or write a function that parses all the lua files in your data folder and checks for any storages, or maybe some debug function (not sure this works tho)
 
In my experience, 45001 -> 46999 are usually unused storages.
I keep a text document in my server folder, and update it whenever I use a new storage.

Storage | Brief Description of Storage | Files that contain/use the storage (This is often multiple lines)

Code:
-- Brief excerpt of it in use.
45629 | Revival Rune (x3 Storages) | data/actions/revival_rune.lua
                                     data/creaturescripts/scripts/revival_rune.lua
45630 | Revival Rune (x3 Storages) | data/actions/revival_rune.lua
                                     data/creaturescripts/scripts/revival_rune.lua
45631 | Revival Rune (x3 Storages) | data/creaturescripts/scripts/revival_rune.lua
 
If you have all the storages (or most of them at least) on your character, try this

Code:
for i = 1, 1000000 do
    local storage = getPlayerStorageValue(cid, i)
    if storage ~= -1 then
        print('Storage: '.. i)
    end
end
 
Code:
local oldplayerstorage = Player.getStorageValue
function Player.getStorageValue(self, storage)
    local info = debug.getinfo(2)
    print(storage, info.source)
    return oldplayerstorage(self, storage)
end

If you put this in global.lua it will print every storage and the source its being called but only once its called. You could add this to a database and with time you should have all the locations of all storages. It would be faster to just parse all the lua files and find the function calls tho.
 
Back
Top