Jump to content
code34

iniDBI - Save and Load data to the server or your local computer without databases!

Recommended Posts

:P So, iniDBI is for player stuff save and OO PDW (strange names here ;) ) is for objects. Does iniDBI also include all stuff of mission progression and ai behavior and so on?

Share this post


Link to post
Share on other sites
:P So, iniDBI is for player stuff save and OO PDW (strange names here ;) ) is for objects. Does iniDBI also include all stuff of mission progression and ai behavior and so on?

INIDBI is an addon that permits to Save & load any kinds of datas in a ini file :)

PDW for "persistent data world" is a class (Oriented object) that uses INIDBI to save & load informations about players, and other objects :) <- it's a first release 0.1 ;)

Edited by code34

Share this post


Link to post
Share on other sites

Am I missing something or is there no way to do the following:

- Check if a section exists within a database

- Check if a record within a database and section exists

- Delete a record within a database and section

I know the source code is provided, but I'm pretty rusty with C++.

Edited by GossamerSolid

Share this post


Link to post
Share on other sites

i don t get inidbi to work on my windows root server, i need your help.

I copied the at inidbi folder to the ARMA 3 Server Folder and the test mission in mpmissions.

Started the Server with -mod= at inidbi.

If i join the server i geht the error Script inidbi/init.sqf not found

At Home on my local Desktop Coputer this procedure works fine, but if i use at home the Serverfiles i get the error too.

Don t know what s wrong.

Share this post


Link to post
Share on other sites
i don t get inidbi to work on my windows root server, i need your help.

I copied the at inidbi folder to the ARMA 3 Server Folder and the test mission in mpmissions.

Started the Server with -mod= at inidbi.

If i join the server i geht the error Script inidbi/init.sqf not found

At Home on my local Desktop Coputer this procedure works fine, but if i use at home the Serverfiles i get the error too.

Don t know what s wrong.

I'm getting exactly the same thing!

Share this post


Link to post
Share on other sites
Am I missing something or is there no way to do the following:

- Check if a section exists within a database

- Check if a record within a database and section exists

- Delete a record within a database and section

I know the source code is provided, but I'm pretty rusty with C++.

Hi :)

1- not yet avalaible but is it really usefull ?

2 -is it usefull as far as you always retrieve an output. IF it the record doesnt exist in the db, the function returns as empty array, or empty string etc.

3 - in next release, already comited on the github but not compiled

---------- Post added at 21:27 ---------- Previous post was at 21:26 ----------

i don t get inidbi to work on my windows root server, i need your help.

I copied the at inidbi folder to the ARMA 3 Server Folder and the test mission in mpmissions.

Started the Server with -mod= at inidbi.

If i join the server i geht the error Script inidbi/init.sqf not found

At Home on my local Desktop Coputer this procedure works fine, but if i use at home the Serverfiles i get the error too.

Don t know what s wrong.

check if you have install the VC library.

http://www.microsoft.com/fr-fr/download/details.aspx?id=5555

Edited by code34

Share this post


Link to post
Share on other sites

Hello code34,

I'm wanting to make a series of missions where inventories persist from the end of the first mission and continue to the second and so on. My understanding is that for iniDBI to work, it needs a persistent server or the same players to be joining the server with same name in order to load the same loadouts. My questions are:

Does iniDBI save the loadouts of a unit between different missions?

Is there a way to save the loadouts of units without needing clients input (ex: at end of mission, server records all loadouts, saved to file, server shuts down, server loads up again on same mission, able to load loadouts to units with clients inputting some sort of command)?

Will the loadsouts saved in db folder be readable for me to go through and see the name of each unit and what they had at the time of saving the loadout?

Cheers for your work on this mod and the continued support you provide it.

Share this post


Link to post
Share on other sites
Hello code34,

I'm wanting to make a series of missions where inventories persist from the end of the first mission and continue to the second and so on. My understanding is that for iniDBI to work, it needs a persistent server or the same players to be joining the server with same name in order to load the same loadouts. My questions are:

Does iniDBI save the loadouts of a unit between different missions?

