Jump to content
code34

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

Recommended Posts

Hi everyone 

 

I am digging into the persistency portion of a project again.

I have managed to save/load pretty much all I wanted to save, again, great mod!

 

Now I am looking into possibilities to remove information from the database.

Scenario: I place a crate. The crate and its inventory is saved. Now I want to remove a create from the database (e.g. if its destroyed).

 

this is how the file looks after saving. it loads properly afterwards:

../db/Caches

 

Spoiler

//UPDATED

[CacheBox_East_Ammo_F691570]
Array="["CacheBox_East_Ammo_F691570","Box_East_Ammo_F",[4168.5,289.5,0],0]"
[CacheBox_East_Ammo_F695570]
Array="["CacheBox_East_Ammo_F695570","Box_East_Ammo_F",[4162.5,283.5,0],0]"
[CacheBox_East_Ammo_F599570]
Array="["CacheBox_East_Ammo_F599570","Box_East_Ammo_F",[4168.5,295.5,0],0]"
[CacheBox_East_Ammo_F554570]
Array="["CacheBox_East_Ammo_F554570","Box_East_Ammo_F",[4156.5,283.5,0],0]"

 

 

I am trying to apply the functions as per included wiki:

 

(DELETED)

I ve been playing around with it for a while, trying to feed in the correct _section, _key, db object params, but I cant delete anything.

I am not sure if its a formatting thing. Writing and reading works well on hosted MP and Dedi.

 

I tried examples like this:

(DELETED)

 

Can anyone help me understand where I am going wrong?

Or can someone share an example of his code? (saved example and how to delete it).

 

Right, sometimes you need to post your question before the brain activates=)

Here is how i got it to work, in case someone is looking for this:

 

delete a section:

Spoiler

//delete a _section
_section = "CacheBox_East_Ammo_F691570";

_inidbi = ["new","Caches"] call OO_INIDBI;

["deleteSection", _section] call _inidbi;

 

 

delete a key:

 

Spoiler

//delete a _key
_section = "CacheBox_East_Ammo_F691570";
_key = "Array";

_inidbi = ["new","Caches"] call OO_INIDBI;

["deleteKey", [_section, _key]] call _inidbi;

 

 

I appreciate any help.

 

Happy to help, if anyone needs assistance.

 

Thanks

VD

  • Like 2

Share this post


Link to post
Share on other sites
On 6/9/2020 at 10:56 AM, Blaq G-Sus said:

Hello!

Lots of good stuff in this thread! This thread got me started and helped me save & load player data on my server. Thanks!

Did anyone manage to save and load vehicle position & state for all vehicles on the map?

I've been trying for a week now, but haven't figured it out yet.

I have been looking at this and have tried to convert it from inidbi to inidbi2:
 

"Here is another brief example of how you could use iniDBi to save vehicle stats:

_vehicleArray = nearestObjects [[0,0,0], ["Car"], 5000];
dataArray = [];
{ _classname = typeOf _x;
_position = getPos _x;
_direction = getDir _x;
_damage = damage _x;
_fuel = fuel _x;
dataArray pushBack [_classname, _position, _direction, _damage, _fuel]; } forEach _vehicleArray; ["Vehicles", "Data", "Cars", dataArray] call iniDB_write;

 

And this is how you would load the stats of each vehicle:

_dataArray = ["Vehicles", "Data", "Cars", "ARRAY"] call iniDB_read;
{ _classname = _x select 0;
_position = _x select 1;
_direction = _x select 2;
_damage = _x select 3;
_fuel = _x select 4;
_vehicle = _classname createVehicle _position; _vehicle setDir _direction; _vehicle setDamage _damage; _vehicle setFuel _fuel; sleep 0.01; } forEach _dataArray;"


Source:


Any constructive feedback is appreciated.

Have a nice day!

Solved!

Vehicles and player data are now being saved in separate databases in my mission. Vehicles are saved by oopdw scripts. (Made by code34).

Here's a URL to my files if anybody wants to use this for vehicle saving on their mission/server:

