Jump to content
code34

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

Recommended Posts

mmm there is always a way :D

 

but i m bit afraid to go over the BIS design limit

 

like you want , i can add this buffer thing to the next update, but it will create new probem

 

i will look too for bool return

I found a workaround for 8000 symbols limit so if that buffer thing is gonna create some problems don't worry about it.

Thanks anyway, really helpful addon.

Share this post


Link to post
Share on other sites

yes, you can follow the install instruction except the call compilone one :)

Thank you, for your help and your patience with me!

Okay, now it seems to be loading, I do not get the error message anymore. 

So, next question.. The "Save"-button is greyed out. For half a second, when I log in, where the savebutton is supposed to be, I get an option to "Skip" - but it disappears really fast, and is replaced by a greyed out save-button. 

I feel so green for asking for this.. but, how do I save?  :blink:

Share this post


Link to post
Share on other sites

Code34, I have probably found a bug.
 
Related code:

_time = time;
{
	if ((alive _x) && (isplayer _x)) then {
		_pname = name _x;
		_pdescr = roleDescription _x;
		_pgroup = group _x;
		_puid = getPlayerUID _x;
		_ok = ["write", [_time, format ["UID==%1",_puid], format ["Name==%1##Descr==%2##Group==%3##", _pname, _pdescr, _pgroup]]] call _inidbi;
	};
} forEach allPlayers;

With inidbi version 1 i had this output in db:
 

UID==76561197XXXXXXXXX="Name==Wyspa##Descr==Hotel | RTO##Group==B Alpha 1-1##"
UID==76561198XXXXXXXXX="Name==Szakal##Descr==Hotel | Squad Leader##Group==B Alpha 1-1##"

Now, with inidbi2 i have this:

UID==76561198XXXXXXXXX="Name==Tiberrias##Descr==Hotel 
UID==76561198XXXXXXXXX="Name==Doman##Descr==Hotel 

It seems like sign " | " is breaking write function somehow.
 
Is there simple solution for that?

 

 

 

 

PS. In Your signature is still link to inidbi v1, no links to version 2 :P

Share this post


Link to post
Share on other sites

Thank you, for your help and your patience with me!

Okay, now it seems to be loading, I do not get the error message anymore. 

So, next question.. The "Save"-button is greyed out. For half a second, when I log in, where the savebutton is supposed to be, I get an option to "Skip" - but it disappears really fast, and is replaced by a greyed out save-button. 

I feel so green for asking for this.. but, how do I save?  :blink:

 

Lol :) you couldn't save as this ! Inidbi2 is for developpers and require they use it directly in the mission code. It s not a save/restore feature you can use directly in the game through a button :)

Share this post


Link to post
Share on other sites

Code34, I have probably found a bug.

 

Related code:

_time = time;
{
	if ((alive _x) && (isplayer _x)) then {
		_pname = name _x;
		_pdescr = roleDescription _x;
		_pgroup = group _x;
		_puid = getPlayerUID _x;
		_ok = ["write", [_time, format ["UID==%1",_puid], format ["Name==%1##Descr==%2##Group==%3##", _pname, _pdescr, _pgroup]]] call _inidbi;
	};
} forEach allPlayers;

With inidbi version 1 i had this output in db:

 

UID==76561197XXXXXXXXX="Name==Wyspa##Descr==Hotel | RTO##Group==B Alpha 1-1##"
UID==76561198XXXXXXXXX="Name==Szakal##Descr==Hotel | Squad Leader##Group==B Alpha 1-1##"

Now, with inidbi2 i have this:

UID==76561198XXXXXXXXX="Name==Tiberrias##Descr==Hotel 
UID==76561198XXXXXXXXX="Name==Doman##Descr==Hotel 

It seems like sign " | " is breaking write function somehow.

 

Is there simple solution for that?

 

 

 

 

PS. In Your signature is still link to inidbi v1, no links to version 2 :P

 

Hi

 

Yes for the moment "|" sign is used instead ";" to separate the fields, i have to add this fix to next update too :)

  • Like 1

Share this post


Link to post
Share on other sites