Is there a way to save the loadouts of units without needing clients input (ex: at end of mission, server records all loadouts, saved to file, server shuts down, server loads up again on same mission, able to load loadouts to units with clients inputting some sort of command)?

Will the loadsouts saved in db folder be readable for me to go through and see the name of each unit and what they had at the time of saving the loadout?

Cheers for your work on this mod and the continued support you provide it.

hi

you have to look at this place:

http://forums.bistudio.com/showthread.php?172499-OO-PDW-oriented-object-Persistent-Data-World

Share this post


Link to post
Share on other sites

Could this be used to save

- Vehicles

- ammo crates

I'm currently working on a wasteland server and I'd love to be able to have vehicle and ammo crate saves.

Any help/direction would be greatly appreciated.

Share this post


Link to post
Share on other sites

you can save a lot of kinds of information but not directly object. You have to serialize them and restore them (ex: backup the class, and createvehicle to restore it).

if you want more information on how to do this, you can look PDW:

http://forums.bistudio.com/showthread.php?172499-OO-PDW-oriented-object-Persistent-Data-World

Edited by code34

Share this post


Link to post
Share on other sites

did you allow porting it to linux server ...

i will write you an pn. also.

Share this post


Link to post
Share on other sites

Hi

I can't give your permission for the original code, as far as i m not the original author.

I rewrite a big part of the pbo, and a part of the dll.

If you use my source code, you can distribute it as binary but you have keep the original authors name in the credits, and to share it also as source code with the same conditions.

You can also send me directly your improvements, if they are clean & interesting, i will integrate them in the inidbi version with your names as contributors

Share this post


Link to post
Share on other sites

Hey thx for reply ...

didnt find any licens etc. info in code ... now i found something about the history of ini_db on git and text files.

sorry for the delay ... i prepared my workplace for the challange ^^ ;)

http://s7.directupload.net/images/140311/5ooinx5g.jpg (302 kB)

now i am ready and test some things, i will inform about some achievements. :smash: .... gnihihi

Share this post


Link to post
Share on other sites

I have a script that writes the various objects to the iniDB such as vehicles or ammocrates. I have placed a crate on the ground, added it in without errors then when I pick up the crate I need it to be removed so I use the iniDB_deletesection command. I am using the objects location and direction to create a Unique ID to use as the section name so each crate/vehicle will have its own section.

When I insert the crate this is the section in the inidb file:

[3382855454]
classname="UNBasicAmmunitionBox_EP1"
position="[3382.99,8554.78,0.00527954]"
direction="54.8494"
damage="0"
weapons="[["Colt1911"],[1]]"
magazines="[["7Rnd_45ACP_1911"],[2]]"
backpacks="[[],[]]"

now when i pick up the crate, this code is run where _uid is the sectionname unique ID.

_rv = [_dbname, _uid] call iniDB_deletesection;

The entire section is not deleted, just part of it

[3382855454]
damage="0"
weapons="[["Colt1911"],[1]]"
magazines="[["7Rnd_45ACP_1911"],[2]]"
backpacks="[[],[]]"

I have done this a dozen times and it varies with the number of fields deleted, but never the entire section. ...

Any thoughts? Suggestions?

---------------------------------------------------------------------------------------------------------------------------------------------

PROBLEM SOLVED:

I had a script running on the client that updated the database every 1 second. Apparently it would update the ammo crate in the middle of the deletion leaving what appeared to be an error in deletion. So my 'update objects' script needed some tweaking and it now works. ...

Edited by shootingblanks
SOLVED:

Share this post


Link to post
Share on other sites

Is this eventually going to be patched to deal with the buffer size limitations? Being a database extension it's rather important I'd think.

Share this post


Link to post
Share on other sites
Is this eventually going to be patched to deal with the buffer size limitations? Being a database extension it's rather important I'd think.

it s already done a long time ago (first release)

buf was extended from 512K to 8192K (limit of the game buffer)

Share this post


Link to post
Share on other sites
it s already done a long time ago (first release)

buf was extended from 512K to 8192K (limit of the game buffer)

Truncating the returned string to 8KB isn't dealing with it. I meant chunking the return into 8KB pieces that will be appended back together on the SQF side.

