code34 248 Posted November 22, 2015 INIDBI2 Lastest Version : 2.06 by Code34 Direct Download from Dropbox Direct Download from Armaholic Github: https://github.com/code34/inidbi2 Steamworkshop: https://steamcommunity.com/sharedfiles/filedetails/?id=1768992669 Like to Donate ? Donate with paypal inidbi2 is a rebuild from scratch of inidbi project with C# and SQF++ for windows client/server Major improvements: New architecture oriented object support improve differents methods preload addon README Quote Description: INIDBI 2.06 - A simple server-side database extension using INI files Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2013-2019 Nicolas BOITEUX This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. How to install: 1- Unpack the archive and copy the entire "@inidbi2" folder into the ARMA3 root directory. The @inibdi2 folder should look like this: ../Arma 3/@inidbi2/inidbi2.dll ../Arma 3/@inidbi2/db/ ../Arma 3/@inidbi2/Addons/inidbi.pbo 2- check inidbi2.dll execution permissions, right click on it, and authorize it 3- load it through -serverMod=@inidbi2; or -mod=@inidbi2; Changelog - version 2.06 - add getKeys method - fix setseparator method, manage exception in delete method, manage exception in encode64base/decode64base - version 2.05 - re factory gettimestamp method return array instead string containing system UTC TIME - version 2.04 - add getSections method - version 2.02 - add methods to tune separators - fix write returns - fix read types - fix buffer overflow of decode/encodebase64 - fix getTimeStamp - version 2.0 - rebuild from scratch C# & SQF++ DOCUMENTATION Quote Description: INIDBI 2.06 - A simple server-side database extension using INI files Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2013-2019 Nicolas BOITEUX This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. ---------------------------------------------------------------------------------------------------------------------------------------------- Function : new Instanciate inidbi object Usage: _inidbi = ["new", _databasename] call OO_INIDBI; Param: string - the databasename to use. Databasename will be used as name of file on computer where the script is executed. INIDBI automatically add the .ini file extension to the databasename. This file is stored into the addons path into db/ directory. Output: inidbi2 object ---------------------------------------------------------------------------------------------------------------------------------------------- Function : getVersion Usage : "getVersion" call _inidbi; Param : none Output : string containing the addon version and dll version ---------------------------------------------------------------------------------------------------------------------------------------------- Function: exists Usage : "exists" call _inidbi; Param: none Output: true if the Arma has the required permissions and database file exists; otherwise, return false. ---------------------------------------------------------------------------------------------------------------------------------------------- Function : delete Usage : "delete" call _inidbi; Param: none Output: true if the database was deleted successfully, false otherwise ---------------------------------------------------------------------------------------------------------------------------------------------- Function: deleteSection Usage: ["deleteSection", _section] call _inidbi; Param: string _section - name of section to delete Output: true if the section was deleted successfully, false otherwise ---------------------------------------------------------------------------------------------------------------------------------------------- Function: deleteKey Usage : ["deleteKey", [_section, _key]] call _inidbi; Param: array string _section - name of section containing the key string _key - name of key to delete Output: true if the key was deleted successfully, false otherwise ---------------------------------------------------------------------------------------------------------------------------------------------- Function: read Usage : ["read", [_section, _key]] call _inidbi; Param: array string _section - name of sectrion containing the key string _key - name of key to read Output: value of key, if nothing is found return by default: false; You can set the default return value as follow (instead of false) ex: Usage : ["read", ["section", "key", "mydefaultvalueifnothingisfound"]] call _inidbi; Usage : ["read", ["section", "key", 0]] call _inidbi; Usage : ["read", ["section", "key", true]] call _inidbi; Usage : ["read", ["section", "key", ["mydefaultarray"]]] call _inidbi; ---------------------------------------------------------------------------------------------------------------------------------------------- Function: write Usage: ["write", [_section, _key, _value]] call _inidbi; Param: string _section - name of sectrion containing the key string _key - name of key to write string/scalar/array/bool _value - value to write (other type are not supported) Output : true if is write was successfull, false if not ---------------------------------------------------------------------------------------------------------------------------------------------- Function: encodeBase64 Usage: ["encodeBase64", _yourstring] call _inidbi; Param: string - an utf8 string to encode to base64 (max size 2048) Output: the string encode in base64, if error returns empty string ---------------------------------------------------------------------------------------------------------------------------------------------- Function: decodeBase64 Usage: ["decodeBase64", _yourstringbase64] call _inidbi; Param: string - a base64 string (max size 4096) Output: the string decode from base64 to utf8, if error returns empty string ---------------------------------------------------------------------------------------------------------------------------------------------- Function: getDbName Usage: "getDbName" call _inidbi; Param: none Output: return the database name ---------------------------------------------------------------------------------------------------------------------------------------------- Function: setDbName Usage : ["setDbName", _dbname] call _inidbi; Param: string - name of the file databasename (without its extension .ini) Output : nothing ---------------------------------------------------------------------------------------------------------------------------------------------- Function: getTimeStamp Usage : _time = "getTimeStamp" call _inidbi; Param : none Output : an array containing UTC timestamp of the OS system [YYYY, MM, DD, HH, MM, SS] ---------------------------------------------------------------------------------------------------------------------------------------------- Function : delete Delete inidbi object Usage: ["delete", _inidbi] call OO_INIDBI; Param: code - delete the _inidbi object Output: return nothing ---------------------------------------------------------------------------------------------------------------------------------------------- Function : getSeparator Usage : "getSeparator" call _inidbi; Param : none Output : string containing the parameters sepator (default is "|") ---------------------------------------------------------------------------------------------------------------------------------------------- Function : setSeparator will add to "|" your string separator Usage : ["setSeparator", _separator] call _inidbi; Param: string - suffix to add after the original operators "|" ex: _separator = "idb2"; ["setSeparator", _separator] call _inidbi; will set separator as "|idb2" Output: bool - return true if separator was setted, false if not ---------------------------------------------------------------------------------------------------------------------------------------------- Function : getSections Usage : "getSections" call _inidbi; Param: none Output : array containing all string sections (limit to 8K) ---------------------------------------------------------------------------------------------------------------------------------------------- Function : getKeys Usage : ["getKeys", _section] call _inidbi; Param : string _section - name of section containing the keys Output : array of string keys declared into the section (limit to 8K) ---------------------------------------------------------------------------------------------------------------------------------------------- You can save and load data persistently for your mission. Save money for players, inventories, etc. This is meant for servers but it could be used for clients, too. Have fun 🙂 You can also find video tutorials from gokitty1199 on this page: 23 Share this post Link to post Share on other sites
FireWalker 329 Posted November 22, 2015 Right on!! Can't wait to try this out! :D Share this post Link to post Share on other sites
kremator 1065 Posted November 22, 2015 Excellent release .. ty code34 ! Share this post Link to post Share on other sites
Guest Posted November 22, 2015 Thank you very much for informing us about the new release :) News frontpaged on the Armaholic homepage. INIDBI2 Share this post Link to post Share on other sites
bls-shoes 11 Posted November 23, 2015 In order to start iniDBi in the previous version we had to run this in the ini.sqf ...[call compile preProcessFile "\inidbi\init.sqf";] Is this now redundant? If so how is iniDBi2 started? Regards Share this post Link to post Share on other sites
code34 248 Posted November 23, 2015 Hi it doesn't work in the same way :) you normaly dont need anymore to compile preprocessfile. You only have to instanciate at least one object OO_INIDBI like this: _inidbi = ["new", "yourdatabasename"] call OO_INIDBI; and you can use it directly after with the variable reference containing the object (in this example _inidbi) like this: ["write", ["section", "key", "my writing test :) "]] call _inidbi; for this example i use a local variable but it works same with a global variable referencing the object :) 1 Share this post Link to post Share on other sites
doman 21 Posted November 23, 2015 Thank You very much for hard work and update ! :) I will test it in next few weeks. Share this post Link to post Share on other sites
HeroesandvillainsOS 1504 Posted November 23, 2015 Can someone tell me in black and white what this is? I currently use TADST as a dedicated server that I run on the same computer as my client. I use it to play ALiVE missions (alone) that I can save/resume from ALiVE's War Room. I currently don't really like how after resetting my server (aka, turning my computer off), how my mission kind of "resets" most things like I'm starting the mission over from scratch. Very few things are setup with War Room to save and load. Would this benefit me in any way? Share this post Link to post Share on other sites
code34 248 Posted November 24, 2015 hi HeroesandvillainsOS, INDBI is used by developers and requires some integration from them into the mission files :) 1 Share this post Link to post Share on other sites
mrcurry 505 Posted November 24, 2015 (edited) Hey code24, I'm was just updating to the new version. It looks great, but I'm running A3 editor with only IniDBI2 loaded modwise and I run into the following issue. Executed in debug console: 0 = [] spawn { _inidbi = ["new", "TestDBName"] call OO_INIDBI; diag_log text format ["Version: %1","getVersion" call _inidbi]; diag_log text format ["Write: %1",["write", ["TestSection", "TestKey", "TestData"]] call _inidbi]; diag_log text format ["Read: %1",["read", ["TestSection", "TestKey", "STRING", "Something done gone wrong"]] call _inidbi]; }; and the output is: 19:49:37 Version: Inidbi: 2.0 Dll: 19:49:37 Write: 19:49:37 Error in expression <esult = call compile _result; if(count _result > 1) then { _data = _result sele> 19:49:37 Error position: <_result > 1) then { _data = _result sele> 19:49:37 Error Undefined variable in expression: _result 19:49:37 File inidbi2\oo_inidbi.sqf, line 135 19:49:37 Read: any At first I thought it was a permissions thing on the DLL but, unless I missed something, the permissions are all set. I never had to do them up for the older version so in hindsight it seems unlikely.Any pointers would be appreciated. EDIT:Running on dedicated box is working... What could cause it to not work in SP/editor? I'm mostly asking because debugging is a lesser hassle in the editor. :PEDIT 2:Hmm... Testing this now on a dedicated server and it won't read saved array data.Contents of DB file: [highscores] list="[["mis_crs_nav_timetrial",[[74.046,"[EVO] Curry","76561197991086286"]]]]" And the code used to print it to log: [ [], { _varName = format ["%1_highscores", missionName]; _dbConn = ["new", _varName] call OO_INIDBI; diag_log text "-------"; diag_log text format [ "Test: %1", ["read", ["highscores", "list", "ARRAY"]] call _dbConn ]; } ] remoteExec ["spawn", 2]; And the resulting log: 2015/11/24, 20:44:15 ------- 2015/11/24, 20:44:15 Error in expression <[true,"[["mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error position: <mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error Missing ] 2015/11/24, 20:44:15 Error in expression <[true,"[["mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error position: <mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error Missing ] 2015/11/24, 20:44:15 Error in expression <esult = call compile _result; if(count _result > 1) then { _data = _result sele> 2015/11/24, 20:44:15 Error position: <_result > 1) then { _data = _result sele> 2015/11/24, 20:44:15 Error Undefined variable in expression: _result 2015/11/24, 20:44:15 File inidbi2\oo_inidbi.sqf, line 135 2015/11/24, 20:44:15 Test: any It seems the new version doesn't like the way I formatted my data. It worked on the old version. Bug? or do I have to do a rewrite? Edited November 24, 2015 by mrcurry Share this post Link to post Share on other sites
code34 248 Posted November 24, 2015 hi i don't reproduce the bug :( i just copy/paste your code, and it works normaly _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]; 22:04:35 "Version: Inidbi: 2.0 Dll: 2.0"22:04:35 "Write: true"22:04:35 "Read: TestData" Share this post Link to post Share on other sites
code34 248 Posted November 24, 2015 EDIT 2: Hmm... Testing this now on a dedicated server and it won't read saved array data. Contents of DB file: [highscores] list="[["mis_crs_nav_timetrial",[[74.046,"[EVO] Curry","76561197991086286"]]]]" And the code used to print it to log: [ [], { _varName = format ["%1_highscores", missionName]; _dbConn = ["new", _varName] call OO_INIDBI; diag_log text "-------"; diag_log text format [ "Test: %1", ["read", ["highscores", "list", "ARRAY"]] call _dbConn ]; } ] remoteExec ["spawn", 2]; And the resulting log: 2015/11/24, 20:44:15 ------- 2015/11/24, 20:44:15 Error in expression <[true,"[["mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error position: <mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error Missing ] 2015/11/24, 20:44:15 Error in expression <[true,"[["mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error position: <mis_crs_nav_timetrial",[[74.046,"[EVO] C> 2015/11/24, 20:44:15 Error Missing ] 2015/11/24, 20:44:15 Error in expression <esult = call compile _result; if(count _result > 1) then { _data = _result sele> 2015/11/24, 20:44:15 Error position: <_result > 1) then { _data = _result sele> 2015/11/24, 20:44:15 Error Undefined variable in expression: _result 2015/11/24, 20:44:15 File inidbi2\oo_inidbi.sqf, line 135 2015/11/24, 20:44:15 Test: any It seems the new version doesn't like the way I formatted my data. It worked on the old version. Bug? or do I have to do a rewrite? Hi mrcurry I just released an hotfix that should resolve your problem :) Hot fix - release 2.01 - fix read cast function- improve iterative parsing array type- fix return value, when key is empty Direct Download from Dropbox You can found also the stream concerning the build of this hotfix at this place : ) Twitch - Hotfix 2.01 Share this post Link to post Share on other sites
Guest Posted November 25, 2015 New version frontpaged on the Armaholic homepage. INIDBI2 v2.01 Share this post Link to post Share on other sites
code34 248 Posted November 25, 2015 New version frontpaged on the Armaholic homepage. INIDBI2 v2.01 Thanks you Foxhound ! :) Share this post Link to post Share on other sites
mrcurry 505 Posted November 25, 2015 Hi mrcurry I just released an hotfix that should resolve your problem :) Thanks code, can confirm working now. Cheerio! Share this post Link to post Share on other sites
code34 248 Posted November 27, 2015 Ok nice :) any other request or feedback ? :) Share this post Link to post Share on other sites
bls-shoes 11 Posted November 29, 2015 Hi it doesn't work in the same way :) you normaly dont need anymore to compile preprocessfile. You only have to instanciate at least one object OO_INIDBI like this: and you can use it directly after with the variable reference containing the object (in this example _inidbi) like this: for this example i use a local variable but it works same with a global variable referencing the object :) OK thank you, simple enough. Share this post Link to post Share on other sites
Nutzgo 15 Posted December 4, 2015 Tried to integrate this into my server, but this appears in the chat whenever I load my mission:Script \inidbi2\init.sqf not found Share this post Link to post Share on other sites
code34 248 Posted December 4, 2015 Tried to integrate this into my server, but this appears in the chat whenever I load my mission: Script \inidbi2\init.sqf not found how do you call this : Script \inidbi2\init.sqf ? Share this post Link to post Share on other sites
Nutzgo 15 Posted December 5, 2015 I pasted: call compile preProcessFile "\inidbi2\init.sqf"as the top line in init.sqf in my pbo, as the instructions said.(I'm kinda new into this missionscripting, so have patience! :)) Share this post Link to post Share on other sites
code34 248 Posted December 5, 2015 mmm you should delete this line, not anymore required :) Share this post Link to post Share on other sites
rebelvg 281 Posted December 5, 2015 Tried to write a really huge array and it cut it around at around a 8000 symbol. Is this intended and is there a way around this? And another small thing I noticed. ["write", ["section", "key", "toutes les informations"]] call _inidbi; Returns "true" as a string, not bool. Share this post Link to post Share on other sites
code34 248 Posted December 5, 2015 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 Share this post Link to post Share on other sites
Nutzgo 15 Posted December 6, 2015 mmm you should delete this line, not anymore required :) Oh! Okay! :-) But, how to integrate the script on my Dedicated Server? Just, paste the mod inside the server directory, and add "-mod=@inidbi2" to the server startup parameters? Share this post Link to post Share on other sites
code34 248 Posted December 6, 2015 Oh! Okay! :-) But, how to integrate the script on my Dedicated Server? Just, paste the mod inside the server directory, and add "-mod=@inidbi2" to the server startup parameters? yes, you can follow the install instruction except the call compilone one :) Share this post Link to post Share on other sites