I have fixed this and commited pull request to yours repository on Github (https://github.com/code34/inidbi2/pull/1/files)

It is tested on my community`s server. Works ok. | sign is not breaking write function.

Download if someone is interested:

inidbi2.dll -> https://drive.google.com/file/d/0B99v4gsBZT3JLXBPWnhBOTIwTUk/view?usp=sharing

inidbi2.pbo -> https://drive.google.com/file/d/0B99v4gsBZT3JX1FGMmVUVXlOWnM/view?usp=sharing

Please do not repost or share. If I am not trusted for You - don`t download dll file! Wait for Code34 acceptance.

Share this post


Link to post
Share on other sites

I have fixed this and commited pull request to yours repository on Github (https://github.com/code34/inidbi2/pull/1/files)

It is tested on my community`s server. Works ok. | sign is not breaking write function.

Download if someone is interested:

inidbi2.dll -> https://drive.google.com/file/d/0B99v4gsBZT3JLXBPWnhBOTIwTUk/view?usp=sharing

inidbi2.pbo -> https://drive.google.com/file/d/0B99v4gsBZT3JX1FGMmVUVXlOWnM/view?usp=sharing

Please do not repost or share. If I am not trusted for You - don`t download dll file! Wait for Code34 acceptance.

 

hi

 

nice shot, you got it :) except we should solve this definitively using a ,not reproductable/unique strings separator. ";" as "|" is not enough to solve all the use cases.

Share this post


Link to post
Share on other sites

I'm back and I bring with me a pair of bugs. Not the nasty crawling kind, mind you, but the logical solvable ones!  :)

 

Version: "Inidbi: 2.01 Dll: 2.01"

 

Bug #1:

There seems to be an issue with the "write" function stripping away a pair of " when writing to the file. When reading the "read" function will return "any" (str nil).

 

I could easily write around this by wrapping my original string in 2 sets of ". So instead of "myStringHere" it would read """myStringHere""".

However it does seem like something the function should be capable of doing on its own. :)

 

Read code: 

//Example #1
testConn = ["new", "testFile"] call OO_INIDBI;
["write", ["Section", "Key", "myString"]] call testConn;
var = ["read", ["Section", "Key", "STRING", ""]] call testConn; 
//var == "any"

//Example #2
testConn = ["new", "testFile"] call OO_INIDBI;
["write", ["Section", "Key", """myString"""]] call testConn;
var = ["read", ["Section", "Key", "STRING", ""]] call testConn; 
//var == "value" 

Observe that in example #1 the returned value is still a string but it only contains the str result of nil.

 

This is what the database file looks like in each example:

//Example #1
[Section]
Key="myString"

//Example #2
[Section]
Key=""myString""

Bug #2:

The "read" function ignores the provided default value when using the 4 parameter syntax and returns the standard default for the type (STRING returns "", ARRAY returns [], etc.).

 

Example:

["read", ["Section", "nonExistantKey", "STRING", "default"]] call testConn; 
//returns "" instead of "default"

["read", ["Section", "nonExistantKey", "ARRAY", [1,2,3]]] call testConn; 
//returns [] instead of [1,2,3]

["read", ["Section", "nonExistantKey", "SCALAR", 5]] call testConn; 
//returns 0 instead of 5

Enjoy! :)

Share this post


Link to post
Share on other sites

hello Mrcurry,

 

im working on the fix. i will release it this week if all is ok :)

Share this post


Link to post
Share on other sites

Hi,
 
i relly put a whole lot of efford and time into my project and all i have left to do is an database to "complete" the project.

 

 

 

Edit:

In my arma launcher i just saw (trying things on my own) that the inidbi is getting blocked  by BattelEye and i  dont knwo how to fix it either (Iguess just turning it off bit this cant be the anwer or ?)

 

Edit from the edit:  

 

Okay now as i disabeld the battle eye i get an example database file (stil need help because i dont have an clue)

 

But this is my stand is now 

_sender = player;
_playerid = getPlayerUID _sender;

sleep 30;
b = items _sender;
c = getPos _sender;

_inidbi = ["new", _playerid] call OO_INIDBI; 
["write", ["section", "items", b]] call _inidbi; 
["write", ["section", "pos", c]] call _inidbi;


sleep 10;
removeAllItems s1;

hintC "your things are gone";

sleep 10;

["read", ["section", "items", "ARRAY"]] call _inidbi;

hint "are they back?"

but they never are back

 

so what i then get is what i want to. it get's his items and anything but i dont knwo how the read will work because if i only read the data nothing will happen i guess because i need an add item command and set pos right ? and i dont know how to build that he checks if i alredy have an entry in the database

Share this post


Link to post
Share on other sites

hi :)

 

Just release the last version 2.02

 

    Changelog
        - add methods to tune separators
        - fix write returns
        - fix read types
        - fix buffer overflow of decode/encodebase64
        - fix getTimeStamp

 

You should look for the last documentation. Read function doesn't need anymore type return :)

 

Download 2.02 on Dropbox

Share this post


Link to post
Share on other sites

Hi,

 

i relly put a whole lot of efford and time into my project and all i have left to do is an database to "complete" the project.

 

 

 

Edit:

In my arma launcher i just saw (trying things on my own) that the inidbi is getting blocked  by BattelEye and i  dont knwo how to fix it either (Iguess just turning it off bit this cant be the anwer or ?)

 

Edit from the edit:  

 

Okay now as i disabeld the battle eye i get an example database file (stil need help because i dont have an clue)

 

But this is my stand is now 

_sender = player;
_playerid = getPlayerUID _sender;

sleep 30;
b = items _sender;
c = getPos _sender;

_inidbi = ["new", _playerid] call OO_INIDBI; 
["write", ["section", "items", b]] call _inidbi; 
["write", ["section", "pos", c]] call _inidbi;


sleep 10;
removeAllItems s1;

hintC "your things are gone";

sleep 10;

["read", ["section", "items", "ARRAY"]] call _inidbi;

hint "are they back?"

but they never are back

 

so what i then get is what i want to. it get's his items and anything but i dont knwo how the read will work because if i only read the data nothing will happen i guess because i need an add item command and set pos right ? and i dont know how to build that he checks if i alredy have an entry in the database

 

you should try something like that :)

 

_items = ["read", ["section", "items", []]] call _inidbi;

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the help code 34 in this castle but tod told me the end is an other castle :D 

Code:

a = getPlayerUID s1;
sleep 30;
b = items s1;
c = getPos s1;
 
_inidbi = ["new", a] call OO_INIDBI; 
	["write", ["section", "items", b]] call _inidbi; 
	["write", ["section", "pos", c]] call _inidbi;
	

removeAllItems s1;

hintC "your things are gone";

sleep 5;
d = ["read", ["section", "items", []]] call _inidbi;

{
	a additem "";
} foreach d;

The new problem is 

CBDFE116A954A44C85DE223FF8D294F0C1B50A2B

i guess he is reading the Arry as an string but how i fix this again no plan. i am also working on this problem (not waiting till somone fix this for me) but i am happy and greathfull woth any help.

 

also i wish Happy Holidays 

Share this post


Link to post
Share on other sites

Thanks for the help code 34 in this castle but tod told me the end is an other castle :D 

Code:

a = getPlayerUID s1;
sleep 30;
b = items s1;
c = getPos s1;
 
_inidbi = ["new", a] call OO_INIDBI; 
	["write", ["section", "items", b]] call _inidbi; 
	["write", ["section", "pos", c]] call _inidbi;
	

removeAllItems s1;

hintC "your things are gone";

sleep 5;
d = ["read", ["section", "items", []]] call _inidbi;

{
	a additem "";
} foreach d;

The new problem is 

CBDFE116A954A44C85DE223FF8D294F0C1B50A2B

i guess he is reading the Arry as an string but how i fix this again no plan. i am also working on this problem (not waiting till somone fix this for me) but i am happy and greathfull woth any help.

 

also i wish Happy Holidays 

 

perhaps you should try something like this :)

 

{

    s1 additem _x;

} foreach d;

 

you should use more undestandable variable names, it can be a good pratice to improve your code

Share this post


Link to post
Share on other sites

Well not working with MCC Sandbox 4 Mod for role selection :( INIdb isn't running error.

 

Hi

 

Can you give me more informations of what you do ? :)

Share this post


Link to post
Share on other sites

Hi

 

Can you give me more informations of what you do ? :)

 Simple: When i have MCC Sandbox mod (latest) and click to Enable Roles in MCC GUI then mod me say in screen - INIDbi isn't running to play with this feature. With old version INIDbi works fine. But this new version no. Well maybe i need waiting for next release MCC for compatibility.

Share this post


Link to post
Share on other sites

yes :) inidbi2 doesn't work anymore as inidbi 1

Share this post


Link to post
Share on other sites

perhaps you should try something like this :)

 

{

    s1 additem _x;

} foreach d;

 

you should use more undestandable variable names, it can be a good pratice to improve your code

 

Oh gosh O.O this happens when you dont look at your script 

last time i did somthing on my script so that it is dynamic and stuff and i obvius didnt saved it and i didnt noticed that till now :D. thanks for helping me see  !

Normaly i take understandeble variable names but i mostly do this in german so i thougth i should change this in somthing else

 

 

But new problem i want to know if an database exists with the players id 

 

my try was

_sender = player;
_playerid = getPlayerUID _sender;
_position = getPos _sender;
_items = items _sender;
_true = "true";




_inidbi = [_playerid] call OO_INIDBI; 


U = "exists" call _inidbi;


switch (U) do
{
case true : {
// runs loading script
};


case false : {
//runs extern new spawn script
};


}; 

but (i know i did the  call OO_inidbi false) it dosent work but if i say ("new" dbname) it would create evry time a new one. how do i need to do it  that it goes right.

 

Edit : I guess i should explain what i want to do so you can follow me ^^. I want that every player/vehicle on the server gets his own .ini  an that he ches if this player alredy haves one or not

Share this post


Link to post
Share on other sites

Great Addon.

 

I use it to manage 5 Databases in my mission  -=LOST=-   and it all works great.

 

But since your still updating it and adding new commands may I request a way to count and index the main field  in the databases

 

something like

_count = ["count", "databasename"] call OO_INIDBI;

for "_i" from 0 to (_count  - 1) do
{
_sectionname = ["find", _i] call _inidbi;
_data = ["read", _sectionname, "key"]] call _inidbi;
[_data] execVM "runmycode.sqf";
};

then I can reduce my 5 to 3 databases as I use 2 of then as indexes for vehicles and wrecks databases 

 

I don't know if its even possible , Just thought I would ask

Share this post


Link to post
Share on other sites

Oh gosh O.O this happens when you dont look at your script 

last time i did somthing on my script so that it is dynamic and stuff and i obvius didnt saved it and i didnt noticed that till now :D. thanks for helping me see  !

Normaly i take understandeble variable names but i mostly do this in german so i thougth i should change this in somthing else

 

 

But new problem i want to know if an database exists with the players id 

 

my try was

_sender = player;
_playerid = getPlayerUID _sender;
_position = getPos _sender;
_items = items _sender;
_true = "true";




_inidbi = [_playerid] call OO_INIDBI; 


U = "exists" call _inidbi;


switch (U) do
{
case true : {
// runs loading script
};


case false : {
//runs extern new spawn script
};


}; 

but (i know i did the  call OO_inidbi false) it dosent work but if i say ("new" dbname) it would create evry time a new one. how do i need to do it  that it goes right.

 

Edit : I guess i should explain what i want to do so you can follow me ^^. I want that every player/vehicle on the server gets his own .ini  an that he ches if this player alredy haves one or not

 

you can do it with a lof maner :) the easiest way is for example for mp code

 

if(isnil (_player getvariable "inidbi")) then {
_inidbi = ["new", _playerid] call OO_INIDBI;
_player setVariable ["inidbi", _inidbi];
};
;

 

if it s a sp code, you only have to generate your object once at the start of mission, and give as parameter of your script

 

other example: you can use oo_hashmap object in the same way to store objets, or make your own player object, etc

Share this post


Link to post
Share on other sites

Great Addon.

 

I use it to manage 5 Databases in my mission  -=LOST=-   and it all works great. Well it did until Ver 2.2 but I'm guessing that has to do with compatibility between the 2.1 and 2.2 ini Databases 

 

But since your still updating it and adding new commands may I request a way to count and index the main field  in the databases

 

something like

_count = ["count", "databasename"] call OO_INIDBI;

for "_i" from 0 to (_count  - 1) do
{
_sectionname = ["find", _i] call _inidbi;
_data = ["read", _sectionname, "key"]] call _inidbi;
[_data] execVM "runmycode.sqf";
};

then I can reduce my 5 to 3 databases as I use 2 of then as indexes for vehicles and wrecks databases 

 

I don't know if its even possible , Just thought I would ask

 

mmm, i see. I have to see if INI API can permit it :)

 

i think it could be possible for exempla to retrieve all sections name (limit to buffer size 8K) but you still have to know the key name (don't think there is a probe function for key)

 

it could be something like this

_sections = "getSections" call _inidbi;
 
{
_data = ["read", _x, "key"]] call _inidbi;
[_data] execVM "runmycode.sqf";
}foreach _sections;
 

Share this post


Link to post
Share on other sites

That would work great also, 

 

where this would work out great for me is the population of all the vehicles and wrecks on the map

as they get destroyed and new ones added I never know how many are in the database.

 

sectionname are mostly dynamic 

Key names are mostly static so you always know what the key names will be

 

Thanks for looking into it.

 

Tip for others  (This will always give your Database a different name for each mission ie: My Mission is called LOST.Altis--- DB Name LOST.Altis.ini  )

 

_DataBase = missionName + "." + worldName ;

DataBase = ["new", _DataBase] call OO_INIDBI;

 

 

Just a test to read and write the date to the data base

 

_date = ["read",["Server", "Date", []]] call DataBase;
["write", ["Server", "Date", _date]] call DataBase;
 
 
 
 
found out why my mission stopped after updating to 2.2
 
 
Ver 2.1 /
DB_VEHICLE_LIST = ["read", ["LIST","VEHICLES", "ARRAY"]] call DataBase;
 
 
Ver 2.2 / 
DB_VEHICLE_LIST = ["read", ["LIST","VEHICLES", []]] call DataBase;
so to make it compatible for both I did this
 
_VER = "getVersion" call DataBase;
_INI_VER = if (_VER == "Inidbi: 2.01 Dll: 2.01") then {"ARRAY"}else{[]};

DB_VEHICLE_LIST = ["read", ["LIST","VEHICLES", _INI_VER]] call DataBase;

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

×