http://www.mediafire.com/file/angr3or82t5xuyd/carRC.stratis.pbo/file

  • Like 1

Share this post


Link to post
Share on other sites

Hello, I'm trying to get this to work for me but I'm surely missing something simple. 

 

How do I load a previously saved database after my server is shutdown? 

 

The ini file is still there, but the read functions give me no results until I create a new database and start from scratch. 

 

It appears as though the data is saved in missionnamespace which is completely rewritten each time the server is shut down. 

 

Furthermore, I would also like to get two servers to share data from a single ini file or at least allow each server to read the same file if not write.  Loadfile and preprocess don't work for what I want because I'm unable to rewrite the file while Arma has it in use and see no way to stop it using it other than to shut the server down. 

 

Any help is very much appreciated.

Share this post


Link to post
Share on other sites

Hi

 

the best and safe way to share datas between 2 servers or more is to use a database instead inidbi (try a look on extDB3).

Share this post


Link to post
Share on other sites
On 5/7/2020 at 16:33, Blaq G-Sus said:

Risolto!

I veicoli e i dati dei giocatori vengono ora salvati in database separati nella mia missione. I veicoli vengono salvati da script oopdw. (Realizzato da codice34).

Ecco un URL ai miei file se qualcuno vuole usarlo per salvare il veicolo sulla propria missione/server:

http://www.mediafire.com/file/angr3or82t5xuyd/carRC.stratis.pbo/file

please could you re-upload the pbo file or copy/paste here the way you solve this problem?

Share this post


Link to post
Share on other sites
Il 18/5/2018 alle 23:22, gokitty1199 ha scritto:

non sono sicuro che qualcuno lo troverà di grande utilità qui, ma ho fatto alcuni tutorial a partire da come avere inidbi2 e come controllare/creare un file di database e quindi come recuperare dal file e scrivere nel file (salvataggio). non è il massimo, ma potrebbe essere sufficiente per convincere qualcuno poiché non c'è molto in relazione a come utilizzare.

 

 

 

 

ciao, ottimo lavoro!!!!! volevo un aiuto.... tutto funziona perfettamente anche come server multiplayer, o solo un problema, fintanto che il server è attivo funziona tutto, ma se lo riavvio non mi legge più i salvataggi effettuati e riparte come se nulla esisteva senza errori. Aiutami se puoi

 

RISOLTO TUTTO FUNZIONANTE!!!!

Share this post


Link to post
Share on other sites

@code34
Hi. I love your extension, but it doesn't work on Linux (at least for me, Steam, Proton).

I suspect that it is because of the c#/kernel functions you are using.

Specifically GetExecutingAssembly and WritePrivateProfileString and the like.

Testing the extension on a local non dedicated server does report that databases exist, and their filenames are returned correctly, however, no files are ever created in the db directory, and therefore I suspect that the weakness lies somewhere in the pathing code.

 

Do you have any insights on that? Perhaps even ways to make it more portable? I would debug this better than I can, but I can't. I am an utter novice at tracing these things on Linux via proton/wine...and I have left my Windows times behind...

I never want to go back to them. Thus, if you could make this more portable, you'd be even cooler than you already are, and I (and probably anyone else who uses Linux and Arma 3 with MP missions that rely on INIDBI2) would be very grateful.

 

I am willing to put in work, too, but I need some guidance for that. Not a novice at programming, but this setup sure is awkward (to me)

Share this post


Link to post
Share on other sites
Il 7/1/2022 alle 19:21, Angelo Delle Donne ha dichiarato:

inibi2 troppo lavoro può mandare in crash arma3?

 

Share this post


Link to post
Share on other sites

Hi everyone 

 

Im a beginner scripter and I want save items in my supply box after the restart. For example before the restart I have 10 magazine and I use 2. after the restart I want 8 magazine in my box. How can I do this with inidbi2.

Share this post


Link to post
Share on other sites

Direct Action is not saving games with this database. I first grab files from github and the .pbo db files are not there. I grab files from Workshop, they are different and pbo file is present. Lets see if I can get it to work.

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

×