Jump to content
code34

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

Recommended Posts

48 minutes ago, CapShawns said:

Ho già lavorato con gli script, sono molto un dilettante. Tuttavia, personalmente non riesco a trovare alcuna informazione sul salvataggio della missione con iniDB2. Ho trovato molte informazioni sul salvataggio delle informazioni sui clienti e sui personaggi, il che non mi preoccupa molto. Il salvataggio di informazioni sui personaggi / client è simile al salvataggio delle informazioni sulla missione?

Devo usare lo spazio profile profile per salvare la missione? o è un metodo diverso da iniDB2? 

saving is similar to that done for players but has a different concept.
For example if you decide to save the position of a vehicle you have to do it on the server side and not on the client side.
Take a cue from the tutorial made by the author to understand the mechanisms, it is well done and very clear. but as mentioned in the previous post the work is very long, you need to be patient.

Share this post


Link to post
Share on other sites

Where is the tutorial? I would love to see it. I have only seen information regarding client saving and installing the extension into the server files. I can do that much already.  Maybe I passed over it, but I personally haven't found something that talks about saving the mission. If there is a tutorial, can you link it so I can read it?

Share this post


Link to post
Share on other sites

CAUTION
  With the latest Arma update 2019-07-25 , scripted spawned units all have a variable name set automatically by Bohemia.

es; "Bis_o4_01"

