Jump to content

Prod6112

Member
  • Content Count

    4
  • Joined

  • Last visited

  • Medals

Community Reputation

10 Good

About Prod6112

  • Rank
    Rookie

core_pfieldgroups_3

  • Occupation
    Profession: Access-Control Technician

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Prod6112

    Config Parser Script

    Updated to version 1.1 You can now switch the output destination to the clipboard to solve the character limits problem (see the first post) The new config parser take 6.682s with clipboard copy to output the entire configFile (not sorted) However' date=' it seems that there is no difference with the Alphabetical sort function (still ~150s) Right kju!, the fastest way now is to do the sorting with an external library...
  2. Prod6112

    Config Parser Script

    Hi kju Merci for your response ;) Im going to try the dumpConfig script Here are some details about the Alphabetical sort function i worked on: Description: Sort Alphabetically an array of strings Features: Any ASCII character is allowed due to the toArray command usage Can be case sensitive or not by adding/removing the toLower command Array can be a config data type (adding configName) Array is passed by reference Result can be reversed I didn't find another way to sort alphabetically an array of strings (except the lbSort command which is faster but only works on listbox). After a couple of time spent and tests, this is the fastest algorithm i found : AlphabeticalSort = { if (count _this < 2) exitWith {}; private ["_array1", "_array2", "_tmp", "_isSorted"]; for "_inc" from 0 to (count _this -2) do { for "_dec" from _inc to 0 step -1 do { _array1 = toArray(toLower(_this select _dec)); _array2 = toArray(toLower(_this select _dec +1)); _isSorted = false; for "_i" from 0 to (count _array1) do { if (_i >= count _array2 || {_array1 select _i > _array2 select _i}) exitWith { _tmp = _this select _dec; _this set [_dec, _this select _dec +1]; _this set [_dec +1, _tmp] }; if (_array1 select _i < _array2 select _i) exitWith {_isSorted = true} }; if _isSorted exitWith {}; }; }; }; I tested the code with the configNames of all the firsts configFile classes (742 elements) The original code resulted in 4s. This one in 2.87s Different implementations (not case sensitive): - Array of strings (A to Z) - Array of strings (Z to A) - Array of configs (A to Z) - Array of configs (Z to A) ---------- Post added at 16:26 ---------- Previous post was at 14:58 ---------- Thx for the tip kju! this dumpConfig took 9s versus 17s for mine (using clipboard copy instead of diag_log reduce the time and solve the 1024 chars limit problem) I think im going to try the clipboard idea to see how many times it take with the alphabetical sort function.
  3. Hello to all the BIS community. New to SQF scripting, i would like to share my first script. Description: Parse a config class and print all sub-classes + entries in a C-Like text to the report file. Installation: Copy the file "ConfigParser.sqf" into your mission folder. Parameters: 0: <CONFIG> config entry to parse (must be a class) 1: <BOOLEAN> (optional) if true: the output will be alphabetically sorted. Usage examples: [configFile >> "CfgVehicles", true] call compile preprocessFile "ConfigParser.sqf"; [configFile >> "CfgWeapons"] execVM "ConfigParser.sqf"; Link: ConfigParser.sqf v1.1 Screenshots: overview1.jpg (882 kB) overview2.jpg (280 kB) overview3.jpg (275 kB) Toggle output to Clipboard/Report File Recommandations: Call it between startLoadingScreen and endLoadingScreen commands when using "call compile preprocessFile" for a full speed execution of the script. I recommand notepad++ to open the arma3*.rpt file (Choose Language > C++ style). Known Issues: execVM command will stop the script if the passed config class is too big (configFile e.g.) [sOLVED] Arrays are not printed with the correct C syntax. [sOLVED] Due to the 1024 chars limit of the diag_log command, some arrays are not fully printed. Only solved in clipboard output mode (see the last screenshot) Performances: Used test code: startLoadingScreen [""]; _a = diag_ticktime; [configFile, true] call compile preprocessFileLineNumbers "ConfigParser.sqf"; _b = diag_ticktime; endLoadingScreen; diag_log str(_b - _a); Arma3 Alpha v0.57.105125 Date: 2013/05/13 20:01:17 Processor speed: 3,4Ghz Drive type: SSD Loaded Addons: Result: Elapsed Time: 144.203s (17.826s without alphabetical sort) Report File Size: 9,432,732 bytes Lines: 226567 Classes printed: 32369 Can you let me know your positive/negative feedbacks and encountered bugs ? Thanks Thanks: .kju [PvPscene] for his very usefull tips. Denis Usenko for a nice string concatenation algorithm in the dumpConfig (re-implemented for the script) Killzone_Kid for the Notepad++ SQF syntax highlight. All wiki members as always, keeping it up to date.
×