Jump to content
Sign in to follow this  
dr_eyeball

Dialog Template, plus Standard Dialogs

Recommended Posts

I have completed version 1.1 of a simple Dialog Template Framework. Hopefully I can get some feedback on improving it.

Goal:

The goal is to provide a basic dialog framework to allow other users to include standard dialogs and to create new dialogs (utilising the template) in their missions, to provide a more user friendly interface.

Features:

- A base dialog template (which you can modify to create a new one fairly easily)

- A popup menu system (for dialogs and MapClicks). You can avoid dialog code totally by using this.

- A basic Yes/No dialog

(Planning a few more base dialogs in future)

- Base control classes separated into separate files - (hopefully) no need to edit it, in general

- Uses full inheritence, minimising the code you work with significantly

- A color scheme (which you can alter - saves fussing with colors for all controls & dialogs)

- Hundreds of color constants

- Dialog specific functions script (only a few functions so far).

Notes:

Remember, the focus of this is the dialogs themselves. The functionality and scripting required behind all this may still be missing.

(Eg: The popup menu may have a "Request pickup" menu item, but clicking it may not necessarily do anything functional yet.)

Downloads: v1.1

- Armaholic

- Stavanger´s Militaria

- UploadPower (temp)

Screenshots:

- Base Dialog with sample controls

- YesNo Dialog

- PopupMenu MapClick

- Debug Dialog

- Hints examples

- PopupMenu TerrainDetail example

- PopupMenu ViewDistance example

- PopupMenu HQ example

- PopupMenu Support example

- PopupMenu Voting example

th_SampleControlsDialog.jpgth_YesNoDialog.jpgth_PopupMenu_MapClick.jpg

th_DebugDialog.jpgth_HintStructuredText.jpg

Future Plans:

- Additional standard dialogs.

Eg: debug output dialog, Text/Ok dialog, Image/Ok dialog

- More controls in the base dialog

- Need a better system for tracking IDD's & IDC's.

- Menu definition strucuture is currently array based, but could easily be converted to use class definitions instead.

Problems:

- Missing command to GetMousePosition (to match setMousePosition). There might be a work around for it, using dialog events.

Mission Developer Usage - Creating a new dialog or popup menu for a mission.

See the second post (just below) in this thread.

Edited by Dr_Eyeball
reformat

Share this post


Link to post
Share on other sites

Related resources links:

- to be advised. (None at this stage. Was going to be a few links to other dialog projects.)

Changelog:

Code Sample

v1.1 change log
============
Main changes:
--------------
- Expand the PopupMenu functionality to a usable level.
- Added a debug output dialog, which logs any data type, auto parses arrays and allows word wrapped text viewing for long outputs.
- Added structured hint examples (HintStructuredText.sqf), for those who want to avoid dialogs where possible.

Minor change details:
--------------------
- restructured folders and file locations to a more sensible modular structure
- Popup menu now includes: 
 - disabling menus, 
 - hints, 
 - temp click markers, 
 - menu activation via shortcut key (default T key - "TeamSwitch" key)
- automatic parameter substitution into Actions and Captions (for mapClick pos, player pos, current waypoint pos, gridRef's for all pos's, etc).
 - provisions for current waypoint handling 
   - Since there is no GetCurrentWaypoint command yet, it defaults to first waypoint. 
   - However another "Logistics" project which I will release will handle this better.
- minor bug fixes & removal of irrelevant code
- further standardise base control class definitions (DialogControlClasses.hpp)
 - all class properties are now initialized with a default value to prevent ArmA warnings (only demonstrated classes)
 - fix control class sounds

Mission Developer Usage - Incorporating the PopUp menus into a mission.

These are just rough details.


  • for existing missions, do not copy mission.sqm, description.ext, init.sqf & stringtable.csv
  • copy the other project sub-folders and their files
  • modify/merge description.ext
  • modify/merge init.sqf
  • add radio/action menu items to activate the popup menu script, similar to the way it was done in PopupMenuInit.sqf, or leave it as is
  • modify CreatePopupMenu.sqf with the array containing your desired menu structure

To simplify this final stage, simply replace the entire contents of the file CreatePopupMenu.sqf with this code block, then expand with the ideas from the original file:

Code Sample

