Jump to content
code34

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

Recommended Posts

On 9/19/2019 at 2:36 AM, code34 said:

Hello Vandeanson,

 

In order:

- check your startup command line : uses -servermod=@inidbi2

- check the permissions on .dll files

- check the path where you install the mod

Got it working on dedicated by using the steam mod - great stuff, thanks!

Getting this to work was the most exciting moment i had in Arma scripting for a while;)

Player info and custom variable saves work like a charm.

 

@all 

I am looking into continuously saving inventory content (that players drop off)  of loot-crates (that are not editor-placed but spawned in via script).

If anyone has suggestions or ideas, I am all ears. Will share my version once I come up with something.

Currently my brain starts melting when I start thinking about a solution, but will get there😉

 

Saving and loading the "crafted/placed" loot-boxes or other spawned in structures is fine and I got some working solution there.

I guess my issue is to assign a unique identifier to the specific loot-crates that the "inventory scan/save" can refer to and that will persist through loading the loot-crates at restart.

 

cheers

vd

  • Like 3

Share this post


Link to post
Share on other sites

Is there anyway for me to use this on my rented antistasi server because we have a problem that our progress restarts with the server? The host is 4netplayers btw

Share this post


Link to post
Share on other sites

Hi! After trying to work Inidbi2 for a while, looking at multiple tutorials and testing pre-made scripts for inidbi2 I've been having an issue, where no matter what I do the loading happens for EVERYBODY instead of just the one person. 

 

I've been trying to get inidbi2 working to save just unit loadout and position on an addaction (or on inventory open)

 

If anybody has tutorials or pre-mades that work please let me know.

 

Cheers

Huski

 

 

Share this post


Link to post
Share on other sites
On 11/26/2019 at 7:01 PM, OnX1337 said:

Is there anyway for me to use this on my rented antistasi server because we have a problem that our progress restarts with the server? The host is 4netplayers btw

 Did you managed to make it working on 4netplayers ? I also have server from them  but I have no success  using inidbi2 on their servers. Maybe because of lacking a possibility to use -serverMod= parameter for launching the server. I tried few workaround that I thought could work but ... I wrote an email to 4netplayers support asking if its possible for them to add feature of extending the command line to -serverMod=.

Share this post


Link to post
Share on other sites

Hi, i was working on a inidb2 that save data server side and currently works(Took exemple from a youtube video and made it works as it wasnt really working for MP server). I made a mission template with all mods you need to test it out if interseted. It will only works with @Ravage mods as of right now unless you know what you are doing.

https://github.com/TolH/Inidbi2

Forgot to add, if you need to test it with no dependencies like @Ravage mods and such i can also do that(just ask if needed). Because right now you need python and some other dependencies to run it all with the server logreader.py and such if you are using the version above. Thanks.

  • Like 1
  • Thanks 2

Share this post


Link to post
Share on other sites

Hey!

 

Does anyone know whether iniDBI2 works in Arma 2: Operation Arrowhead too or not?

 

Thanks in advance for the replies!

Share this post


Link to post
Share on other sites

I'm having problems with loading my profile.
It happends only if I restart the server and joining as the first client.
I'm using the newest version (2.06, with the 2.05 and not using the seperator function everything works fine).

 


Called in initPlayerLocal.sqf

params ["_caller", "_nameDB", "_playerName", "_hint"];
private _inidbi = ["new", _nameDB] call OO_INIDBI;
private _separator = "s|";
["setSeparator", _separator] call _inidbi; // will set separator as "|s|"
private _fileExist = "exists" call _inidbi;
private _text = "WELCOME - NEW PROFILE CREATED";
sleep 3;



if (_fileExist) then { ... } else { ... };

 

Any ideas?

Share this post


Link to post
Share on other sites

Problem is still active. Only the first contact after restarting server making problems.

If I deactivate the seperator function everything works fine.

 

 

// private _separator = "s|";
// ["setSeparator", _separator] call _inidbi; // will set separator as "|s|"

 

Share this post


Link to post
Share on other sites

hello iV - Ghost,

 

Can you describe your problem because it's not understable.

 

What is exactly the problem , and how do you check it ?

Share this post


Link to post
Share on other sites