Share this post


Link to post
Share on other sites

What would cause: "Inidb: read failed not enough parameter" ?

Edited by eagledude4

Share this post


Link to post
Share on other sites

New mod v1.4 available at withSIX. Download now by clicking:

@inidbi.png

@ code34;

Soon you will be able to manage the promo pages of your content on our web platform and publish new content yourself.

To do so, please hit 'this is me' button on the page while logged in and you will get connected to your work.

For now you can send new content or releases our way through withsix.wetransfer.com or add your notification at getsatisfaction.withsix.com.

Share this post


Link to post
Share on other sites
Truncating the returned string to 8KB isn't dealing with it. I meant chunking the return into 8KB pieces that will be appended back together on the SQF side.

hi, it s the game buffer limitation. We can do a workaround with several 8KB to done only big one, but the problem still the same.

---------- Post added at 01:04 ---------- Previous post was at 01:03 ----------

What would cause: "Inidb: read failed not enough parameter" ?

You should forget one input parameter of your read function :)

---------- Post added at 01:04 ---------- Previous post was at 01:04 ----------

New mod v1.4 available at withSIX. Download now by clicking:

http://img-cdn.withsix.com/mods/rv/@inidbi.png

@ code34;

Soon you will be able to manage the promo pages of your content on our web platform and publish new content yourself.

To do so, please hit 'this is me' button on the page while logged in and you will get connected to your work.

For now you can send new content or releases our way through withsix.wetransfer.com or add your notification at getsatisfaction.withsix.com.

thanks you ;)

Share this post


Link to post
Share on other sites
hi, it s the game buffer limitation. We can do a workaround with several 8KB to done only big one, but the problem still the same.

---------- Post added at 01:04 ---------- Previous post was at 01:03 ----------

You should forget one input parameter of your read function :)

---------- Post added at 01:04 ---------- Previous post was at 01:04 ----------

thanks you ;)

This is my workaround. It's been sitting on my HD for months. So have fun.

/*

Requires iniDB and it's function scripts

*/

SiniDB_buildSaveString =

