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 1

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×