Hey @code34,

 

  • I changed the separator according to your instructions because there were problems with a username. Changed as seen above.
  • But after this changing the first loaded file on my server (userfile or campaignfile) doesn't loading.
  • I can see this from the fact that the content is available and also from a variable, which shows me (in a hint) after loading whether everything has loaded correctly.
  • If I deactivate the seperator changing function everything works fine.

Share this post


Link to post
Share on other sites

Is anyone able to explain why when this script (saveData.sqf): 

_UID = (_this select 0);

_gear = getUnitLoadout player;
_cash = cash;
saveData = [_UID, _gear, _cash];
publicVariableServer "saveData";

is executed from here:
 

shopKeep addAction ["Buy MP7 - £100",
{
  if (cash >= 100) then
  {
  _unit = (_this select 1);
  _UID = getPlayerUID _unit;
  _unit addWeapon "CUP_hgun_MP7";
  cash = cash - 100;
  null = [_UID] execVM "saveData.sqf";
  }else
  {
  hint "Not Enough Cash";
  };
}];

it works fine, but when i execute the script by just using execVM "saveData.sqf" i get this error:
https://gyazo.com/08d24af6d3c8812600ebf989c1e0cf93

Share this post


Link to post
Share on other sites
On 4/15/2020 at 7:48 PM, iV - Ghost said:

Hey @code34,

 

  • I changed the separator according to your instructions because there were problems with a username. Changed as seen above.
  • But after this changing the first loaded file on my server (userfile or campaignfile) doesn't loading.
  • I can see this from the fact that the content is available and also from a variable, which shows me (in a hint) after loading whether everything has loaded correctly.
  • If I deactivate the seperator changing function everything works fine.

 

Please, copy paste your code.

 

		_inidbi = ["new", "databasename"] call OO_INIDBI2;
		private _separator = "s|";
		["setSeparator", _separator] call _inidbi;
		_name = "Pseud|o";
		["write", ["masection", "makey", _name]] call _inidbi;
		_result = ["read", ["masection", "makey"]] call _inidbi;

works normaly.

Share this post


Link to post
Share on other sites

@santoj as mention in your error report, your variable _this has not been set

Share this post


Link to post
Share on other sites

Does this have the same limitation of the old version for file size? I was using that one and ran into a problem where I ran out of space. 😞

Share this post


Link to post
Share on other sites

What do you mean ? The file size limitation is relative to your file system not to inidbi2.

Share this post


Link to post
Share on other sites

Buffer size is relative to arma3 buffer size fixed by Bis (8K limit).

Share this post


Link to post
Share on other sites

That makes sense. What I was trying to do was to store the contents of a box with a load of magazines in it. The string I came out with was too large (for, presumably, the format function?).

Is there a way around this?

Share this post


Link to post
Share on other sites

yes, you can cut it in one, two ... pieces 🙂

Share this post


Link to post
Share on other sites

Hello everybody,

 

@code34

 

I save my player data in a separate folder as follows:

 

_inidbifolderplayerdata = ["asd\playerdata\",_playeruid] joinString "";
_inidbi = ["new", _inidbifolderplayerdata] call OO_INIDBI;

 

 

is there a way to call all .ini files in the folder?

 

if not, could you incorporate that?

 

 

I don't want to write all palyer uids in an array.

 

I find your work very nice. It's a shame that individual entries are limited to 8k characters.

 

 

many thanks.

Share this post


Link to post
Share on other sites

Hi LoOni3r,

 

To be transparent with you, it is no longer planned to update Inidbi2.

 

The reason for this is that Inidbi2 has been used by many users since a very long time, and has responded to most of the uses without problem.

 

Making changes may impact things that people will not want to change.

 

On the other way, Inidbi2 is a very simple extension released under gpl that can be reedit with visual studio community:

https://github.com/code34/inidbi2

  • Like 1

Share this post


Link to post
Share on other sites

Hello @code34

 

my frend say that the file "assembly config" missing is.

he can not the dll compile.

 

 

he works with visual studio ultimate.

Share this post


Link to post
Share on other sites

normaly, you don't need one. You could reuse directly the code with a netcore library project, but the external piece RGiesecke is out of date and should be replaced by Dllexport.

 

Import dllexport with nugget and install it like this for x86&amd64

https://www.youtube.com/watch?v=sBWt-KdQtoc

 

Share this post


Link to post
Share on other sites

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!

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

×