{

/*

This function receives an array in the format

[["variable name", variable value],["variable name", variable value]]

and builds a string which will be saved in the inidb.

This is just as good as the "format" function, but without the 2000 character limit.

*/

private ["_saveAr","_saveStr","_tmpElement","_index","_count","_tmpVal1up"];

_saveAr = _this;

_saveStr = "[";

_index = [];

//Loop through main elements in array.

for "_i" from 0 to (count(_saveAr) - 1) do

{

_tmpElement = _saveAr select _i;

_saveStr = _saveStr + "[""" + (_tmpElement select 0) + """,";

_tmpVal = _tmpElement select 1;

if(typeName(_tmpVal) == "ARRAY") then

{

_saveStr = _saveStr + "[";

_notDone = true;

_count = 0;

//Loop through nested arrays

while{_count < count(_tmpVal)} do

{

if(typeName(_tmpVal select _count) == "ARRAY") then

{

_index = _index + [_count];

_saveStr = _saveStr + "[";

_tmpVal = _tmpVal select _count;

_count = 0;

}

else

{

if(typeName(_tmpVal select _count) == "STRING") then

{

_saveStr = _saveStr + """" +(_tmpVal select _count) + """";

}

else

{

_saveStr = _saveStr + format["%1", _tmpVal select _count];

};

if(_count == count(_tmpVal) - 1) then

{

_saveStr = _saveStr + "]";

if(count(_index) > 0) then

{

_count = (_index select (count(_index) - 1));

_index set [(count(_index) - 1), "DEL"];

_index = _index - ["DEL"];

//check if parent array was at last element

_tmpVal1up = _tmpElement select 1;

for "_ind" from 0 to (count(_index)-1) do

{

_tmpVal1up = _tmpVal1up select (_index select _ind);

};

if((count(_tmpVal1up) - 1) == _count) then

{

_saveStr = _saveStr + "]";

}

else

{

_saveStr = _saveStr + ",";

};

if(count(_index) > 0) then

{

_index set [count(_index) - 1, (_index select (count(_index) - 1)) + 1];

_saveStr = _saveStr + "]";

};

};

_tmpVal = _tmpElement select 1;

for "_ind" from 0 to (count(_index)-1) do

{

_tmpVal = _tmpVal select (_index select _ind);

};

_count = _count + 1;

}

else

{

_saveStr = _saveStr + ",";

_count = _count + 1;

};

};

};

}

else

{

if(typeName(_tmpVal) == "STRING") then

{

_saveStr = _saveStr + """" + _tmpVal + """";

}

else

{

_saveStr = _saveStr + format["%1", (_tmpVal)];

};

};

_saveStr = _saveStr + "]";

if(_i < count(_saveAr) - 1) then

{

_saveStr = _saveStr + ",";

};

};

_saveStr = _saveStr + "]";

_saveStr;

};

SiniDB_cutStr = {

//splits the string in an array of smaller strings to avoid the data limit of ~4000 characters being sent to the dll(inidb)

private ["_mainStr", "_strAr", "_count", "_strToAr", "_tmpStrAr"];

_mainStr = _this;

_strAr = [];

_strToAr = toArray(_mainStr);

_tmpStrAr = [];

_count = 0;

for "_i" from 0 to (count(_strToAr) - 1) do

{

_count = _count + 1;

_tmpStrAr = _tmpStrAr + [_strToAr select _i];

if(_count >= 199) then

{

_count = 0;

_strAr = _strAr + [toString(_tmpStrAr)];

_tmpStrAr = [];

};

};

_strAr = _strAr + [toString(_tmpStrAr)];

_strAr;

};

SiniDB_saveDB =

{

/*

Saves data using inidb

example use:

[

"PLAYERID",

"SIDE",

[

["name","John"],

["friends", ["Pete", "Adam", "Joe"]]

]

] call SiniDB_saveDB;

*/

private ["_file", "_key", "_data", "_count", "_tmpStrAr"];

_file = _this select 0;

_key = _this select 1;

_data = _this select 2;

_tmpStrAr = (_data call SiniDB_buildSaveString) call SiniDB_cutStr;

_count = count(_tmpStrAr);

[_file, _key, "count", _count] call iniDB_write;

for "_i" from 0 to (_count - 1) do

{

[_file, _key, format["part%1", _i], _tmpStrAr select _i] call iniDB_write;

};

};

SiniDB_loadDB =

{

/*

Loads data using inidb

example use:

[

"PLAYERID",

"SIDE"

] call SiniDB_loadDB;

*/

private ["_file", "_key", "_data", "_count"];

_file = _this select 0;

_key = _this select 1;

_data = "";

if(_file call iniDB_exists) then

{

_count = parseNumber([_file, _key, "count"] call iniDB_readRaw);

for "_i" from 0 to (_count - 1) do

{

_data = _data + ([_file, _key, format["part%1", _i]] call iniDB_readRaw);

};

}

else

{

_data = "[]";

};

_data;

};

You might just be interested in using the SiniDB_saveDB and SiniDB_loadDB functions.

Example use:

For instance you have an array with all the saved data of a player:

[["variableName", "Data"],["variableName", "Data"]]

_theData = [["name", "John"],["weapons", ["AK47","Desert_Eagle"]],["position", [123,456,789]]]

to save it:

["File", "Key", _theData] call SiniDB_saveDB;

to load it:

_loadedData = ["File", "Key"] call SiniDB_loadDB;

compiledData = call compile _loadedData;

//looks like this now [["variableName", "value"],[..]...]

for "_i" from 0 to (count(_compiledData) -1) do

{

compile format["%1 = compiledData select %2 select 1", compiledData select _i select 0, _i];

}

//Now it did this : variableName = value

Edited by Ed

Share this post


Link to post
Share on other sites

a part of this workaround does the job :)

just keep in mind that using a lot of part execeeding 8K multiply dll access.

Share this post


Link to post
Share on other sites

In regards to the ""Inidb: read failed not enough parameter"" error I'm getting:

["Houses", _x, "Owner"] call iniDB_read

INI:

[House1]
Owner="None"
OwnerName="None"

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×