7erra 629 Posted August 15, 2017 Hello everyone! I wrote a script with which you can turn a dialog config into the format that the GUI editor uses. The goal was to be able to edit an already existing dialog after the GUI editor has been closed. This should make alternating dialog configs easier. Spoiler /* fn_dialogToImport Author: Terra Description: This script converts an already existing dialog to an importable format for the GUIEditor to use. Params: 0: NUMBER - IDD of the dialog (only has to be present as config, not opened) Return: Copies the resulting text to the clipboard, GUI import text */ params ["_IDD"]; _lineBreak = toString [10]; _tab = toString [9]; _retArray = []; _int = 0; _fncNewLine = { _tabArray = []; if (_int > 0) then {for "_i" from 0 to _int do {_tabArray pushBack _tab};}; {_retArray pushBack _x;} forEach (_tabArray + [_this,_lineBreak]); }; // Find IDD in configs: _cfgPath = configFile; { _cfgFile = _x; { _curCfg = _x; if (getNumber (_curCfg >> "idd") == _IDD) exitWith {_cfgPath = _curCfg}; } forEach ("true" configClasses (_x)); } forEach [configFile, missionConfigFile, campaignConfigFile]; // Header _letterArray = toArray "qwertzuiopasdfghjklyxcvbnm"; _randomLetters = [0,1,2,3,4,5]; _randomLetters = _randomLetters apply {selectRandom _letterArray}; _firstLetterBig = toArray (toUpper (toString [_randomLetters select 0])); _randomLetters set [0,_firstLetterBig select 0]; _randomLetters = toString _randomLetters; //_header = "/* #" +_randomLetters; //_header call _fncNewLine; // Line 2 _line2 = "$["; _line2 call _fncNewLine; _int = 1; // Version _version = "1.063,"; _version call _fncNewLine; // Title line _nameOfDisplay = configName _cfgPath; _titleLine = "[" +str _nameOfDisplay +",[[0,0,1,1],0.025,0.04,""GUI_GRID""],0,0,0],"; _titleLine call _fncNewLine; // Now it gets difficult // Find all controls, find correct idc to handle for the GUI editor _iguiBackIDC = 2200; _buttonIDC = 1600; _buttonMenuIDC = 2400; _buttonCancelIDC = 2700; _buttonOkIDC = 2600; _checkboxIDC = 2800; _comboIDC = 2100; _controlsGroupIDC = 2300; _editIDC = 1400; _frameIDC = 1800; _gridIDC = 900; // I don't know what this is _listboxIDC = 1500; _pictureIDC = 1200; _pictureKeepAspectRatioIDC = 1300; _shortcutButtonIDC = 1700; _shortcutButtonMainIDC = 2000; _sliderIDC = 1900; _structuredTextIDC = 1100; _textIDC = 1000; _textCheckBoxIDC = 2500; _toolIDC = 800; // No idea again _acceptedCtrl = ["IGUIBack","RscButton","RscButtonMenu","RscButtonMenuCancel","RscButtonMenuOk","RscCheckbox","RscCombo","RscControlsGroup","RscEdit","RscFrame","RscListbox","RscPicture","RscShortcutButton","RscShortcutButtonMain","RscSlider","RscStructuredText","RscText","RscTextCheckbox"]; //_retFnc = [_cfgPath] call DREAD_fnc_copyConfigClass; #define ADD1(VAR) VAR = VAR +1 #define COMMA _lineCtrl = _lineCtrl +","; #define TEXTADD(VAR) _lineCtrl = _lineCtrl +str VAR; #define CHECKVAL(ARRAY) if (ARRAY isEqualTo []) then {ARRAY = [-1,-1,-1,-1]}; { _curCfg = _x; _allCtrls = "true" configClasses _x; //reverse _allCtrls; { _lineCtrl = "["; _inheritance = configName (inheritsFrom _x); _idc = -1; switch _inheritance do { case "IGUIBack": {_idc = _iguiBackIDC; ADD1(_iguiBackIDC)}; case "RscButton": {_idc = _buttonIDC; ADD1(_buttonIDC)}; case "RscButtonMenu": {_idc = _buttonMenuIDC; ADD1(_buttonMenuIDC)}; case "RscButtonMenuCancel": {_idc = _buttonCancelIDC; ADD1(_buttonCancelIDC)}; case "RscButtonMenuOk": {_idc = _buttonOkIDC; ADD1(_buttonOkIDC)}; case "RscCheckbox": {_idc = _checkboxIDC; ADD1(_checkboxIDC)}; case "RscCombo": {_idc = _comboIDC; ADD1(_comboIDC)}; case "RscControlsGroup": {_idc = _controlsGroupIDC; ADD1(_controlsGroupIDC)}; case "RscEdit": {_idc = _editIDC; ADD1(_editIDC)}; case "RscFrame": {_idc = _frameIDC; ADD1(_frameIDC)}; //case "unknown": {_idc = _gridIDC; ADD1(_gridIDC)}; case "RscListbox": {_idc = _listboxIDC; ADD1(_listboxIDC)}; case "RscPicture": {_idc = _pictureIDC; ADD1(_pictureIDC)}; case "RscPicutreKeepAspectRatio": {_idc = _pictureKeepAspectRatioIDC; ADD1(_pictureKeepAspectRatioIDC)}; case "RscShortcutButton": {_idc = _shortcutButtonIDC; ADD1(_shortcutButtonIDC)}; case "RscShortcutButtonMain": {_idc = _shortcutButtonMainIDC; ADD1(_shortcutButtonMainIDC)}; case "RscSlider": {_idc = _sliderIDC; ADD1(_sliderIDC)}; case "RscStructuredText": {_idc = _structuredTextIDC; ADD1(_structuredTextIDC)}; case "RscText": {_idc = _textIDC; ADD1(_textIDC)}; case "RscTextCheckbox": {_idc = _textCheckBoxIDC; ADD1(_textCheckBoxIDC)}; //case "unknown": {_idc = _toolIDC; ADD1(_toolIDC)}; default {_idc = _iguiBackIDC; ADD1(_iguiBackIDC)}; }; TEXTADD(_idc) // "[1000" COMMA // "[1000," _ownClassName = configName _x; TEXTADD(_ownClassName) // "[1000,"ownClassName"" _lineCtrl = _lineCtrl +",[1,"; // " [1000,"ownClassName",[1, " _ctrlText = getText (_x >> "text"); TEXTADD(_ctrlText) // " [1000,"ownClassName",[1,"ctrlText" " _lineCtrl = _lineCtrl +",["; // " [1000,"ownClassName",[1,"ctrlText",[ " _Xcoord = getText (_x >> "x"); TEXTADD(_Xcoord) // " [1000,"ownClassName",[1,"ctrlText",["xcoords" " COMMA // " [1000,"ownClassName",[1,"ctrlText",["xcoords", " _Ycoord = getText (_x >> "y"); TEXTADD(_Ycoord) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords" " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords", " _Wcoord = getText (_x >> "w"); TEXTADD(_Wcoord) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord" " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord", " _Hcoord = getText (_x >> "h"); TEXTADD(_Hcoord) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord" " _lineCtrl = _lineCtrl +"],"; // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"], " _textColor = getArray (_x >> "colorText"); CHECKVAL(_textColor) TEXTADD(_textColor) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1] " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1], " _backgroundColor = getArray (_x >> "colorBackground"); CHECKVAL(_backgroundColor) TEXTADD(_backgroundColor) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1] " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1], " _activeColor = getArray (_x >> "colorActive"); CHECKVAL(_activeColor) TEXTADD(_activeColor) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1] " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1], " _tooltip = getText (_x >> "tooltip"); TEXTADD(_tooltip) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"" " COMMA // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"", " //_textSize = str getNumber (_x >> "sizeEx"); _textSize = -1; TEXTADD(_textSize) // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"", " _lineCtrl = _lineCtrl +"],[]]"; // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]] " if (_forEachIndex +1 != count _allCtrls OR _curCfg != (_cfgPath >> "Controls")) then {COMMA}; // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]], " // " [1000,"ownClassName",[1,"ctrlText",["Xcoords","Ycoords","Wcoord","Hcoord"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]] " //Last line _lineCtrl call _fncNewLine; } forEach _allCtrls; } forEach [_cfgPath >> "ControlsBackground", _cfgPath >> "Controls"]; _int = 0; _prelastLine = "]"; _prelastLine call _fncNewLine; //_lastLine = "*/"; //_lastLine call _fncNewLine; _finalText = str composeText _retArray; copyToClipboard _finalText; _finalText Before: Spoiler class TER_credits { idd = 170406; // 06.04.2017 movingenable = false; OnLoad = "0 = [] execVM 'script\credits\onLoadCredits.sqf';"; //onUnload = "0 = execVM 'script\memPoints\onUnLoadMemP.sqf';" class ControlsBackground { class IGUIBack_2200: IGUIBack { idc = 2200; x = 0.2375 * safezoneW + safezoneX; y = 0.15 * safezoneH + safezoneY; w = 0.525 * safezoneW; h = 0.322 * safezoneH; }; class RscFrame_1800: RscFrame { idc = 1800; text = "Credits"; //--- ToDo: Localize; x = 0.2375 * safezoneW + safezoneX; y = 0.15 * safezoneH + safezoneY; w = 0.525 * safezoneW; h = 0.322 * safezoneH; }; class RscFrame_1801: RscFrame { idc = 1801; x = 0.244063 * safezoneW + safezoneX; y = 0.178 * safezoneH + safezoneY; w = 0.511875 * safezoneW; h = 0.112 * safezoneH; }; class RscFrame_1802: RscFrame { idc = 1802; x = 0.244062 * safezoneW + safezoneX; y = 0.29 * safezoneH + safezoneY; w = 0.511875 * safezoneW; h = 0.112 * safezoneH; }; class RscFrame_1803: RscFrame { idc = 1803; x = 0.244062 * safezoneW + safezoneX; y = 0.402 * safezoneH + safezoneY; w = 0.511875 * safezoneW; h = 0.056 * safezoneH; }; class RscText_1002: RscText { idc = 1002; text = "Author: Terra"; //--- ToDo: Localize; x = 0.250625 * safezoneW + safezoneX; y = 0.192 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1004: RscText { idc = 1004; text = "ArmA3 Unit:"; //--- ToDo: Localize; x = 0.26375 * safezoneW + safezoneX; y = 0.248 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1005: RscText { idc = 1005; text = "BIS Forum:"; //--- ToDo: Localize; x = 0.26375 * safezoneW + safezoneX; y = 0.22 * safezoneH + safezoneY; w = 0.091875 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1003: RscText { idc = 1003; text = "DREAD_fnc_copyConfigClass"; //--- ToDo: Localize; x = 0.250625 * safezoneW + safezoneX; y = 0.304 * safezoneH + safezoneY; w = 0.164062 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1006: RscText { idc = 1006; text = "Author: dreadedentity"; //--- ToDo: Localize; x = 0.26375 * safezoneW + safezoneX; y = 0.332 * safezoneH + safezoneY; w = 0.164062 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1007: RscText { idc = 1007; text = "Topic:"; //--- ToDo: Localize; x = 0.26375 * safezoneW + safezoneX; y = 0.36 * safezoneH + safezoneY; w = 0.164062 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1010: RscText { idc = 1010; text = "Date: 06.04.2017"; //--- ToDo: Localize; x = 0.650937 * safezoneW + safezoneX; y = 0.416 * safezoneH + safezoneY; w = 0.0984375 * safezoneW; h = 0.028 * safezoneH; }; class RscText_1011: RscText { idc = 1011; text = "Version 1.0"; //--- ToDo: Localize; x = 0.47375 * safezoneW + safezoneX; y = 0.416 * safezoneH + safezoneY; w = 0.065625 * safezoneW; h = 0.028 * safezoneH; }; }; class Controls { class linkBISProfileTxt: RscStructuredText { idc = 40001; tooltip = "https://forums.bistudio.com/profile/1139559-7erra/"; //--- ToDo: Localize; x = 0.349063 * safezoneW + safezoneX; y = 0.22 * safezoneH + safezoneY; w = 0.269062 * safezoneW; h = 0.028 * safezoneH; colorText[] = {0,0,1,1}; }; class linkL16Txt: RscStructuredText { idc = 40002; tooltip = "http://www.vlehrbrig16.de/"; //--- ToDo: Localize; x = 0.349063 * safezoneW + safezoneX; y = 0.248 * safezoneH + safezoneY; w = 0.150937 * safezoneW; h = 0.028 * safezoneH; colorText[] = {0,0,1,1}; }; class linkDreadTxt: RscStructuredText { idc = 40003; tooltip = "https://forums.bistudio.com/profile/797731-dreadedentity/"; //--- ToDo: Localize; x = 0.42125 * safezoneW + safezoneX; y = 0.332 * safezoneH + safezoneY; w = 0.28875 * safezoneW; h = 0.028 * safezoneH; colorText[] = {0,0,1,1}; }; class linkTopicTxt: RscStructuredText { idc = 40004; text = "Link to topic"; //--- ToDo: Localize; x = 0.42125 * safezoneW + safezoneX; y = 0.36 * safezoneH + safezoneY; w = 0.07375 * safezoneW; h = 0.028 * safezoneH; colorText[] = {0,0,1,1}; tooltip = "https://forums.bistudio.com/forums/topic/187668-code-snippet-extracting-full-classes-from-config/"; //--- ToDo: Localize; }; class closeBtn: RscButton { idc = 41001; text = "Close"; //--- ToDo: Localize; x = 0.250625 * safezoneW + safezoneX; y = 0.416 * safezoneH + safezoneY; w = 0.065625 * safezoneW; h = 0.028 * safezoneH; action = "closeDialog 0"; }; }; }; After: Spoiler $[ 1.063, ["TER_credits",[[0,0,1,1],0.025,0.04,"GUI_GRID"],0,0,0], [2200,"IGUIBack_2200",[1,"",["0.2375 * safezoneW + safezoneX","0.15 * safezoneH + safezoneY","0.525 * safezoneW","0.322 * safezoneH"],[0,1,0,1],[0,0,0,0.8],[-1,-1,-1,-1],"",-1],[]], [1800,"RscFrame_1800",[1,"Credits",["0.2375 * safezoneW + safezoneX","0.15 * safezoneH + safezoneY","0.525 * safezoneW","0.322 * safezoneH"],[0,1,0,1],[1,1,1,1],[-1,-1,-1,-1],"",-1],[]], [1801,"RscFrame_1801",[1,"",["0.244063 * safezoneW + safezoneX","0.178 * safezoneH + safezoneY","0.511875 * safezoneW","0.112 * safezoneH"],[0,1,0,1],[1,1,1,1],[-1,-1,-1,-1],"",-1],[]], [1802,"RscFrame_1802",[1,"",["0.244062 * safezoneW + safezoneX","0.29 * safezoneH + safezoneY","0.511875 * safezoneW","0.112 * safezoneH"],[0,1,0,1],[1,1,1,1],[-1,-1,-1,-1],"",-1],[]], [1803,"RscFrame_1803",[1,"",["0.244062 * safezoneW + safezoneX","0.402 * safezoneH + safezoneY","0.511875 * safezoneW","0.056 * safezoneH"],[0,1,0,1],[1,1,1,1],[-1,-1,-1,-1],"",-1],[]], [1000,"RscText_1002",[1,"Author: Terra",["0.250625 * safezoneW + safezoneX","0.192 * safezoneH + safezoneY","0.091875 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1001,"RscText_1004",[1,"ArmA3 Unit:",["0.26375 * safezoneW + safezoneX","0.248 * safezoneH + safezoneY","0.091875 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1002,"RscText_1005",[1,"BIS Forum:",["0.26375 * safezoneW + safezoneX","0.22 * safezoneH + safezoneY","0.091875 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1003,"RscText_1003",[1,"DREAD_fnc_copyConfigClass",["0.250625 * safezoneW + safezoneX","0.304 * safezoneH + safezoneY","0.164062 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1004,"RscText_1006",[1,"Author: dreadedentity",["0.26375 * safezoneW + safezoneX","0.332 * safezoneH + safezoneY","0.164062 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1005,"RscText_1007",[1,"Topic:",["0.26375 * safezoneW + safezoneX","0.36 * safezoneH + safezoneY","0.164062 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1006,"RscText_1010",[1,"Date: 06.04.2017",["0.650937 * safezoneW + safezoneX","0.416 * safezoneH + safezoneY","0.0984375 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1007,"RscText_1011",[1,"Version 1.0",["0.47375 * safezoneW + safezoneX","0.416 * safezoneH + safezoneY","0.065625 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0],[-1,-1,-1,-1],"",-1],[]], [1100,"linkBISProfileTxt",[1,"",["0.349063 * safezoneW + safezoneX","0.22 * safezoneH + safezoneY","0.269062 * safezoneW","0.028 * safezoneH"],[0,0,1,1],[-1,-1,-1,-1],[-1,-1,-1,-1],"https://forums.bistudio.com/profile/1139559-7erra/",-1],[]], [1101,"linkL16Txt",[1,"",["0.349063 * safezoneW + safezoneX","0.248 * safezoneH + safezoneY","0.150937 * safezoneW","0.028 * safezoneH"],[0,0,1,1],[-1,-1,-1,-1],[-1,-1,-1,-1],"http://www.vlehrbrig16.de/",-1],[]], [1102,"linkDreadTxt",[1,"",["0.42125 * safezoneW + safezoneX","0.332 * safezoneH + safezoneY","0.28875 * safezoneW","0.028 * safezoneH"],[0,0,1,1],[-1,-1,-1,-1],[-1,-1,-1,-1],"https://forums.bistudio.com/profile/797731-dreadedentity/",-1],[]], [1103,"linkTopicTxt",[1,"Link to topic",["0.42125 * safezoneW + safezoneX","0.36 * safezoneH + safezoneY","0.07375 * safezoneW","0.028 * safezoneH"],[0,0,1,1],[-1,-1,-1,-1],[-1,-1,-1,-1],"https://forums.bistudio.com/forums/topic/187668-code-snippet-extracting-full-classes-from-config/",-1],[]], [1600,"closeBtn",[1,"Close",["0.250625 * safezoneW + safezoneX","0.416 * safezoneH + safezoneY","0.065625 * safezoneW","0.028 * safezoneH"],[0,1,0,1],[0,0,0,0.5],[-1,-1,-1,-1],"",-1],[]] ] Currently known issues: Spoiler Not every control type is supported. There are some really exotic ones that aren't recognised by the GUI editor the common ones are though. These are returned as "IGUIBack" Supported control types: IGUIBack RscButton RscButtonMenu RscButtonMenuCancel RscButtonMenuOk RscCheckbox RscCombo RscControlsGroup RscEdit RscFrame RscListbox RscPicture RscPictureKeepAscpectRatio RscShortcutButton RscShortcutButtonMain RscSlider RscStructuredText RscText RstTextCheckbox When defining you own base classes and not naming them like above they won't be recognised and show up as "IGUIBack" Thanks to @HallyG, @HazJ, @dreadedentity! And one second later I discover that ArmA3 already has a system. With the given config path you can press Ctrl+I and insert your path. 1 Share this post Link to post Share on other sites