LOzan 10 Posted March 2, 2015 Hello all, I'm working on a scenario involving several dialogs and I've hit the infamous poor documentation roadblock. I've found several EXCELLENT tutorials for the basics and simple dialogs but they tend to end around using RscButton to run a script and contain nothing further from there while advanced guides on the wiki are mostly HUD elements and necessary parameters for class definitions; there's nothing covering the middle. Specifically, I'm trying to create a dialog allowing the player to modify the compositions of several squads from a list of units; the squad compositions are stored in arrays and displayed in RscListbox and can be modified through the dialog from there. From the guides I've found, I know how to place the dialog controls and Ctrl-Shift-S to copy them into my dialogs.hpp but I have no idea what to do from there. Can anyone point me at some guides or tutorials that may be able to help me? Share this post Link to post Share on other sites
seed 11 Posted March 2, 2015 From the guides I've found, I know how to place the dialog controls and Ctrl-Shift-S to copy them into my dialogs.hpp but I have no idea what to do from there. Can anyone point me at some guides or tutorials that may be able to help me? Look at the video below. It´s quite informative. It´s based on Icemans77 dialog tutorial. It explains the process from beginning to end. Hope that helps. Share this post Link to post Share on other sites
LOzan 10 Posted March 3, 2015 I've been over this video as well as Iceman77's tutorial, but neither includes everything I need. Like neither tell me how to get the player's selection from RscListbox to a script, or anything on RscListbox for that matter. Share this post Link to post Share on other sites
dr death jm 117 Posted March 3, 2015 it took me weeks to make and edit dialogs, I do really wish there was more info out there. I ended up opening a ton of others work to see what they did , but trying to follow were button is pushed to its script to function to some othere thing, does need some better documentation . Share this post Link to post Share on other sites
LOzan 10 Posted March 3, 2015 Maybe you can help me then. I'm trying to make a squad/platoon management dialog where the player can select a unit, I'm thinking from a listbox, and then use different buttons to perform actions with that unit through a script. How do I take the player's selection from RscListbox and bring it into the script? There will be multiple lists and buttons in the dialog. Share this post Link to post Share on other sites
fight9 14 Posted March 3, 2015 (edited) I've been over this video as well as Iceman77's tutorial, but neither includes everything I need. Like neither tell me how to get the player's selection from RscListbox to a script, or anything on RscListbox for that matter. Use lbAdd to add an item to a listbox and then use lbSetData to give it some string value (it really should have one unified command, but it doesnt). Have your button run a function or script with buttonSetAction. That function/script then uses lbCurSel to get the selected list index, and finally use lbData to retrieve the value you previously set - or lbText to get the text added with lbAdd. All of the dialog scripting commands can be found here. Edited March 3, 2015 by Fight9 Share this post Link to post Share on other sites
lecks 26 Posted March 3, 2015 Also see https://community.bistudio.com/wiki/User_Interface_Event_Handlers to see the event handlers that you can put on UI elements. You'll need event handlers for most interactions (like something updating when you choose something from the dropdown). Share this post Link to post Share on other sites
LOzan 10 Posted March 3, 2015 What about things like idc, access, and all that kind of stuff in the defines.hpp and dialogs.hpp files? I understand that some of it will be relevant but nothing really explains what it does or how to choose it to the uninitiated. I also see references to the "listbox or combobox with id idc of topmost user dialog" and have no idea what that means, any pointers? Share this post Link to post Share on other sites
fight9 14 Posted March 3, 2015 idc is the identification number for a control. You use it to select a control for scripting. Access is used to define if you can read or write on a control. You can find lots of information about different controls here. Okay, first you need to create a dialog under class controls. If you read the tutorials then you know we create all of our base classes in the defines.hpp. All that data is just default stuff. Its used to standardize things across your dialog. All of your dialog classes should inherent from your base defines. Lets create a dialog with an "onLoad" event handler to give your dialog a variable to access it later. class test_Dialog { idd = 17001; // not used here but required // variable for which we will access the dialog onLoad = "uiNamespace setVariable ['test_dialog_variable', (_this select 0)];"; class Controls { class test_list: RscListBox // inherent data from defines { idc = 12345; // number to access that control x = 8.5 * GUI_GRID_W + GUI_GRID_X; // position data y = 5.6 * GUI_GRID_H + GUI_GRID_Y; w = 24 * GUI_GRID_W; h = 7 * GUI_GRID_H; }; }; }; Now, in a script lets access that control and add a list item. // the "onload" eventHandler created this variable when opening the dialog _dialog = uiNamespace getVariable "test_dialog_variable"; // get list control from IDC number _list = _dialog displayCtrl 12345; // add item & data to list _index = _list lbAdd "Test Text"; _list lbSetData [_index,"Test Data"]; now that the data is set, lets retrieve it in another script // get dialog and control again _dialog = uiNamespace getVariable "test_dialog_variable"; _list = _dialog displayCtrl 12345; // get index of currently selected item _index = lbCurSel _list; // get text & data _data = _list lbData _index; // returns "Test Data" _text = _list lbText _index; // returns "Test Text" Share this post Link to post Share on other sites
LOzan 10 Posted March 3, 2015 (edited) Thank you so much! You all have no idea how helpful this is. A few questions, Fight9: 1) What do I have to place in the defines.hpp to define the base class for RscListbox? I have a template from SpencerArma but is there anything specific I need? 2) For lbAdd and lbSetData, which is displayed in the listbox? 3) Can lbSetData be used to store an object such as a unit and its associated namespace, or only variables? I'd test these things myself but my apartment is in mid-move and my gaming rig is packed up. Regardless, this is all going a long way toward helping me figure out this rather nebulous side of ARMA editing. Thank you for your help. EDIT: I also don't quite get why we need the event handler and test_dialog_variable. I see it in the scripts line with the displayCtrl command, but I'm not getting why we need to go through that variable when, as it appears to my uneducated eye, we could just go directly for the listbox control. What's the reasoning behind the variable? Edited March 3, 2015 by LOzan Share this post Link to post Share on other sites
fight9 14 Posted March 3, 2015 (edited) Okay, I'll try to answer your questions the best I can. 1. This is what I have for my own RscListBox basic defines... Obviously you will need to adjust colors. The wiki has its own basic define here. class RscListBox { deletable = 0; fade = 0; access = 0; type = 5; w = 0.4; h = 0.4; style = LB_TEXTURES; font = "PuristaMedium"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 30) * 1)"; shadow = 0; colorShadow[] = {0,0,0,0.5}; period = LIST_PERIOD; maxHistoryDelay = 1; rowHeight = 0; colorText[] = {1,1,1,1}; colorPictureDisabled[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.25}; colorScrollbar[] = {1,0,0,0}; colorSelect[] = {0,0,0,1}; colorSelect2[] = {1,1,1,1}; colorSelectBackground[] = {0.2,0.2,0.2,1}; colorSelectBackground2[] = {0.2,0.2,0.2,1}; colorBackground[] = {0.12,0.12,0.12,1}; soundSelect[] = {"",0.1,1}; autoScrollSpeed = -1; autoScrollDelay = 5; autoScrollRewind = 0; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,0.5,0,1)"; colorPicture[] = {1,1,1,1}; colorPictureSelected[] = {1,1,1,1}; colorPictudeDisabled[] = {1,1,1,0.25}; tooltipColorText[] = {1,1,1,1}; tooltipColorBox[] = {1,1,1,1}; tooltipColorShade[] = {0,0,0,0.65}; class ListScrollBar { width = 0; height = 0; scrollSpeed = 0.01; arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; color[] = {1,1,1,1}; }; };[/spoiler] 2. lbAdd is the text displayed (lbText to retrieve it) || lbSetData is the data saved to that text (lbData to retrieve it). 3. You can store anything you want there, as long as it is a "string". If you want that to be a global variable used to save an object, then use this code to get that object. This will turn a global variable to string and back again later. // save data GLOBAL_VARIABLE = vehicle player; // create global variable _index = _list lbAdd "Player's Vehicle"; // add text to display _list lbsetData [_index,"GLOBAL_VARIABLE"]; // save global variable as "GLOBAL_VARIABLE" string // get data _index = lbCurSel _list; // selected list item _variable = _list lbData _index; // will be "GLOBAL_VARIBLE" _vehicle = missionNamespace getVariable _variable; // missionNamespace is the same place global variables are saved 4. We are using the "onLoad" uiEventHandler to save the dialog itself to a variable. You need that variable to easily find that dialog later in your script. There are other ways but this is the best, in my opinion. Look again at my earlier post. You see that I first access that dialog using the onLoad variable. Then using that variable, I access the control within the dialog. You need a dialog to use the command displayCtrl. _dialog = uiNamespace getVariable "test_dialog_variable"; // get dialog _list = _dialog displayCtrl 12345; // get control within dialog I hope this helps clear things up. EDIT: You can also use the onLoad uiEventHandler to run a function that populates your dialog with data. You send the dialog itself as a parameter to the script/function. // uiEventHandler defined on your dialog class // "_this" is an array containing the display... [_display] onLoad = "_this call TAG_fnc_myfunc"; //create function TAG_fnc_myFunc = { // the dialog itself is sent to the function _dialog = _this select 0; // get RscList from dialog _list = _dialog displayCtrl 12345; // add data _index = _list lbAdd "Display Text"; _list lbSetData [_index,"Saved Data"]; }; Edited March 3, 2015 by Fight9 Share this post Link to post Share on other sites
LOzan 10 Posted March 3, 2015 Thanks so much for your help, I've got this dialog working now. Sorry for my rampant amateurishness! Share this post Link to post Share on other sites
fight9 14 Posted March 4, 2015 Thanks so much for your help, I've got this dialog working now. Sorry for my rampant amateurishness! Glad I can help. I needed help at this exact step when I started with my first dialog. There is a hole in the wiki between creating the dialog and adding data with scripting commands. There is no information on how to get from one step to the other. The onLoad uiEventHandler is the key here but it is not really mentioned that way. I hope this gets you started with filling that gap. Share this post Link to post Share on other sites
dr death jm 117 Posted March 4, 2015 ooops I was late ... but never the less, Im not a pro at dialogs. or variable. but I think it has to do with any type of add action (but im not positive.) but to make real cool flashy dialogs use style+style and or use pictures as buttons. if I find time ill post something... but chances are it wont be up in the time you need it. I can post also (sooner) what I use for 2 lists but its for picking costum sqads (from one list to the other) . look at bottom pic http://forums.bistudio.com/showthread.php?189400-looking-for-help-Im-updating-an-old-mission-KaRRiLioNs-RTS Share this post Link to post Share on other sites
LOzan 10 Posted March 4, 2015 @Dr Death JM, Take your time, I'm taking a few months off of college for illness so I'll need something to do to keep myself busy. I'm actually working on a platoon manager (three squads and a "reserve" of inactive troops) but I imagine the core principles are much the same. I'm sure you know much more on this than I do so any help would be fantastic. If you'd be willing to help me out I can post up a screenshot of what I'm working with from the GUI Editor and have a few specific questions before too long. Thanks! Share this post Link to post Share on other sites
lecks 26 Posted March 4, 2015 @LOzan: If this is a script you plan on releasing, you should only use RscListbox, etc, defines as base classes. Easiest way is to 'save' (ctrl-s) the 'parent classes' from the GUI editor and put them in a separate file (and #include it). You can also use this as a reference for what you can change in your custom controls. The reason for this is if you ever go to put this into a mod pbo/config.cpp instead of mission description.ext, you can just delete that extra file because the 'RscListbox' classes already exist in game. Also note that leaving it called RscListbox will conflict with any other scripts that do the same thing. I think it's good practice for mission scripts to rename them (ie YOURTAG_RscListbox). Again, this only makes any difference if you want to release it. Share this post Link to post Share on other sites
LOzan 10 Posted March 4, 2015 @Lecks, Are you talking about in the defines.hpp or in dialogs.hpp? The base classes are all called RscListbox, RscText, etc. in defines.hpp and #include - ed in the description.ext, but every control in dialogs.hpp has its own class name. Is that what you mean, or is there anything else to consider? This is all part of a campaign I have been and will be working on for a while. Share this post Link to post Share on other sites
dr death jm 117 Posted March 4, 2015 yeah in defines you can define instead of RscListbox use a tag/name you like/ IE: LOzan class LOzanRscListBox class LOzanRscListBox { access = 0; type = 5; w = 0.4; h = 0.4; rowHeight = 0; colorText[] = { 1, 1, 1, 1 }; colorDisabled[] = { 1, 1, 1, 0.25 }; colorScrollbar[] = { 0, 0, 0, 1 }; colorSelect[] = { 0, 0, 0, 1 }; colorSelect2[] = { 0, 0, 0, 1 }; colorSelectBackground[] = { 0.631,0.153,0.153,1 }; colorSelectBackground2[] = { 1, 1, 1, 0.5 }; colorBackground[] = { 0, 0, 0, 0.3 }; border = "#(argb,8,8,3)color(0,0,0,1)"; soundSelect[] = { "\A3\ui_f\data\sound\RscListbox\soundSelect", 0.09, 1 }; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; class ScrollBar { }; style = 16; font = "PuristaLight"; sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.5)"; shadow = 0; colorShadow[] = { 0, 0, 0, 0.5 }; color[] = { 1, 1, 1, 1 }; period = 1.2; maxHistoryDelay = 1; autoScrollSpeed = -1; autoScrollDelay = 5; autoScrollRewind = 0; tooltipColorText[] = {1,1,1,1}; tooltipColorBox[] = {1,1,1,1}; tooltipColorShade[] = {0,0,0,0.65}; }; Share this post Link to post Share on other sites
lecks 26 Posted March 5, 2015 Yeh, as DrDeath said, then just change it in your dialogs.hpp too. Reason for this is if you don't it won't be compatible with a bunch of other scripts which leave them named RscListBox Share this post Link to post Share on other sites
LOzan 10 Posted March 5, 2015 That all makes sense to me, I've got it working on that level. Thanks again for all your help. On a somewhat related note, I'm kicking around the idea of adding a progress bar to the dialog. There are plenty of examples of the defines.hpp and dialogs.hpp entries, but not much on how to make it in the GUI Editor. Advice? Right now I'm thinking of dropping an RscText control with the desired position and dimensions of the progress bar and changing it in the header files, but do you know of any more direct methods? Share this post Link to post Share on other sites
dr death jm 117 Posted March 5, 2015 position and dimensions I always suck at this , but guessing for me has always worked out, I usaly just refer to another buttons position and go from there or you could try : http://killzonekid.com/?s=dialogs Share this post Link to post Share on other sites
fight9 14 Posted March 5, 2015 That all makes sense to me, I've got it working on that level. Thanks again for all your help.On a somewhat related note, I'm kicking around the idea of adding a progress bar to the dialog. There are plenty of examples of the defines.hpp and dialogs.hpp entries, but not much on how to make it in the GUI Editor. Advice? Right now I'm thinking of dropping an RscText control with the desired position and dimensions of the progress bar and changing it in the header files, but do you know of any more direct methods? Just make a frame box in the GUI editor and then change it in the exported files. Progress bars are pretty easy. You can find all the information you need here. Share this post Link to post Share on other sites
LOzan 10 Posted March 6, 2015 That's what I thought, thanks for confirming. Thank all of you for all your help, I've got a pretty snazzy dialog set up now. I'll probably release it with a few other mechanics from my in-development campaign when there's enough to put into a Showcase kind of thing if there's any interest. Share this post Link to post Share on other sites