complacent_lizard 0 Posted May 8, 2017 Hello! Last time I had an issue the BI community came to my aid, and I know how useful these forums are for everyone else, so here goes... I'm displaying a money variable for the player by using an RscTitle in the top left of the screen - that's all good. The problem is I'm not sure how to go about displaying a variable in that RscTitle that updates so that the amount of "money" the player has is displayed at all times. Here's my description.ext: class RscTitles { class CashDisplayTitle { idd = -1; duration = 1e+1000; class controls { class CashDisplayControl { idc = -1; type = 0; style = 0; x = safeZoneXAbs; y = safeZoneY - 0.45; w = 1; h = 1; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {0,0.6,0,1}; text = "$"; }; }; }; }; So I've got 2 minor obstacles - how can I display the cashVariable in my CashDisplayControl, and how can I set up a script which updates that value? If you've got any pointers / links, I'd very much appreciate it! (I have read around, but the examples I've found are very case specific and get a little convoluted) Thanks for reading and for being an outstanding community! Share this post Link to post Share on other sites
Arkensor 96 Posted May 8, 2017 Hey, you need to make a function / loop in this case that updates the value inside the cutrsc via ((findDisplay) displayCtrl 101) ctrlSetText "Mmmmmoney"; you need to add that idc 101 or what ever to your "CashDisplayControl" element. https://community.bistudio.com/wiki/ctrlSetText https://community.bistudio.com/wiki/findDisplay https://community.bistudio.com/wiki/displayCtrl That should do exactly what you want :) Regards Arkensor 1 Share this post Link to post Share on other sites
complacent_lizard 0 Posted May 8, 2017 Thanks for the advice Arkensor, much appreciated! I've been looking at crtlSetText, and had a feeling that was what I needed to learn. Just to clarify, if I use ((findDisplay) displayCtrl 101) ctrlSetText "Mmmmmoney"; in a separate script that loop/updates, do I need to change the idc to 101 for a particular reason? Or can I leave the rscTitle idc = -1 and use that in my update script? Also, what is the most efficient method for running a script that loops in SP, considering that this variable needs to be basically up to date all the time? I also noticed that "[...]control inside controls group having -1 IDC currently cannot be returned in any way." So it makes me wonder if using the generic "-1" for my idc was a stupid choice :/ Share this post Link to post Share on other sites
Arkensor 96 Posted May 8, 2017 Hey, with an idc of -1 you can not identify the dialog class anymore, thats why you need to asign a unique value to it. Something like 12321 and then use this idc only for that dialog. You could use it in mutliple ones because of the namespaces, but that way its easier for you to track down which script interacts with which dialog. You could add an onEachFrame evenent handler, which would be as real time as it gets, but i think updating it every 1 second or .5 second is enough. So something like: [] spawn { while{true} do { //do the control work here sleep 1; //sleep 0.5; }; }; should do the job Regards Arkensor Share this post Link to post Share on other sites
complacent_lizard 0 Posted May 9, 2017 Thanks again Arkensor! I've changed the idd for the CashDisplayTitle AND the idc for the CashDisplayControl to 101. init.sqf: cashVariable = 0; cutRsc ["CashDisplayTitle","PLAIN"]; description.ext: class RscTitles { class CashDisplayTitle { idd = 101; duration = 1e+1000; onLoad = _this execVM "cashIcon.sqf"; class controls { class CashDisplayControl { idc = 101; type = 0; style = 0; x = safeZoneXAbs + 1.25; y = safeZoneY - 0.2; w = 1; h = 1; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {0,0.6,0,1}; text = "$"; }; }; }; }; cashIcon.sqf: [] spawn { while{true} do { ((findDisplay 101) displayCtrl 101) ctrlSetText "Mmmmmoney"; sleep 0.5; }; }; The "$" correctly displays because of the init.sqf, but nothing else (not even the "Mmmmmoney" part). I'm sure there's something really simple I've got wrong here, but I can't seem to figure it out :/ Is "cashIcon.sqf" a smart way of executing this? Share this post Link to post Share on other sites
pierremgi 4739 Posted May 9, 2017 Let IDD to _1 , you don't need to specify it. Choose any number for your display control, example idc = 564382; // must not be already used change your onload for: onLoad = "uiNamespace setVariable ['aVariableNameHere', _this select 0]"; Now you can pass any value for this variable in scripts for changing text, color, position of the control, with lines of code like: _myRSClayer cutRSC ["cashDisplayTitle",0,false]; // always before manipulation controls even in another script, then below: [] spawn { while{true} do { uiNamespace getVariable "aVariableNameHere" displayCtrl 564382 ctrlSetText "Mmmmmoney"+str(round time); sleep 0.5 } }; NOTA1: you can have several controls (box, text, images) in same RSC. Generally place all you want to be displayed (or not) at the same time. NOTA2: It's always preferable to use the layer alternate syntax. You can easily cutRSC on/off with this variable and, last but not least, you display on differents layers without interfering with existing ones! And there are sometime many displays (layers) in some addons like ACE, EXILE ans so on. NOTA3: here I wrote in one line: uiNamespace getVariable "aVariableNameHere" displayCtrl 564382 ctrlSetText... Sometime, it's preferable to: disableSerialization; // mandatory for storing the display elements in a variable; _display = uiNamespace getVariable "aVariableNameHere"; _display displayCtrl 564382 ctrlSetText... Share this post Link to post Share on other sites
complacent_lizard 0 Posted May 9, 2017 (edited) Absolute legend pierremgi! I've almost got it working. I've switched _myRSClayer cutRSC ["cashDisplayTitle",0,false]; for cutRSC ["CashDisplayTitle","PLAIN"]; The issue I've found is that uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(round time); counts each second as it passes, instead of registering my cashVariable. Could this be because my cashIcon.sqf is called from my init.sqf? Thanks again! Edited May 9, 2017 by complacent_lizard Share this post Link to post Share on other sites
complacent_lizard 0 Posted May 9, 2017 Nevermind! I'm a fool! I've replaced uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(round time); with uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(cashVariable); and it's all working! A huge thank you to Arkensor and pierremgi!! Couldn't have got it working without you and your advice! If anyone has any pointers for optimising / how much of an idiot I am, feel free to share :P Share this post Link to post Share on other sites
nelo_riot 8 Posted October 12, 2017 @complacent_lizard @pierremgi I'm trying to understand the basics on DisplayCtrl / DisplaySetText for the very same purpose. I have been trying to reproduce what you have created, (having the same issue finding a straight forward tutorial on this). I have encountered the issue where you only had the Green '$' displayed. Could you post up the code you ended up using or point out the error here? Created Rsctitle in Description.ext: Spoiler class RscTitles { class CashDisplayTitle { idd = -1; duration = 1e+1000; onLoad = "uiNamespace setVariable ['cashVariable', _this select 0]"; class controls { class CashDisplayControl { idc = 101; type = 0; style = 0; x = safeZoneXAbs + 1.25; y = safeZoneY - 0.2; w = 1; h = 1; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {0,0.6,0,1}; text = "$"; }; }; }; }; Launched the Other advised code from Init.sqf Spoiler cashVariable = 100; cutRSC ["CashDisplayTitle","PLAIN"]; [] spawn { while{true} do { uiNamespace getVariable "cashVariable" displayCtrl 564382 ctrlSetText "$"+str(cashVariable); sleep 0.5 } }; Share this post Link to post Share on other sites
pierremgi 4739 Posted October 12, 2017 You need to choose an idc (ident for control) . You have declared 101 in your cashDisplaytitle class, and 564382 in your loop! so, the text doesn't meet the control and the control displays what you have set by default for text: "§". 1 Share this post Link to post Share on other sites
nelo_riot 8 Posted October 12, 2017 Pierremgi, Thank you so much - I can't believe I overlooked the IDD. It now works, which means I can understand build this in the function I require. Curiously I couldn't get _myrsclayer to work, I guess this I would need to recreate the RSCMenu into a new layer. I'll write up a quite guide on your advice to help others. Share this post Link to post Share on other sites
pierremgi 4739 Posted October 12, 2017 You can let the IDD to -1 (it's your whole display) and you cutrsc it by its class name. On the other hand, you can have plenty of controls inside it. several texts in different corners, several pictures, frames, etc) You can choose any IDCs you want for your controls as far as your are inside a whole display, but not the same twice! 1 Share this post Link to post Share on other sites
pierremgi 4739 Posted October 12, 2017 In this video some examples of displays (with cutRsc) 1 Share this post Link to post Share on other sites
nelo_riot 8 Posted October 13, 2017 Thanks Pierremgi - I will have a look at this and work on it and post results tomorrow. Fell across this on Cutrsc WIki - is that where the naming for _myrsclayer is being pulled from using the BIS_fnc_rsc_Layer? ("myLayerName" call BIS_fnc_rscLayer) cutRsc ["myRsc","PLAIN"]; //show ("myLayerName" call BIS_fnc_rscLayer) cutText ["","PLAIN"]; //remove As a side question - could I use the same information above to return 'Primaryweapon player;' ? I'm thinking of a way to return the primary weapon display name in a shop. I actually came across your armaholic page earlier, some interesting info on there! Share this post Link to post Share on other sites
nelo_riot 8 Posted October 13, 2017 Accidental Double Post Share this post Link to post Share on other sites
pierremgi 4739 Posted October 13, 2017 I didn't use BIS_fnc_rscLayer. Just some figures like 10001, 10002... why? just to be sure some layers will be above some other ones (like custom GPS and grid coordinates overlaying). I took the bet there will not some other existing displays with the same layer number (conflicting). And yes, you can display the current primary waypoint or any existing stuff in your inventory : _unit_1Wpn_icon = getText (configfile >> "cfgWeapons" >> primaryWeapon player >> "picture"); you just have to ctrlSetText this result but your control must be a rscPicture one! (not a rscText or structured text) my control class is inherited in fact : #include "\MGI_TP_V3\defines.hpp" // see note below class RscTitles { class JDoe_file // the global display { idd = -1; duration = 100000; fadein = 0; fadeout = 0; name="JDoe_file_display"; onLoad = "uiNamespace setVariable ['JDoe_Data', _this select 0]"; // the way to call it controls[]= { JDoe_1wpn, ....... }; // all controls are declared here (and probably order is a way to be displayed with priority, I don't remember ascending or descending) class JDoe_1wpn: RscPicture // one of the controls (displaying the primary weapon picture - Note the inheritance to RscPicture standard control class { idc = 2400; // the IDC recalled for displaying or changing variable x = 0.02 * safezoneW + safezoneX; y = 0.46 * safezoneH + safezoneY; // you can even recall that for dynamic display! (along with on each framed function) w = 0.07 * safezoneW; h = 0.035*4/3 * safezoneH; }; ..... other controls }; }; Important note: the class rscPicture must be defined somewhere. If not, the inheritance fails. Usually in a define. hpp (name doesn't matter) but you have to include it in the config.cpp or description.ext. Read this and this. Share this post Link to post Share on other sites
nelo_riot 8 Posted October 14, 2017 I added a function layer 2 to the currency layer and now whenever I open/close GUI's it will always stay ontop, thats why I asked! Currency Icon completely functional now! A couple of questions regarding the additional information you provided. _unit_1Wpn_icon = getText (configfile >> "cfgWeapons" >> primaryWeapon player >> "picture"); // I guess '_unit_1Wpn_icon' is just a random name you have given to this? If we were to make it functional with below then it would need to match the variable and control which would be 'JDoe_1wpn'? my control class is inherited in fact : // I think now understand the functionalities of inheritance, the inheritance must already be defined in the defines.hpp, do you simply change the inheritance with the ' JDoe_1wpn: RscPicture' ? So if i wanted to change it to text for example it would be 'JDoe_1wpn: RscText ' ? Additionally in the dialog how would you call the inheritance? As an example dialogs.hpp below would you just match IDC to the Control? class Shop_dialog { IDD = -1; movingenable=false; class Controls { class InfoBox: RscText { idc = 1800; // So I'd just match this IDC to the control in our defines.hpp to call it - this would then populate said box within the dialog wit the previously stated control? x = 0.329375 * safezoneW + safezoneX; y = 0.318 * safezoneH + safezoneY; w = 0.315 * safezoneW; h = 0.476 * safezoneH; }; //////////////////////////////////// class JDoe_file // the global display { idd = -1; duration = 100000; fadein = 0; fadeout = 0; name="JDoe_file_display"; onLoad = "uiNamespace setVariable ['JDoe_Data', _this select 0]"; // This variable is the same variable used for getvariable? in this instance is _this select 0 referring to the player? controls[]= { JDoe_1wpn, ....... }; // all controls are declared here (and probably order is a way to be displayed with priority, I don't remember ascending or descending) class JDoe_1wpn: RscPicture // one of the controls (displaying the primary weapon picture - Note the inheritance to RscPicture standard control class { idc = 2400; x = 0.02 * safezoneW + safezoneX; y = 0.46 * safezoneH + safezoneY; w = 0.07 * safezoneW; h = 0.035*4/3 * safezoneH; }; }; Ultimately how would I call this above dialog using uiNamespace? Example if it were in an addAction . sqf then would it be simply 'uiNamespace getVariable "JDoe_Data" displaycontrol 2400 ctrlSetText ""+str(JDoe_Data);' Thanks for the wiki links before I had read them but it wasn't until you provided this info I started to really understand it and once again thanks for your help Pierre. Share this post Link to post Share on other sites
pierremgi 4739 Posted October 14, 2017 2 hours ago, nelo_riot said: _unit_1Wpn_icon = getText (configfile >> "cfgWeapons" >> primaryWeapon player >> "picture"); // I guess '_unit_1Wpn_icon' is just a random name you have given to this? Yes. A _local variable is just defined in a script, and even in a scope (loop for "_i" from/to ; for instance) . You can use what you want but be consistent for the aim: private _unit_1wpn_icon = (uiNameSpace getVariable "JDoe_Data") displayCtrl 2400; _unit_1w = getText (configfile >> "cfgWeapons" >> primaryWeapon player >> "picture"); _unit_1w ctrlSetText (_unit_1Wpn_icon); If we were to make it functional with below then it would need to match the variable and control which would be 'JDoe_1wpn'? JDoe_1wpn is a global variable here and a class, type of rscPicture. Such class is global (known inside each script on the player's pc) (btw, you can't have the same class name for 2 classes, so change for another name if you're using my addon) my control class is inherited in fact : // I think now understand the functionalities of inheritance, the inheritance must already be defined in the defines.hpp, do you simply change the inheritance with the ' JDoe_1wpn: RscPicture' ? So if i wanted to change it to text for example it would be 'JDoe_1wpn: RscText ' ?Yes. Be sure you ctrlSetText a text (here it's OK because the picture is also a string. You'll obtain the name of the picture instead of display it). Additionally in the dialog how would you call the inheritance? As an example dialogs.hpp below would you just match IDC to the Control? I seems to me you understood except for following point. class Shop_dialog { IDD = -1; movingenable=false; class Controls // NO, you must add duration.. and other parameters like in my example. onLoad is what set the variable and make it able to be called! { class InfoBox: RscText { idc = 1800; // So I'd just match this IDC to the control in our defines.hpp to call it - this would then populate said box within the dialog wit the previously stated control? // As I said before your class must be in controls[] of IDD x = 0.329375 * safezoneW + safezoneX; y = 0.318 * safezoneH + safezoneY; w = 0.315 * safezoneW; h = 0.476 * safezoneH; }; //////////////////////////////////// onLoad = "uiNamespace setVariable ['JDoe_Data', _this select 0]"; // This variable is the same variable used for getvariable? in this instance is _this select 0 referring to the player? Yes the same, of course! and no for the player, it refers to the display itself! ..... controls[]= { JDoe_1wpn, ....... }; // all controls are declared here (and probably order is a way to be displayed with priority, I don't remember ascending or descending) Don't forget that! Ultimately how would I call this above dialog using uiNamespace? Example if it were in an addAction . sqf then would it be simply 'uiNamespace getVariable "JDoe_Data" displaycontrol 2400 ctrlSetText ""+str(JDoe_Data);' Yes for the principle (see my first remark), but not sure your quote are fine inside an addAction! Anyway, with a display, it's not the value of the text/picture you have to work inside addAction, but the cutRsc (the on/off switch, not the color or the size of the lamp!) Share this post Link to post Share on other sites
nelo_riot 8 Posted October 14, 2017 Thanks again for the comprehensive answers, using all the above information (and your examples) to recreate this so I can understand the process. Using the above when I call '_handle= createdialog "JDoe_file";' I am expecting a picture to display of the present weapon. At this stage when I call the dialog, I have the mouse pointer and nothing else. Am I right in thinking calling the dialog would populate the picture? Just for clarity using the above information could you cast your eyes over the below? // (TBH the defines.hpp I'm sure is fine but I put it up as a just in case, also the Description.ext is pre-compiling both defines.hpp & testdefines.hpp with #include) When I was doing further reading on the above information, I was going through Killzone Kids tutorials and I saw a post from you 3 years ago asking about CTRLSetText - clearly you've done a lot of testing since! Defines.hpp: Spoiler /////////////////////////////////////////////////////////////////////////// /// Styles /////////////////////////////////////////////////////////////////////////// // Control types #define CT_STATIC 0 #define CT_BUTTON 1 #define CT_EDIT 2 #define CT_SLIDER 3 #define CT_COMBO 4 #define CT_LISTBOX 5 #define CT_TOOLBOX 6 #define CT_CHECKBOXES 7 #define CT_PROGRESS 8 #define CT_HTML 9 #define CT_STATIC_SKEW 10 #define CT_ACTIVETEXT 11 #define CT_TREE 12 #define CT_STRUCTURED_TEXT 13 #define CT_CONTEXT_MENU 14 #define CT_CONTROLS_GROUP 15 #define CT_SHORTCUTBUTTON 16 #define CT_XKEYDESC 40 #define CT_XBUTTON 41 #define CT_XLISTBOX 42 #define CT_XSLIDER 43 #define CT_XCOMBO 44 #define CT_ANIMATED_TEXTURE 45 #define CT_OBJECT 80 #define CT_OBJECT_ZOOM 81 #define CT_OBJECT_CONTAINER 82 #define CT_OBJECT_CONT_ANIM 83 #define CT_LINEBREAK 98 #define CT_USER 99 #define CT_MAP 100 #define CT_MAP_MAIN 101 #define CT_LISTNBOX 102 #define CT_CHECKBOX 77 // Static styles #define ST_POS 0x0F #define ST_HPOS 0x03 #define ST_VPOS 0x0C #define ST_LEFT 0x00 #define ST_RIGHT 0x01 #define ST_CENTER 0x02 #define ST_DOWN 0x04 #define ST_UP 0x08 #define ST_VCENTER 0x0C #define ST_TYPE 0xF0 #define ST_SINGLE 0x00 #define ST_MULTI 0x10 #define ST_TITLE_BAR 0x20 #define ST_PICTURE 0x30 #define ST_FRAME 0x40 #define ST_BACKGROUND 0x50 #define ST_GROUP_BOX 0x60 #define ST_GROUP_BOX2 0x70 #define ST_HUD_BACKGROUND 0x80 #define ST_TILE_PICTURE 0x90 #define ST_WITH_RECT 0xA0 #define ST_LINE 0xB0 #define ST_SHADOW 0x100 #define ST_NO_RECT 0x200 #define ST_KEEP_ASPECT_RATIO 0x800 #define ST_TITLE ST_TITLE_BAR + ST_CENTER // Slider styles #define SL_DIR 0x400 #define SL_VERT 0 #define SL_HORZ 0x400 #define SL_TEXTURES 0x10 // progress bar #define ST_VERTICAL 0x01 #define ST_HORIZONTAL 0 // Listbox styles #define LB_TEXTURES 0x10 #define LB_MULTI 0x20 // Tree styles #define TR_SHOWROOT 1 #define TR_AUTOCOLLAPSE 2 // MessageBox styles #define MB_BUTTON_OK 1 #define MB_BUTTON_CANCEL 2 #define MB_BUTTON_USER 4 /////////////////////////////////////////////////////////////////////////// /// Base Classes /////////////////////////////////////////////////////////////////////////// class RscText { deletable = 0; fade = 0; access = 0; type = 0; idc = -1; colorBackground[] = { 0, 0, 0, 0 }; colorText[] = { 1, 1, 1, 1 }; text = ""; fixedWidth = 0; x = 0; y = 0; h = 0.037; w = 0.3; style = 0; shadow = 1; colorShadow[] = { 0, 0, 0, 0.5 }; font = "RobotoCondensed"; SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; linespacing = 1; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; }; class RscStructuredText { deletable = 0; fade = 0; access = 0; type = 13; idc = -1; style = 0; colorText[] = { 1, 1, 1, 1 }; class Attributes { font = "RobotoCondensed"; color = "#ffffff"; colorLink = "#D09B43"; align = "left"; shadow = 1; }; x = 0; y = 0; h = 0.035; w = 0.1; text = ""; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; shadow = 1; }; class RscPicture { deletable = 0; fade = 0; access = 0; type = 0; idc = -1; style = 48; colorBackground[] = { 0, 0, 0, 0 }; colorText[] = { 1, 1, 1, 1 }; font = "TahomaB"; sizeEx = 0; lineSpacing = 0; text = ""; fixedWidth = 0; shadow = 0; x = 0; y = 0; w = 0.2; h = 0.15; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; }; class RscEdit { deletable = 0; fade = 0; access = 0; type = 2; x = 0; y = 0; h = 0.04; w = 0.2; colorBackground[] = { 0, 0, 0, 0 }; colorText[] = { 0.95, 0.95, 0.95, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorSelection[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", 1 }; autocomplete = ""; text = ""; size = 0.2; style = "0x00 + 0x40"; font = "RobotoCondensed"; shadow = 2; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; canModify = 1; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; }; class RscCombo { deletable = 0; fade = 0; access = 0; type = 4; colorSelect[] = { 0, 0, 0, 1 }; colorText[] = { 1, 1, 1, 1 }; colorBackground[] = { 0, 0, 0, 1 }; colorScrollbar[] = { 1, 0, 0, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorPicture[] = { 1, 1, 1, 1 }; colorPictureSelected[] = { 1, 1, 1, 1 }; colorPictureDisabled[] = { 1, 1, 1, 0.25 }; colorPictureRight[] = { 1, 1, 1, 1 }; colorPictureRightSelected[] = { 1, 1, 1, 1 }; colorPictureRightDisabled[] = { 1, 1, 1, 0.25 }; colorTextRight[] = { 1, 1, 1, 1 }; colorSelectRight[] = { 0, 0, 0, 1 }; colorSelect2Right[] = { 0, 0, 0, 1 }; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; soundSelect[] = { "\A3\ui_f\data\sound\RscCombo\soundSelect", 0.1, 1 }; soundExpand[] = { "\A3\ui_f\data\sound\RscCombo\soundExpand", 0.1, 1 }; soundCollapse[] = { "\A3\ui_f\data\sound\RscCombo\soundCollapse", 0.1, 1 }; maxHistoryDelay = 1; class ComboScrollBar { color[] = { 1, 1, 1, 1 }; }; style = "0x10 + 0x200"; font = "RobotoCondensed"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; shadow = 0; x = 0; y = 0; w = 0.12; h = 0.035; colorSelectBackground[] = { 1, 1, 1, 0.7 }; arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa"; arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa"; wholeHeight = 0.45; colorActive[] = { 1, 0, 0, 1 }; }; class RscListBox { deletable = 0; fade = 0; access = 0; type = 5; rowHeight = 0; colorText[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorScrollbar[] = { 1, 0, 0, 0 }; colorSelect[] = { 0, 0, 0, 1 }; colorSelect2[] = { 0, 0, 0, 1 }; colorSelectBackground[] = { 0.95, 0.95, 0.95, 1 }; colorSelectBackground2[] = { 1, 1, 1, 0.5 }; colorBackground[] = { 0, 0, 0, 0.3 }; soundSelect[] = { "\A3\ui_f\data\sound\RscListbox\soundSelect", 0.09, 1 }; autoScrollSpeed = -1; autoScrollDelay = 5; autoScrollRewind = 0; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; colorPicture[] = { 1, 1, 1, 1 }; colorPictureSelected[] = { 1, 1, 1, 1 }; colorPictureDisabled[] = { 1, 1, 1, 0.25 }; colorPictureRight[] = { 1, 1, 1, 1 }; colorPictureRightSelected[] = { 1, 1, 1, 1 }; colorPictureRightDisabled[] = { 1, 1, 1, 0.25 }; colorTextRight[] = { 1, 1, 1, 1 }; colorSelectRight[] = { 0, 0, 0, 1 }; colorSelect2Right[] = { 0, 0, 0, 1 }; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; class ListScrollBar { color[] = { 1, 1, 1, 1 }; autoScrollEnabled = 1; }; x = 0; y = 0; w = 0.3; h = 0.3; style = 16; font = "RobotoCondensed"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; shadow = 0; colorShadow[] = { 0, 0, 0, 0.5 }; period = 1.2; maxHistoryDelay = 1; }; class RscButton { deletable = 0; fade = 0; access = 0; type = 1; text = ""; colorText[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorBackground[] = { 0, 0, 0, 0.5 }; colorBackgroundDisabled[] = { 0, 0, 0, 0.5 }; colorBackgroundActive[] = { 0, 0, 0, 1 }; colorFocused[] = { 0, 0, 0, 1 }; colorShadow[] = { 0, 0, 0, 0 }; colorBorder[] = { 0, 0, 0, 1 }; soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; idc = -1; style = 2; x = 0; y = 0; w = 0.095589; h = 0.039216; shadow = 2; font = "RobotoCondensed"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; url = ""; offsetX = 0; offsetY = 0; offsetPressedX = 0; offsetPressedY = 0; borderSize = 0; }; class RscShortcutButton { deletable = 0; fade = 0; type = 16; x = 0.1; y = 0.1; class HitZone { left = 0; top = 0; right = 0; bottom = 0; }; class ShortcutPos { left = 0; top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; }; class TextPos { left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)"; top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; right = 0.005; bottom = 0; }; shortcuts[] = { }; textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)"; color[] = { 1, 1, 1, 1 }; colorFocused[] = { 1, 1, 1, 1 }; color2[] = { 0.95, 0.95, 0.95, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorBackground[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", 1 }; colorBackgroundFocused[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", 1 }; colorBackground2[] = { 1, 1, 1, 1 }; soundEnter[] = { "\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1 }; soundPush[] = { "\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1 }; soundClick[] = { "\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1 }; soundEscape[] = { "\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1 }; class Attributes { font = "RobotoCondensed"; color = "#E5E5E5"; align = "left"; shadow = "true"; }; idc = -1; style = 0; default = 0; shadow = 1; w = 0.183825; h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)"; textSecondary = ""; colorSecondary[] = { 1, 1, 1, 1 }; colorFocusedSecondary[] = { 1, 1, 1, 1 }; color2Secondary[] = { 0.95, 0.95, 0.95, 1 }; colorDisabledSecondary[] = { 1, 1, 1, 0.25 }; sizeExSecondary = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; fontSecondary = "RobotoCondensed"; animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa"; animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa"; animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa"; animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa"; periodFocus = 1.2; periodOver = 0.8; period = 0.4; font = "RobotoCondensed"; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; text = ""; url = ""; action = ""; class AttributesImage { font = "RobotoCondensed"; color = "#E5E5E5"; align = "left"; }; }; class RscShortcutButtonMain { idc = -1; style = 0; default = 0; w = 0.313726; h = 0.104575; color[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; class HitZone { left = 0; top = 0; right = 0; bottom = 0; }; class ShortcutPos { left = 0.0145; top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2"; w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2) * (3/4)"; h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; }; class TextPos { left = "(((safezoneW / safezoneH) min 1.2) / 32) * 1.5"; top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)*2 - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2"; right = 0.005; bottom = 0; }; animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa"; animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa"; animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa"; animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa"; animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa"; period = 0.5; font = "RobotoCondensed"; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)"; text = ""; action = ""; class Attributes { font = "RobotoCondensed"; color = "#E5E5E5"; align = "left"; shadow = "false"; }; class AttributesImage { font = "RobotoCondensed"; color = "#E5E5E5"; align = "false"; }; }; class RscFrame { type = 0; idc = -1; deletable = 0; style = 64; shadow = 2; colorBackground[] = { 0, 0, 0, 0 }; colorText[] = { 1, 1, 1, 1 }; font = "RobotoCondensed"; sizeEx = 0.02; text = ""; x = 0; y = 0; w = 0.3; h = 0.3; }; class RscSlider { deletable = 0; fade = 0; access = 0; type = 3; style = 1024; color[] = { 1, 1, 1, 0.8 }; colorActive[] = { 1, 1, 1, 1 }; shadow = 0; x = 0; y = 0; w = 0.3; h = 0.025; }; class IGUIBack { type = 0; idc = 124; style = 128; text = ""; colorText[] = { 1, 1, 1, 1, }; font = "RobotoCondensed"; sizeEx = 0; shadow = 0; x = 0.1; y = 0.1; w = 0.1; h = 0.1; colorbackground[] = { "(profilenamespace getvariable ['IGUI_BCG_RGB_R',0])", "(profilenamespace getvariable ['IGUI_BCG_RGB_G',1])", "(profilenamespace getvariable ['IGUI_BCG_RGB_B',1])", "(profilenamespace getvariable ['IGUI_BCG_RGB_A',0.8])" }; }; class RscCheckBox { idc = -1; type = 77; deletable = 0; style = 0; checked = 0; x = "0.375 * safezoneW + safezoneX"; y = "0.36 * safezoneH + safezoneY"; w = "0.025 * safezoneW"; h = "0.04 * safezoneH"; color[] = { 1, 1, 1, 0.7 }; colorFocused[] = { 1, 1, 1, 1 }; colorHover[] = { 1, 1, 1, 1 }; colorPressed[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.2 }; colorBackground[] = { 0, 0, 0, 0 }; colorBackgroundFocused[] = { 0, 0, 0, 0 }; colorBackgroundHover[] = { 0, 0, 0, 0 }; colorBackgroundPressed[] = { 0, 0, 0, 0 }; colorBackgroundDisabled[] = { 0, 0, 0, 0 }; textureChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; textureUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; textureFocusedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; textureFocusedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; textureHoverChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; textureHoverUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; texturePressedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; texturePressedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; textureDisabledChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa"; textureDisabledUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa"; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; soundEnter[] = { "", 0.1, 1 }; soundPush[] = { "", 0.1, 1 }; soundClick[] = { "", 0.1, 1 }; soundEscape[] = { "", 0.1, 1 }; }; class RscTextCheckBox { idc = -1; type = 7; style = 0; x = "0.375 * safezoneW + safezoneX"; y = "0.36 * safezoneH + safezoneY"; w = "0.025 * safezoneW"; h = "0.04 * safezoneH"; colorText[] = { 1, 0, 0, 1 }; color[] = { 0, 0, 0, 0 }; colorBackground[] = { 0, 0, 0, 0 }; colorTextSelect[] = { 0, 0.8, 0, 1 }; colorSelectedBg[] = { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", 1 }; colorSelect[] = { 0, 0, 0, 1 }; colorTextDisable[] = { 0.4, 0.4, 0.4, 1 }; colorDisable[] = { 0.4, 0.4, 0.4, 1 }; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; font = "RobotoCondensed"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)"; rows = 1; columns = 1; strings[] = { "UNCHECKED" }; checked_strings[] = { "CHECKED" }; }; class RscButtonMenu { idc = -1; type = 16; style = "0x02 + 0xC0"; default = 0; shadow = 0; x = 0; y = 0; w = 0.095589; h = 0.039216; animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)"; animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)"; animTextureOver = "#(argb,8,8,3)color(1,1,1,1)"; animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)"; animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)"; animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)"; colorBackground[] = { 0, 0, 0, 0.8 }; colorBackgroundFocused[] = { 1, 1, 1, 1 }; colorBackground2[] = { 0.75, 0.75, 0.75, 1 }; color[] = { 1, 1, 1, 1 }; colorFocused[] = { 0, 0, 0, 1 }; color2[] = { 0, 0, 0, 1 }; colorText[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; textSecondary = ""; colorSecondary[] = { 1, 1, 1, 1 }; colorFocusedSecondary[] = { 0, 0, 0, 1 }; color2Secondary[] = { 0, 0, 0, 1 }; colorDisabledSecondary[] = { 1, 1, 1, 0.25 }; sizeExSecondary = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; fontSecondary = "PuristaLight"; period = 1.2; periodFocus = 1.2; periodOver = 1.2; size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)"; tooltipColorText[] = { 1, 1, 1, 1 }; tooltipColorBox[] = { 1, 1, 1, 1 }; tooltipColorShade[] = { 0, 0, 0, 0.65 }; class TextPos { left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2"; right = 0.005; bottom = 0; }; class Attributes { font = "PuristaLight"; color = "#E5E5E5"; align = "left"; shadow = "false"; }; class ShortcutPos { left = "5.25 * (((safezoneW / safezoneH) min 1.2) / 40)"; top = 0; w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)"; h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"; }; soundEnter[] = { "\A3\ui_f\data\sound\RscButtonMenu\soundEnter", 0.09, 1 }; soundPush[] = { "\A3\ui_f\data\sound\RscButtonMenu\soundPush", 0.09, 1 }; soundClick[] = { "\A3\ui_f\data\sound\RscButtonMenu\soundClick", 0.09, 1 }; soundEscape[] = { "\A3\ui_f\data\sound\RscButtonMenu\soundEscape", 0.09, 1 }; }; class RscButtonMenuOK { idc = 1; shortcuts[] = { "0x00050000 + 0", 28, 57, 156 }; default = 1; text = "OK"; soundPush[] = { "\A3\ui_f\data\sound\RscButtonMenuOK\soundPush", 0.09, 1 }; }; class RscButtonMenuCancel { idc = 2; shortcuts[] = { "0x00050000 + 1" }; text = "Cancel"; }; class RscControlsGroup { deletable = 0; fade = 0; class VScrollbar { color[] = { 1, 1, 1, 1 }; width = 0.021; autoScrollEnabled = 1; }; class HScrollbar { color[] = { 1, 1, 1, 1 }; height = 0.028; }; class Controls { }; type = 15; idc = -1; x = 0; y = 0; w = 1; h = 1; shadow = 0; style = 16; }; Testdefines.hpp: Spoiler class JDoe_file // the global display { idd = -1; duration = 100000; fadein = 0; fadeout = 0; name= "JDoe_file_display"; onLoad = "uiNamespace setVariable ['JDoe_Data', _this select 0]"; // the way to call it controls[]= {JDoe_1wpn}; // all controls are declared here (and probably order is a way to be displayed with priority, I don't remember ascending or descending) class JDoe_1wpn: RscPicture // one of the controls (displaying the primary weapon picture - Note the inheritance to RscPicture standard control class { idc = 2400; // the IDC recalled for displaying or changing variable x = 0.02 * safezoneW + safezoneX; y = 0.46 * safezoneH + safezoneY; // you can even recall that for dynamic display! (along with on each framed function) w = 0.07 * safezoneW; h = 0.035*4/3 * safezoneH; }; }; Init.Sqf: Spoiler private _unit_1wpn_icon = (uiNameSpace getVariable "JDoe_Data") displayCtrl 2400; _unit_1w = getText (configfile >> "cfgWeapons" >> primaryWeapon player >> "picture"); _unit_1w ctrlSetText (_unit_1Wpn_icon); Share this post Link to post Share on other sites
pierremgi 4739 Posted October 14, 2017 defines.hpp OK but you need to include it (call it somewhere, generally in description.ext. If not it's totally useless!) #include "defines.hpp" testdefines.hpp why not (but you can also put this stuff in description.ext) And, if not, then like you did.. must be included in it (in rscTitles), after the previous one of course! Remember your classes for display(s) are sub-classes of rscTitles !!!! _handle= createdialog "JDoe_file";'??? what for? You're mixing two dialogs, this one and the class one (in rscTitles). now, you need to call your display: see cutRsc 5555666 cutRsc ["JDoe_file","PLAIN",0.2,false]; //show 5555666 cutRsc ["default","PLAIN"]; //hide PLEASE DON'T USE THE SAME NAME AS MINE (for ensuring compatibility) Share this post Link to post Share on other sites
nelo_riot 8 Posted October 23, 2017 Pierre, I have finally come back to attempting this AND I succeeded!! More reading and understanding the knowledge provided got the results required. I have a further question to make sure I am being as efficient as possible. Can I load multiple "Uinamespaces" for multiple controls under the same class? Spoiler class MoneyDisplayTitle { idd = 101; duration = 1e+1000; onLoad = "(uiNamespace setVariable ['Money', _this select 0]; uiNamespace setVariable ['Variable2', _this select 0])"; class controls { class MoneyDisplayControl { idc = 101; type = 0; style = 0; x = 0.909894 * safezoneW + safezoneX; y = 0.140741 * safezoneH + safezoneY; w = 0.0525 * safezoneW; h = 0.07 * safezoneH; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {1,0.98,0.94,1}; text = "TEST"; shadow = 2; }; class Variable2DisplayControl { idc = 102; type = 0; style = 0; x = 0.909894 * safezoneW + safezoneX; /// Obviously all of the coordinates would be different this is just an example. y = 0.140741 * safezoneH + safezoneY; w = 0.0525 * safezoneW; h = 0.07 * safezoneH; font = "EtelkaNarrowMediumPro"; sizeEx = 0.05; colorBackground[] = {0,0,0,0}; colorText[] = {1,0.98,0.94,1}; text = "TEST"; shadow = 2; }; }; }; Share this post Link to post Share on other sites
pierremgi 4739 Posted October 23, 2017 Ui (user interface) name space is unique for an interface (if you run only one Arma session on a PC). But I understood what you meant: Anyway, In your mind, I guess you don't make difference between display and controls. Display (IDD) is unique in your example and what ever variable you call (referring to display) you will work on controls (IDC 101 or 102). example: 1 display: a picture of Mickey mouse in a frame >> 2 controls the picture and the frame. So it's useless to have 2 variables, you will just override your display controls! uinamespace setVariable ['Money', _this select 0]; is enough to call the display and do what you want with control classes. If you want to change Mickey for Minnie, you just have to call the good control and change the picture by ctrlSetText (text here is the path of a working paa file). Share this post Link to post Share on other sites