[color=#000000]_MenuStructureArray =
[
 ["MainMenu",
   [
     ["Caption", "My Menu"],
     ["Items",
       [
         [ ["Item", "Item 1"], ["Action", "nul=[1] execVM 'Item.sqf';"] ],
         [ ["Item", "Item 2"], ["Action", "nul=[2] execVM 'Item.sqf';"] ]
       ]
     ]
   ]
 ]
];
nul=_MenuStructureArray execVM "Dialogs\Common\PopupMenu.sqf";
[/color]

Mission Developer Usage - Creating a new dialog for a mission.

These are just rough details.


  • for existing missions, do not copy mission.sqm, description.ext, init.sqf & stringtable.csv
  • copy the other project sub-folders and their files
  • modify/merge description.ext
  • modify/merge init.sqf
  • Copy and rename MyTestDialog.hpp & MyTestDialog.sqf to your preference into the same folder. Eg: NewDialog.hpp & NewDialog.sqf
  • In your 2 new files, globally search & replace the prefix "LOC3_" to your preference. Eg: "ABC_"
  • In your 2 new files, globally search & replace the word "MyTestDialog" to your preference. Eg: "NewDialog"
  • Modify description.ext to include your new dialog class definition.
    Eg: Code Sample
    #include "Dialogs\NewDialog.hpp"


  • Add a temp action to display your new dialog, similar to the way it was done in SampleDialogsInit.sqf
    Code Sample
    _Action = player addAction ["New Dialog", "Dialogs\NewDialog.sqf", [ /* params */ ], 0, false, false, "" ];


  • (Save and) Reload your mission in the editor (to reread the description.ext file & new hpp files)
  • If reloading works, that's a very good sign, otherwise examine arma.rpt for error log.
  • Test that your dialog works
  • If all is working, modify your new dialog to suit.

Please report any errors with the above "usage" procedures.

Edited by Dr_Eyeball
reformat

Share this post


Link to post
Share on other sites

I so want to download this, but the dl side you have chosen simply doesn't work for me sad_o.gif

Share this post


Link to post
Share on other sites

Downloading now. I definatly want to use these smile_o.gif

Share this post


Link to post
Share on other sites

Nice Idea, I'm sure this will prove usefull. Any chance of adding a template for the camera views you get during a missions breifing?

Share this post


Link to post
Share on other sites

Dr Eyeball is there any way i can get this to start at the start of the mission though the init without using the action menu.

Quote[/b] ]_Action = player addAction ["> Test Yes No Dialog", "Dialogs\Common\ActivateYesNoDialogViaAction.sqf",

 [ ["Question", "The <t color=#f000ff00'>helicopter</t> is now over the landing zone.<br/> Do you want to eject from the helicopter?] ] ];

everytime i try this i get an error no question when the diologue appears..

Quote[/b] ]nul=execVM "Dialogs\Common\ActivateYesNoDialogViaAction.sqf",

["Question", "The <t color=#f000ff00'>helicopter</t> is now over the landing zone.<br/> Do you want to eject from the helicopter?];

Share this post


Link to post
Share on other sites

I just need to complement you that this may prove to be the most significant contribution to the community of all the scripts I have seen. Dialogs/UI is by far the hardest, most time consuming process in mission making, but is the most crucial aspect of us moving beyond the limitations of the action & radio menus for commands.

I'm looking forward to working with v1 and future revisions!

Share this post


Link to post
Share on other sites

Im implemeting these into my missions with working scripts i just need to knw how to set the diologue off from a script and not the action menu.

Share this post


Link to post
Share on other sites

Thanks for the support guys.

Notes: the PopUpMenu system has been improved since v1.0. I can release v1.1 in a few days or just the core files, upon request.

It now handles: disabling menus, hints, current waypoint handling, temp click markers, automatic parameter substitution into Actions and Captions (for mapClick pos, player pos, current waypoint pos, gridRef's for all pos's, etc). We really need proper string functions.

@Matt Rochelle: Syntax, it's an array of arrays, so that it can look up a parameter by name. So for the YesNoDialog, use something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul=[["Question", "My Question"]] execVM "Dialogs\Common\YesNoDialog.sqf";

I haven't explained this new paired parameter concept anywhere, which I started using. It allows for future expansion of including extra parameters or user defined parameters, without having to rewrite all the code to handle the new parameters.

The general format is:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[

["Item1", "Value1"],

["Item2", "Value2"],

["Item3", [["A much more complicated Value3 Array"], [52,0.7], "Hello"] ],

...

["ItemX", _etc]

]

I'm currently working on a "Logistics Control Menu" using the PopUpMenu system. I'll reveal those details soon. So far it handles:

- simple soldier recruitment (20 roles) - completed

- air drop requests (via AI aircraft) of: ammo crate, PBX, landrover - 100% complete

- a transport request system, including acknowledgement, pick-up & destination handling, waiting durations (plus transport type & purpose) - 80% complete

- Waypoint system - 100% complete.

- Configuration menu - 99% complete (same as demo)

It should be good. I'd like to know what scripts you guys are attaching to these menus. I think a new thread on scripting the PopUpMenu alone would be worthwhile.

Edit:

@UNN: Camera Views

I think camera views is outside of the scope of dialogs and is not something I'm familiar with yet.

Share this post


Link to post
Share on other sites

Wow Dr_Eyeball Im very interested in this project as for me and many other mission makers found it hard to create Dialogs but with a template we can work from this gives up a big opening and lets us drive deeper into our mission editing.

All in all 1.1 looks like its going to be great and keep up the good work, i think more people need to know about this. Excelent. I will definitly add these Dialogs into my new upcoming mission to show off the full potential abilitys smile_o.gif

Great Work.

Share this post


Link to post
Share on other sites

I haven't tried it out yet but it definitely is a good thing to have generally as dialog making is quite annyoing. Especially placing the controls in a proper layout.

Share this post


Link to post
Share on other sites

Thanks much very,

I needed something like this and this is like first class silver platter service.

Rock on!

Share this post


Link to post
Share on other sites

Wow is this great to work with. Looking forward to enhancements to this and the MP Respawn project based on this.

I did find a design flaw in this version. The PanMap function has hardcoded the LOC3 prefix. At this point if running multiple dialogs I would need to make multiple functions and link to the appropriate one for my particular dialog:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Dlg_PanMapBetweenTwoPositions =

{

_IDC_Map = _this select 0;

_startPos1 = _this select 1;

_endPos2 = _this select 2;

_ctrl = LOC3_display displayctrl _IDC_Map;

ctrlMapAnimClear _ctrl; // stops previous panning

// [duration, zoom, pos]

_ctrl ctrlmapanimadd [0.0, 1.00, _startPos1]; // show home base

_ctrl ctrlmapanimadd [1.2, 1.00, _endPos2]; // show map location

_ctrl ctrlmapanimadd [0.2, 0.30, _endPos2]; // zoom map location

ctrlmapanimcommit _ctrl;

};

Also your SS above show a very nice blue theme, but I believe the theme packaged with the v1.0 is a grey/red theme. Can you share the theme document used above?

Share this post


Link to post
Share on other sites

Version 1.1 of the Dialog Framework is now available.

It's a small update, but required for the release of some of its other dependent projects (which are due soon and are more interesting).

N.B.: Be aware that some things were renamed or moved around (especiall file locations), for the sake of modularity.

<span style='color:blue'>v1.1 change log</span>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Main changes:

=============

- Expand the PopupMenu functionality to a usable level.

- Added a debug output dialog, which logs any data type, auto parses arrays and allows word wrapped text viewing for long outputs. The "sideChat debug system" just doesn't cut it.

- Added structured hint examples (HintStructuredText.sqf), for those who want to avoid dialogs where possible.

Minor change details:

================

- restructured folders and file locations to a more sensible modular structure

- Popup menu now includes:

- menu activation via shortcut key (default T key - "TeamSwitch" key) and priority set down to 0.

- disabling menus,

- hints,

- temp click markers,

- automatic parameter substitution into Actions and Captions (for mapClick pos, player pos, current waypoint pos, gridRef's for all pos's, etc).

- provisions for current waypoint handling

- Since there is no GetCurrentWaypoint command yet, it defaults to first waypoint.

- However another "Logistics" project which I will release will handle this better.

- minor bug fixes & removal of irrelevant code

- further standardise base control class definitions (DialogControlClasses.hpp)

- all class properties are now initialized with a default value to prevent ArmA warnings (only demonstrated classes)

- fix control class sounds

<span style='color:blue'>New screenshots:</span>

- Debug Dialog

- Hints examples

th_DebugDialog.jpgth_HintStructuredText.jpg

<span style='color:blue'>Downloads:</span> v1.1

- see first post for updated links

-----------------------------

@Shiner, thanks for the "LOC3_display" bug report. That's fixed now.

The color scheme file is already part of the download in the file called "DialogColorScheme.hpp". Just modify the Dlg_ColorScheme_CaptionBackground value. (I know I haven't explained any of this yet.)

Share this post


Link to post
Share on other sites

Totally ... totally ... wicked! Big thanks, to my opinion dialogs are always horrible in terms of creating headaches :P

Debug dialog, nice! I will be toying around with these over the weekend! biggrin_o.gif

Share this post


Link to post
Share on other sites

Dr Eye,

Do you know if we can use links in the html to fire off a script or event? I was also curious if there is a way to build a listbox with images in it.

Share this post


Link to post
Share on other sites

Not aware of html control being able to perform any additional actions except show marker position and other html pages.

I'll have to check if list boxes support images. Never tried or seen it, but I'd say they would. I meant to add that to the demo, but forgot. I know they work for combo's. Try something like:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_idc = your_combo_control_id;

_value = "text";

_picture = "\CA\ui\data\ui_action_heal_ca.paa";

_data = "data";

_index = lbAdd [_idc, _value];

lbSetPicture [_idc, _index, _picture];

lbSetData [_idc, _index, _data];

Share this post


Link to post
Share on other sites

wow this is ownage smile_o.gif

thanks

i will start immediately to use it in my strategymode-project

hmm the only problem is: i dont know how to modify the template for my needs sad_o.gif

for example, i dont need that much context menu entries for onmapclick.

it seems like hard work to adapt it, so many files so many dependancies - maybe you could shed some light on it? i would like to keep the colour scheme, drop the MapPan, drop many items in context menu. how can i include new buttons? if i want a scriptet action to start on a button click, do i have to modify more than one line?

Share this post


Link to post
Share on other sites

If you need help, present specific detailed questions. The majority of it is very modular, you either include it or you don't. The easiest thing to try is to just modify the examples to suit. There's no way to avoid the work involved.

Quote[/b] ]How do I add new buttons?

I presume you mean the buttons which represent the menu items. The PopupMenu items are defined as an array. The sample project includes a file CreatePopupMenu.sqf which contains an array called _MenuStructureArray. Just modify that array to suit yourself.

Quote[/b] ]if i want a scripted action to start on a button click, do i have to modify more than one line?

No, it's simply 1 line of code to change - modify the "Action" property and include a code string as it's value. Eg:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[ ["Item", "Execute script..."], ["Action", "nul=[] call 'MyScript.sqf';"] ], // "Action" = code string to execute

The structure of this array is as follows: (see comments for added explanations)

Quote[/b] ]

_MenuStructureArray =

[

<span style=color:blue'>//Your own parameters, eg: _MapClickParams,</span>

<span style='color:blue'>//Menu definitions:</span>

["MainMenu", <span style='color:blue'>// currently the first menu must be called "MainMenu"</span>

[

["Caption", "Logistics Control System], <span style='color:blue'>// "Caption" = caption of menu item</span>

["Items", <span style=color:blue'>// "Items" = menu items array</span>

[

[ ["Item", "Waypoints &gt], ["SubMenu", "Waypoints"] ], <span style='color:blue'>// "Item" = menu item caption, "SubMenu" = submenu to load</span>

[ ["Item", "Transport >"], ["SubMenu", "Transport"] ],

[ ["Item", "Execute script..."], ["Action", "nul=[] call 'MyScript.sqf';"] ], <span style='color:blue'>// "Action" = code string to execute</span>

[ ["Item", "-"] ], <span style='color:blue'>// An "Item" with value "-" is a menu separator</span>

[ ["Item", "Close Menu"], ["Close", true], ["Default", true] ] <span style='color:blue'>// "Close" & "Default" are special menu control commmands</span>

]

]

]

], <span style='color:blue'>// end of "MainMenu" definition</span>

["Waypoints", <span style=color:blue'>// SubMenu definitions can have any name</span>

[

["Caption", "Waypoints],

["Items",

[

[ ["Item", "Set waypoint >"], ["SubMenu", "SetWaypoint"] ]

...

]

]

]

],

...

];

Share this post


Link to post
Share on other sites

Excellent work, something which is truly useful for ArmA smile_o.gif

Thanks a lot! I will definately be using your templates in future missions! smile_o.gif

thumbs-up.gif keep it up!

Share this post


Link to post
Share on other sites

thx dr. eyeball i will try it smile_o.gif

edit:

things start to clear up already, the main problem was that i wasnt used to SQF syntax/structure

Share this post


Link to post
Share on other sites

ok your dialogs really are great smile_o.gif

after adapting to sqf syntax (i still forget all the ";"s at line ends sad_o.gif )

if you want to take a look at it:

StrategyMode

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×