So if you search with    -->     if ((vehicleVarName _x) == "" ...

don't expect to find them !!!
I hope he can serve you

Share this post


Link to post
Share on other sites
On 8/6/2019 at 10:03 PM, Grenadier ITF said:

With the latest Arma update 2019-07-25 , scripted spawned units all have a variable name set automatically by Bohemia.

Are you sure that's new? I have seen these "Bis_o*" variable names on units that had no varnames assigned for atleast 2 or 3 updates.

Share this post


Link to post
Share on other sites
1 minute ago, Dedmen said:

Sei sicuro che sia nuovo? Ho visto questi nomi di variabili "Bis_o *" su unità alle quali non sono stati assegnati nomi di varianti per almeno 2 o 3 aggiornamenti.

hi, 

References to bis I noticed 8 days ago but I only gave weight to the thing now.
In my case not before.

Share this post


Link to post
Share on other sites
10 hours ago, jamesvardi9 said:

 

ciao,
cosa posso fare per farlo funzionare in MP ??
 

follow the instructions issued by the developer

Share this post


Link to post
Share on other sites
3 hours ago, Grenadier ITF said:

follow the instructions issued by the developer

i did it, and it doesnt work in mp

Share this post


Link to post
Share on other sites

Hey there. Im having issues saving an empty array. Im pretty new to scripting and I can read it, or at least follow it, but writing is iffy, so there is a lot of trial and error, but heres what I have. 

I am trying to make our invade and annex server persistent because we reset it often, and we keep losing our progress as a result. 

dbCreate.sqf

Spoiler

_dbCreate = ["new", "69thIandA"] call OO_INIDBI;


["write", ["Mission Info", "Controlled Zones", controlledZones]] call _dbCreate;


_cptFOB=[];
_cptFOB = missionNamespace getVariable [format ["capturedFOBs%1", 1],[]];


if(isNil (_cptFOB)) then {
  sleep 1; 
  systemChat "No Captured FOB's stored.";
} else {
  ["write", ["Mission Info", "Captured FOBs", capturedFOBs]] call _dbCreate;
  sleep 1; 
  systemChat "Captured FOB's written to DB.";
};
 


Output in 69thIandA.ini

Spoiler

[Mission Info]
Controlled Zones="["BASE"]"

 

The controlledZones array populates as each zone is captured, but base is the default value. however, capturedFOBs doesnt populate until a FOB is captured.

My question is, because of the way the array is stored ie: "["BASE"]", are the quotes messing stuff up? Because it seems like the script isnt running anymore after it creates the database, and my RPT doesnt throw any errors. 

Thank you for any help! 


Edit: 
 

changing if(isNil (_cptFOB)) to if(isNil ("_cptFOB")) fixed write issue. INI output is now as expected. 

Edited by Gossler
Updated info.

Share this post


Link to post
Share on other sites

 

I have a question to ask.
why did you put this limitation in your personal code inidbi?

 

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

 

if(count (toarray(format["%1", _data])) > 8095) then {

_data = false;

_log = format["IniDBI: write failed %1 %2 data too big > 8K", _section, _key];

[_log] call iniDB_log....

 

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

 

Wouldn't it be possible to increase it?
Thanks for the reply.

Share this post


Link to post
Share on other sites
On 8/30/2019 at 11:11 PM, Grenadier ITF said:

Wouldn't it be possible to increase it?

No that's a engine limitation of diag_log.

Share this post


Link to post
Share on other sites
On 11/25/2015 at 7:58 AM, code34 said:

hi

 

i don't reproduce the bug 😞 i just copy/paste your code, and it works normaly

 

 

Quote
 

    _inidbi = ["new", "TestDBName"] call OO_INIDBI;
    diag_log format ["Version: %1","getVersion" call _inidbi];
    diag_log format ["Write: %1",["write", ["TestSection", "TestKey", "TestData"]] call _inidbi];
    diag_log format ["Read: %1",["read", ["TestSection", "TestKey", "STRING", "Something done gone wrong"]] call _inidbi];

 

 

Quote
 

22:04:35 "Version: Inidbi: 2.0 Dll: 2.0"
22:04:35 "Write: true"
22:04:35 "Read: TestData"

 

@code34 I can't get this to work.

 

I've subscribed to your addon and selected it when loading arma 3 and I put the above quoted code in the mission init.sqf and I do not get the above quoted messages on starting the mission.

 

Obviously I'm doing something wrong.

 

Also how do I save each players data like score, rank, medals, ribbons, awards etc. using an array of variables for example when they leave the mission ?

And how do I then retrieve the saved data array for each player that re-joins the mission ?

 

I'm just not understanding how it works.  Can you help me out ?

 

EDIT: I just realized there is a video tutorial so I will give that a try. Thanks.

Share this post


Link to post
Share on other sites

Hi all,

 

Great mod and awesome tutorial, thanks!

 

I have gotten everything (the tutorial examples + own code) to work on hosted MP.

On Dedicated, nothing seems to work.

 

I have set up the server with TADST, the inidb2 mod is added, and TADST has set up following parameter:

Spoiler

 -port=2302 "-config=A:\SteamLibrary\steamapps\common\Arma 3\TADST\default\TADST_config.cfg" "-cfg=A:\SteamLibrary\steamapps\common\Arma 3\TADST\default\TADST_basic.cfg" "-profiles=A:\SteamLibrary\steamapps\common\Arma 3\TADST\default" -name=default -filePatching "-mod=@inidbi2"

 

Mod an mission are checked.

 

on Dedicated, I do not get the message if a database exists or not.

The odd thing is, I get the adactions from initplayerlocal.sqf but nothing happens when I use it, no message.

the hint "init pl started" from initplayerlocal.sqf I do see.

Nothing gets set up in the db folder (from createDatabase.sqf).

 

Am I just setting up the server wrong or calling the code wrong for dedicated?

I am lost..

 

 

initserver.sqf

Spoiler

"checkForDatabase" addPublicVariableEventHandler
{
    private ["_data"];
    _data = (_this select 1);
    _clientID = (_data select 0);
    _UID = (_data select 1);
    _playerName = (_data select 2);


    _inidbi = ["new",_UID] call OO_INIDBI;
    _fileExist = "exists" call _inidbi;

    if (_fileExist) then
    {
        hint "FILE DOES EXIST, GETTING DATA";
        null = [_UID,_clientID] execVM "getData.sqf";

    }
    else
    {
        hint "FILE DOES NOT EXIST, CREATING DATABASE";
        null = [_clientID,_UID,_playerName] execVM "createDatabase.sqf";
    };
};

"saveData" addPublicVariableEventHandler
{
  private ["_data"];
  _data = (_this select 1);
  _UID = (_data select 0);
  _gear = (_data select 1);
  _cash =  (_data select 2);
  _blood = (_data select 3);
  _isBleeding = (_data select 4);
  _isInfected = (_data select 5);
  _position = (_data select 6);

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

  ["write", ["Player Info", "Cash", _cash]] call _inidbi;
  ["write", ["Player Info", "Position", _position]] call _inidbi;
  ["write", ["Player Gear", "Gear", _gear]] call _inidbi;
  ["write", ["Player Stats", "Blood", _blood]] call _inidbi;
  ["write", ["Player Stats", "isBleeding", _isBleeding]] call _inidbi;
  ["write", ["Player Stats", "isInfected", _isInfected]] call _inidbi;

  hint "data saved";

};

 

 

initplayerlocal.sqf

Spoiler

hint "init pl started";
execVM "shop.sqf";
_clientID = clientOwner;
_UID = getPlayerUID player;
_name = name player;


checkForDatabase = [_clientID,_UID,_name];
publicVariableServer "checkForDatabase";


"loadData" addPublicVariableEventHandler
{
  private ["_data"];
  _data = (_this select 1);
  _gear = (_data select 0);
  cash =  (_data select 1);
    _blood =  (_data select 2);
  _isBleeding =  (_data select 3);
  _isInfected =  (_data select 4);
  _position =  (_data select 5);

  player setposATL _position;
  player setUnitLoadout _gear;
  player setVariable ["VA_Blood", _blood];
  player setVariable ["VA_isBleeding", _isBleeding];
  player setVariable ["VA_isInfected", _isInfected];
};

player addaction ["hint cash",
{
hint str cash;
}];


testAI addEventHandler ["killed", {cash = cash +100; hint str cash}]

0 = [] spawn {
while {true} do {
  sleep 5;
  _UID = getPlayerUID player;
  null = [_UID] execvm "saveData.sqf";
  hint "data saved local";
};

};

 

 

 

 

 

createDatabase.sqf

Spoiler

_clientID = (_this select 0);
_UID = (_this select 1);
_playerName = (_this select 2);
_position = getposATL player;
_inidbi = ["new",_UID] call OO_INIDBI;

["write", ["Player Info","Name",_playername]] call _inidbi;
["write", ["Player Info","Position",_position]] call _inidbi;
["write", ["Player Info","Cash",0]] call _inidbi;
["write", ["Player Gear", "Gear", []]] call _inidbi;
["write", ["Player Stats", "Blood", 100]] call _inidbi;
["write", ["Player Stats", "isBleeding", false]] call _inidbi;
["write", ["Player Stats", "isInfected", false]] call _inidbi;

 

 

getData.sqf

Spoiler

_UID = (_this select 0);
_clientID = (_this select 1);

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

_cash = ["read",["Player Info", "Cash", []]] call _inidbi;
_position = ["read",["Player Info", "Position", []]] call _inidbi;
_gear = ["read",["Player Gear", "Gear", []]] call _inidbi;
_blood = ["read",["Player Stats", "Blood", []]] call _inidbi;
_isBleeding = ["read",["Player Stats", "isBleeding", []]] call _inidbi;
_isInfected = ["read",["Player Stats", "isInfected", []]] call _inidbi;

loadData = [_gear,_cash,_blood,_isBleeding,_isInfected,_position];
_clientID publicVariableClient "loadData";

 

 

saveData.sqf

Spoiler

_UID = (_this select 0);
_gear = getUnitLoadout player;
_cash = cash;
_blood = player getVariable ["VA_Blood", 100];
_isBleeding = player getVariable ["VA_isBleeding", false];
_isInfected = player getVariable ["VA_isInfected", false];
_position = getposATL player;
saveData = [_UID,_gear,_cash,_blood,_isBleeding,_isInfected,_position];
publicVariableServer "saveData";

 

 

shop.sqf

Spoiler

shopKeeper addaction ["Buy Gun",
{
params ["_target","_caller","_ID","_data"];
if (cash >= 100) then
{

player addWeapon "LMG_Mk200_F";
cash = cash - 100;

}
else
    {
      hint "not enought cash";
    };
}

];

 

 

 

I would greatly appreciate any help;)

 

cheers

VD

Share this post


Link to post
Share on other sites

Hi all,

 

following my above post, i did some step by step checks and atleast found where the code does no longer behave as intendet (or, not as it behaves in MP hosted) :

 

My "exists" check (to check if the client already has a database created) does not return true or false, but <null>,.

am I right to assume that this is a access (the .dll file or Arma) issue or an issue caused if the mod is not loaded correctly. Since I am loading the mod trough TADST as any other mod, i beliefe it is rather the first issue. 

 

Does anybody have an idea how to fix that? 

 

Cheers

Vd

Share this post


Link to post
Share on other sites

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

  • Like 1

Share this post


Link to post
Share on other sites

Hello Guys,

 

INIDBI2 is a fantastic mod. I used INIDBI2 to develop my own two mods, PPS and PPL. They save player statistics and loadouts. Yesterday I published a Video about INIDBI2 on my YouTube Channel Instant Arma. It's in german but perhaps you can use the auto translations from YouTube. In this video I explain the basic use of INIDBI2 with an driving license example. Only players with driving license for a vehicle class can drive. Otherwise the engine turns off after 1 second. So here is the direct link to the video. Enjoy.
 

 

  • Like 4

Share this post


Link to post
Share on other sites

Vandeanson I tried your code on my server so I can tell you its not an issue with the .dll files not being read as I used another load & save script before (the one made by mr.jizz, you can find it here).

That one writes & reads without problems, yet it has other problems that make it unusable sadly. Maybe if you take a look at that you can see a difference and adjust yours so it works, I dont know I'm not much of a scripter myself. In case you do get it working I'd be thankful if you'd share it since I really need one and all the ones I found and tried so far (from this thread) are not working or just partly and I havent managed to fix any of them by myself yet.

Share this post


Link to post
Share on other sites

@Luca  thank you, so my code does not work for you in dedicated?

 

I am about to start to look into this again once i am set up again (just moved) and i have a new partner in crime that helps me, will keep you posted! 

Will look at the linked code too then. 

 

@code34

Thank you, will start from scratch and check these points again. 

 

Cheers

Vd

Share this post


Link to post
Share on other sites

@Vandeanson

It saves everything perfectly fine but wont load it sadly. As I said before the code by Mr.Jizz works as far as saving and loading is concerned (there is just the problem the other users reported on that thread I linked).

Thats why I dont think its an issue related to the dlls or the way you load the mod but rather the code itself or something. But since I'm no scripter I can just guess.

Anyway, good luck to you!

  • Like 1

Share this post


Link to post
Share on other sites

@code34 once again thank you for this great product. 

 

Do you have any plans to enable a file hierarchy? Currently all created files are stored in once place, but what would be quite nice is if you could specify the creation of sub-folders within the root, so you could have folders for Users, Assets, Locations etc..

 

Share this post


Link to post
Share on other sites
On 10/30/2019 at 10:37 PM, reggaeman007jah said:

@code34 once again thank you for this great product. 

 

Do you have any plans to enable a file hierarchy? Currently all created files are stored in once place, but what would be quite nice is if you could specify the creation of sub-folders within the root, so you could have folders for Users, Assets, Locations etc..

 

 

hello

 

you can hardly set this path by modify it and recompile the dll. It s not dynamic for security reason

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

×