riouken 15 Posted October 21, 2010 I am trying to learn dialogs from this. I can get one button to show just fine but whenever I try to get a second button to show up I get this error: description.ext, line 40: '/SampleDialog.Class': 'H' encountered instead of '=' No idea what that error means. Here is my dialog: class SampleDialog { idd = -1; movingEnable = false; controlsBackground[] = {}; controls[] = {"ButtonControl","HintButton"}; objects[] = {}; class ButtonControl { idc = -1; type = 1; style = 2; moving = false; x = 0.45; y = 0.9; h = 0.05; w = 0.1; font = "Zeppelin32"; sizeEx = 0.025; action = "closeDialog 0; hint ""Close pushed"";"; text = "Close"; default = false; colorText[] = {1,0,0,1}; // white colorFocused[] = {0,1,0,1}; // green colorShadow[] = {0.8,0.8,0.8,1}; // darkgrey colorBorder[] = {0.5,0.5,0.5,1}; // grey colorBackground[] = {0,1,1,1}; colorBackgroundActive[] = {0,1,0,1}; // green colorDisabled[] = {1,0,0,1}; // red colorBackgroundDisabled[] = {0.5,0.5,0.5,1}; // grey borderSize = 0.015; offsetX = 0.005; offsetY = 0.005; offsetPressedX = 0.002; offsetPressedY = 0.002; soundEnter[] = {"",0,1}; // NoSound soundPush[] = {"",0,1}; // NoSound soundClick[] = {"",0,1}; // NoSound soundEscape[] = {"",0,1}; // NoSound }; Class HintButton { x = 0.6; action = "hint ""Hint from second button!"";"; text = "Hint"; }; }; Share this post Link to post Share on other sites
nuxil 2 Posted October 21, 2010 i would write it a bit diffrent. class My_StandarButton { idc = -1; type = 1; style = 2; moving = false; x = 0.45; y = 0.9; h = 0.05; w = 0.1; font = "Zeppelin32"; sizeEx = 0.025; default = false; colorText[] = {1,0,0,1}; // white colorFocused[] = {0,1,0,1}; // green colorShadow[] = {0.8,0.8,0.8,1}; // darkgrey colorBorder[] = {0.5,0.5,0.5,1}; // grey colorBackground[] = {0,1,1,1}; colorBackgroundActive[] = {0,1,0,1}; // green colorDisabled[] = {1,0,0,1}; // red colorBackgroundDisabled[] = {0.5,0.5,0.5,1}; // grey borderSize = 0.015; offsetX = 0.005; offsetY = 0.005; offsetPressedX = 0.002; offsetPressedY = 0.002; soundEnter[] = {"",0,1}; // NoSound soundPush[] = {"",0,1}; // NoSound soundClick[] = {"",0,1}; // NoSound soundEscape[] = {"",0,1}; // NoSound [b]action = ""; text = "";[/b] }; class SampleDialog { idd = -1; movingEnable = false; controlsBackground[] = {}; controls[] = {My_button1,My_button2} objects[] = {}; My_button1 : My_StandarButton { //x = 0.45; already defined. set new values if need new position of your button //y = 0.9; //h = 0.05; //w = 0.1; action = "closeDialog 0; hint ""Close pushed"";"; text = "Close"; }; My_button2 : My_StandarButton { x = 0.6; action = "hint ""Hint from second button!"";"; text = "Hint"; }; }; Share this post Link to post Share on other sites
CarlGustaffa 4 Posted October 21, 2010 (edited) Wouldn't that crash? controls[] = {My_button1,My_button2} is missing ; Also, although purely cosmetic, I prefer consistent use on where curly bracers are placed. I prefer inline rather than newline, but either consistent is better than a mix. And OP should take a look at his indenting. Again, only cosmetics, but it makes the class structure a lot easier to read. In posted example, both classes should be indented one left, and both classes class termination }; should be indented even one more left. But yeah, get the defines and defaults outside the main dialog. And both should be #include into description.ext (defines and defaults first) rather than mixed. The problem with OPs dialog, is that you forget to inherit from an already existing class. Class HintButton { ... doesn't contain enough information. Class HintButton : ButtonControl { ... might work (although not tested and I always end up in troubles myself with dialogs, so... :p). Edited October 21, 2010 by CarlGustaffa Share this post Link to post Share on other sites
nuxil 2 Posted October 21, 2010 Yes it would crash. i forgot to put in a ; i just worked out of his example giving him the basic idea how the correct way in my opinion is to do it. I prefer newline rather than inline. I find it easyer to read code like: class foo { class bar { moo = foobar; }; }; Vs class foo { class bar { moo = foobar; }; }; but thats just mattre of coding style and what you are used to. there is no real diffrance between them other than how you read it. Share this post Link to post Share on other sites
HeliJunkie 11 Posted October 21, 2010 Class HintButton : ButtonControl { x = 0.6; action = "hint ""Hint from second button!"";"; text = "Hint"; }; I think it's only a typo error. The example should be correct.All tested with ARMA (not ARMA2/OA) @CarlGustaffa,nuxil And the tutorial is a "Beginner Guide", so good code indent is not part of the tutorial, and #includes are in a later chapter... :D Regards The Author of "Introduction to Dialogs" :D Share this post Link to post Share on other sites
CarlGustaffa 4 Posted October 21, 2010 (edited) @nuxil: Yeah I agree it's just a matter of personal preference. I do it inline in block statements in script code to save number of lines, and since with UltraEdit I get a nice expandable + sign for each line anyways, which doesn't get removed if I contract it, and like to have the same system. In script code I sometimes even use several blocks on the same line, if the result is nice and tidy :) And yeah, sometimes I break my own rules deliberately as well :D @HeliJunkie: Putting this in spoiler tags, as it may confuse OP, which is not my intent. My intent is to hopefully make a tutorial even better. I read through it briefly, and actually indents are mentioned in the last line of "Creating Our First First Dialog", but all the code examples doesn't make use of it, and doesn't help the newbie in understanding "good looks and readability". Could be a browser problem though. Ahh, just noticed something. Although it's nothing technically wrong with the method of using controls[] = {list,of,all,controls}; this method won't work for displays (versus the example is a dialog), but the class controls { class1 {}; class2 {}; }; method will work with both. Check Domination, which has plenty of both dialogs and displays, and the only control[] you will find is in external TeamStatusDialog.hpp. For someone who is starting out using this tutorial to create his first dialog, he will get into a lot of frustrations when trying to create his first display (I know I did ;), although not related to the tutorial). This also involves using the apparently complex method of using uiNamespace in conjunction with onLoad, in order to obtain the dialog/display number. Obtaining it for dialogs is simple, just look up the idd using findDisplay and you're done. Obtaining it for displays requires the use of uiNamespace (idd can be left at -1). Example of dialog coded as a display (I'm only showing one control and also no defines or inherited classes): class XD_ArtilleryDialog { [b][color="SeaGreen"]idd = -1;[/color][/b] //Eliminates possible (but unlikely) conflicts with dialogs from other authors. movingEnable = true; [b][color="DarkOrchid"]onLoad="[] execVM 'bat\ArtilleryDialog.sqf'; uiNamespace setVariable ['[color="Blue"]D_ARTI_DISP[/color]', _this select 0]";[/color][/b] objects[] = {}; class controlsBackground { class XD_BackGround : XC_RscText { idc = -1; type = 0; style = 48; x = 0; y = 0; w = 1.93; h = 1.30; XCTextBlack; colorBackground[] = {0,0,0,0}; text = "\ca\ui\data\ui_mainmenu_background_ca.paa"; font = "Zeppelin32"; sizeEx = 0.032; }; }; [b]class controls {[/b] //Note there are no controls[] = {} list defined. class XD_MainCaption : XC_RscText { idc = [color="Red"][b]1[/b][/color]; x = 0.12; y = 0.05; w = 0.25; h = 0.1; sizeEx = 0.035; colorBackground[] = {1, 1, 1, 0}; XCMainCapt; text = ""; //"ARTILLERY DIALOG" || "MORTAR DIALOG" }; }; }; Obtaining the dialog/display number (only way for displays): _XD_display = uiNamespace getVariable "[color="#0000ff"]D_ARTI_DISP[/color]"; _ctrl = _XD_display displayCtrl [color="#ff0000"][b]1[/b][/color]; _ctrl ctrlSetText "Yo"; It may look a bit more complex at first compared to accessing it through it's idd like we're used to from "old style" dialogs, but the big benefit is that when used and learned, there will be no major differences in making a dialog and a display. The learning curve for dialogs is pretty steep already. I'm no expert on dialogs however, and there might be reasons to use "old style" that I am not aware of. If you know of any, I would like to know. How it looks ingame, just to illustrate that it is actually a working dialog with inputs and everything, despite code appearing as displays. I've never tried opening it as a cutRsc though :p Edited October 21, 2010 by CarlGustaffa Share this post Link to post Share on other sites
riouken 15 Posted October 21, 2010 @CarlGustaffa and HeliJunkie. Thanks for catching that but I had already tried it with the correct inheritance, I had tried to define the second button all by it self but I still got the same error. So I put the code back to the original. But I forgot to replace the inheritance. I tried both ways and I was still getting the same error. I will rewrite and try it again to make sure I have no typos. Thanks @nuxil. I think I understand the changes, and I have seen other dialogs written like the example you posted. I will try that out and see if I can get it working. Thanks ---------- Post added at 06:57 AM ---------- Previous post was at 06:38 AM ---------- @nuxil ok I tried the example you gave and now I am getting this error: line 42: '/SampleDialog.My_button1': ':' encountered instead of '=' here is the dialog: class My_StandarButton { idc = -1; type = 1; style = 2; moving = false; x = 0.45; y = 0.9; h = 0.05; w = 0.1; font = "Zeppelin32"; sizeEx = 0.025; default = false; colorText[] = {1,0,0,1}; // white colorFocused[] = {0,1,0,1}; // green colorShadow[] = {0.8,0.8,0.8,1}; // darkgrey colorBorder[] = {0.5,0.5,0.5,1}; // grey colorBackground[] = {0,1,1,1}; colorBackgroundActive[] = {0,1,0,1}; // green colorDisabled[] = {1,0,0,1}; // red colorBackgroundDisabled[] = {0.5,0.5,0.5,1}; // grey borderSize = 0.015; offsetX = 0.005; offsetY = 0.005; offsetPressedX = 0.002; offsetPressedY = 0.002; soundEnter[] = {"",0,1}; // NoSound soundPush[] = {"",0,1}; // NoSound soundClick[] = {"",0,1}; // NoSound soundEscape[] = {"",0,1}; // NoSound action = ""; text = ""; }; class SampleDialog { idd = -1; movingEnable = false; controlsBackground[] = {}; controls[] = {My_button1,My_button2}; objects[] = {}; My_button1 : My_StandarButton { //x = 0.45; already defined. set new values if need new position of your button //y = 0.9; //h = 0.05; //w = 0.1; action = "closeDialog 0; hint ""Close pushed"";"; text = "Close"; }; My_button2 : My_StandarButton { x = 0.6; action = "hint ""Hint from second button!"";"; text = "Hint"; }; }; I am using A2:CO and I have tried it with and with out addons. lol, I see now why everyone says happy crashing when trying to learn dialogs. Share this post Link to post Share on other sites
HeliJunkie 11 Posted October 21, 2010 @Riouken Don't forget the "class" Keyword before "My_Button1" and "My_Button2": ..... class My_button1 : My_StandarButton { ..... }; class My_button2 : My_StandarButton { .... }; @CarlGustaffa:The original tut I wrote was a PDF document. The indentationn was broken as some OFPEC stuff wrote it into a HTML page. So... sorry about that. And thanks for the hints... maybe I update the document in the next time... Share this post Link to post Share on other sites
riouken 15 Posted October 22, 2010 Ok I have it working now! Thanks HeliJunkie, and tyvm for the tutorial. Ok next question, how do you inherit from the standard arma ui? I have seen that in other dialogs, lets say I wanted to use the standard arma buttons. How would I do that? I tried just using the standard class My_StandarButton : RscButton But that does not seem to work, it gives this error. line 0: .My_StandarButton: Undefined base class 'RscButton' I know RscButton is defined in the UI config. Share this post Link to post Share on other sites
HeliJunkie 11 Posted October 22, 2010 Yes, it's defined... but in "(game)config" not in "missionconfig". If you want to inherit directy from "RscButton", you have to write it into a "config.cpp" and create an addon. It's not (directly) possible to inherit "RscButton" if you write it down into the description.ext (which is missionconfig). I know that a lot config, even if defined in "description.ext" inherit from that class, but they often have a line like "#include ... \BasicRsc.cpp" or somthing like that at the top of the file. And in the "..\BasicRsc.cpp" are the "BasicClasses" (like RscButton). The class code is often copied from the UI game config. Have a look at this example (LINK => WIKI Page). The "class My_BlueText : RscText" can only inherit from "RscText" because it was defined earlier in the file. Share this post Link to post Share on other sites
CarlGustaffa 4 Posted November 5, 2010 An experiment I just did. Simple stuff, just an image, but shows how to use the same hpp to define something that can be used both as a display and a dialog. description.ext (note that define.hpp contains the usual needed stuff): #include "dialogs\define.hpp" class RscTitles { #define __raptor "raptor_disp" #define __raptordisplay true #include "raptor.hpp" #undef __raptor #undef __raptordisplay }; #define __raptor "raptor_diag" #include "raptor.hpp" #undef __raptor raptor.hpp: #ifdef __raptordisplay class raptor_disp { #else class raptor_diag { #endif idd = -1; name=__raptor; #ifdef __raptordisplay onLoad = "uiNamespace setVariable ['raptor_disp', _this select 0]"; fadein = 0; fadeout = 0; duration = 10e10; #else movingEnable = true; onLoad = "uiNamespace setVariable ['raptor_diag', _this select 0]"; #endif controlsBackground[] = {}; objects[] = {}; class controls { class raptor_image { idc = -1; type = CT_STATIC; style = ST_PICTURE; colorBackground[] = { }; colorText[] = { }; font = Bitstream; sizeEx = 0.023; x = -0.0; y = -0.0; w = 1.0; h = 1.0; text = "images\screen_blood_1_ca.paa"; }; }; }; Example use: _ok = createDialog "raptor_diag"; //Creates it as a dialog that takes input 5 cutRsc ["raptor_disp","PLAIN"]; //Creates it as a display 5 cutRsc ["DEFAULT","PLAIN"]; //Removes it as a display Not sure if this is very useful, but I have some ideas for it. Share this post Link to post Share on other sites
nuxil 2 Posted November 5, 2010 Always usefulle to share info about dialog/display coding. i never thought about doing dialog/display coding in this way thanks for sharing. :) Share this post Link to post Share on other sites
raptor 6 actual 13 Posted November 7, 2010 (edited) Yeah, thx CarlGustaffa, But to be honest, I'm still learning this stuff and that's way out there for where I currently am. I for example have a heart monitor up, and as mentioned in my PM, it's image makes the buttons that need to be pressed blurry and hard to read. So...I have three class Buttons made to be transparent over the background dialog image, when the user goes to click on the (for example- the ON button) another display needs to appear with a more crisp image of the area where the Monitor button is located. Will the above script examples do this, or will it just display an image with no input functionality? I have this link to better explain one of the three zoomed in areas I want. As each area comes up, I need some of the buttons on the zoomed in area to have functionality (hence the question above). Hopefully this pic will give you all a better idea of what I'm trying to do. And again, I'm having to learn this step by step, I have the patience, but not enough hair to keep pulling out of my head :P http://img641.imageshack.us/img641/9390/newimagef.jpg Thanks again Nuxil and Carl Edited November 7, 2010 by Raptor 6 Actual More explanation Share this post Link to post Share on other sites
CarlGustaffa 4 Posted November 7, 2010 but not enough hair to keep pulling out of my head :P Haha, have to remember that one :p Sorry, I have never done multi/child dialogs, can't even recall ever seeing one. Sounds to me your only option is to redesign the view to allow bigger buttons or a popup of a new dialog having the needed parts in better resolutions. I tend to not enjoy photorealism if it restricts how I need to operate a device. Never really had that problem in this game, but in flightsim I remember there were some "supergauges" that ended up being too hard to use practically for that reason. In your case, it doesn't look like you should be "out of room" though. Sure a button tooltip wouldn't be enough? If the lower buttons aren't used, I'd simply delete them and use that space for better readable buttons by increasing their size. What I posted is i.e. when you need to have something work both as an input device (dialog) and as an overlay (display), using the same hpp resource, and how using the "new way" of defining a dialog makes that possible. Might be useful for a GPS you can interact with, probably not so much for your monitor. Can we have multiple dialogs open at the same time? I don't know. If it turns out we can't, than yes, that is how I would do it: When you click the button that opens the new one (and the old one is closed automatically), I would open it as a background resource instead (if we can control the layering of the new dialog, also something to check I guess). Share this post Link to post Share on other sites
raptor 6 actual 13 Posted November 8, 2010 Ok, last question so this poor lad doesn't think I've totally hijacked his thread, but maybe it'll help someone else.....but, how would I go about changing the action = field if say, on the main monitor dialog, they clicked on the area I want to come up and it closes the main monitor, but opens the smaller one? This of course, in lieu of remaking the main monitor pic. Otherwise, that's what I'll have to do. I know this can be done, because I believe Nuxil sent me a link for ArmAPod, and it's got multiple screens that change, and still accept input. Only problem is that you and his level of knowledge is at like level 5000, and mine is still at 1. That's all, I'll try to figure out the rest somehow. Thanks Share this post Link to post Share on other sites
nuxil 2 Posted November 8, 2010 (edited) if your talking about buttons you can use buttonSetAction take a look at this in that case http://community.bistudio.com/wiki/buttonAction http://community.bistudio.com/wiki/buttonSetAction if its a picture dialog. then theres a little more work that needs to be done. since afik you can only use envent such as : onMouseEnter onMouseMove once in a dialog. here is my simple Gear dialog example. it shows text when howering over a picture contols Gear.hpp class RscSimpleGearMenu { idd = 15010; moving = false; movingEnable = false; movingEnabled = false; onLoad="uiNamespace setVariable ['Gear_Display', _this select 0];[] spawn GearType;"; controlsBackground[]={}; objects[]={}; controls[] = {Mousearea, Mainback, KitList, PriWeaponPic, SecWeaponPic, PistolWeaponPic, Goggle1,Goggle2, MSlot1,MSlot2, MSlot3,MSlot4, MSlot5,MSlot6, MSlot7,MSlot8, MSlot9,MSlot10, MSlot11,MSlot12, PSlot1,PSlot2, PSlot3,PSlot4, PSlot5,PSlot6, PSlot7,PSlot8, ISlot1,ISlot2, ISlot3,ISlot4, ISlot5,ISlot6, ISlot7,ISlot8, WeaponName }; //class controlsBackground[]{}; class Mousearea { idc = -1; type = 0; style = 16; colorText[ ]={ 0,0,0,0 }; colorBackground[ ]={ 1,1,1,0 }; font = "Zeppelin32"; sizeEx = 0.05; lineSpacing = 0; x = 0.305; y = 0.17; w = 1.2549+0.2; h = 0.836601; text = ""; onMouseMoving = "[_this select 1,_this select 2] call MouseOver"; }; class Mainback : RscPicture { idc = -1; x = 0.185; y = 0.17; w = 1.2549+0.2; h = 0.836601; text = "\ca\ui\data\ui_difficulty_background_ca.paa"; //onMouseMoving = "hint format[""%1"",_this]"; }; class KitList : RscListBox { idc = 15011; x = 0.195; y = 0.258; h = 0.498; w = 0.1; onLBDblClick = "[] spawn setGear"; onLBSelChanged = "[_this] spawn showWeaponPic"; }; class PriWeaponPic { idc = 15012; x = 0.305; y = 0.258; w = 0.22; h = 0.22; text = ""; lineSpacing = 0; type = 0; style = 48; colorText[] = {0.75, 0.75, 0.75, 1}; colorBackground[] = {0, 0, 0, 0}; font = "Bitstream"; sizeEx = 0.025; soundClick[] = {"ui\ui_ok", 0.2, 1}; soundEnter[] = {"ui\ui_over", 0.2, 1}; soundEscape[] = {"ui\ui_cc", 0.2, 1}; soundPush[] = {"", 0.2, 1}; }; class SecWeaponPic : RscPicture { idc = 15013; x = 0.305; y = 0.258+ 0.2; w = 0.22; h = 0.22; text = ""; }; class PistolWeaponPic : RscPicture { idc = 15014; x = 0.555 +0.04; y = 0.258 + 0.25; w = 0.11; h = 0.11; text = ""; }; class Goggle1 : RscPicture { idc = 15015; x = 0.555; y = (0.258+0.11)-0.04; w = 0.08; h = 0.08; text = ""; }; class Goggle2 : RscPicture { idc = 15016; x = 0.555 + 0.08 + 0.02; y = (0.258+0.11)-0.04; w = 0.08; h = 0.08; text = ""; }; class MSlot1 : RscPicture { idc = 15017; x = 0.305; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot2 : RscPicture { idc = 15018; x = 0.355; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot3 : RscPicture { idc = 15019; x = 0.405; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot4 : RscPicture { idc = 15020; x = 0.455; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot5 : RscPicture { idc = 15021; x = 0.505; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot6 : RscPicture { idc = 15022; x = 0.555; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot7 : RscPicture { idc = 15023; x = 0.605; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot8 : RscPicture { idc = 15024; x = 0.655; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot9 : RscPicture { idc = 15025; x = 0.705; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot10 : RscPicture { idc = 15026; x = 0.755; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot11 : RscPicture { idc = 15027; x = 0.805; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class MSlot12 : RscPicture { idc = 15028; x = 0.855; y = 0.7; w = 0.05; h = 0.05; text = ""; }; class PSlot1 : RscPicture { idc = 15029; x = 0.755; y = 0.328; w = 0.05; h = 0.05; text = ""; }; class PSlot2 : RscPicture { idc = 15030; x = 0.825; y = 0.328; w = 0.05; h = 0.05; text = ""; }; class PSlot3 : RscPicture { idc = 15031; x = 0.755; y = 0.428; w = 0.05; h = 0.05; text = ""; }; class PSlot4 : RscPicture { idc = 15032; x = 0.825; y = 0.428; w = 0.05; h = 0.05; text = ""; }; class PSlot5 : RscPicture { idc = 15033; x = 0.755; y = 0.528; w = 0.05; h = 0.05; text = ""; }; class PSlot6 : RscPicture { idc = 15034; x = 0.825; y = 0.528; w = 0.05; h = 0.05; text = ""; }; class PSlot7 : RscPicture { idc = 15035; x = 0.755; y = 0.628; w = 0.05; h = 0.05; text = ""; }; class PSlot8 : RscPicture { idc = 15036; x = 0.825; y = 0.628; w = 0.05; h = 0.05; text = ""; }; class ISlot1 : RscPicture { idc = 15037; x = 0.895; y = 0.328; w = 0.05; h = 0.05; text = ""; }; class ISlot2 : RscPicture { idc = 15038; x = 0.955; y = 0.328; w = 0.05; h = 0.05; text = ""; }; class ISlot3 : RscPicture { idc = 15039; x = 0.895; y = 0.428; w = 0.05; h = 0.05; text = ""; }; class ISlot4 : RscPicture { idc = 15040; x = 0.965; y = 0.428; w = 0.05; h = 0.05; text = ""; }; class ISlot5 : RscPicture { idc = 15041; x = 0.895; y = 0.528; w = 0.05; h = 0.05; text = ""; }; class ISlot6 : RscPicture { idc = 15042; x = 0.965; y = 0.528; w = 0.05; h = 0.05; text = ""; }; class ISlot7 : RscPicture { idc = 15043; x = 0.895; y = 0.628; w = 0.05; h = 0.05; text = ""; }; class ISlot8 : RscPicture { idc = 15044; x = 0.965; y = 0.628; w = 0.05; h = 0.05; text = ""; }; class WeaponName: RscText { idc = 15045; style = 0; text = ""; x = 0.205; w = 0.5; y = 0.775; SizeEx = 0.03221; }; }; Part of my Gear code. MouseOver = { // Skjekk om muspekeren er over en eksisterende controll. // detter er en workaround siden onMouseEnter, onMouseMove bare kan bli brukt en gang per dialog control. // denne funtionen blir kjørt hver gang musen blir flyttet // HUST OG SETTE RETT STØRRELSE PÅ MOUSEAREA. _x = _this select 0; _y = _this select 1; _PriwXmin = 0.305; _priwXmax = _PriwXmin + 0.22; _priwYmin = 0.258; _priwYmax = _priwYmin + 0.22; _secwXmin = 0.305; _secwXmax = _secwXmin + 0.22; _secwYmin = 0.258+ 0.2; _secwYmax = _secwYmin + 0.22; _pistXmin = 0.555 +0.04; _pistXmax = _pistXmin + 0.11; _pistYmin = 0.258 + 0.25; _pistYmax =_pistYmin + 0.11; _gog1Xmin = 0.555; _gog1Xmax = _gog1Xmin + 0.08; _gog1Ymin = (0.258+0.11)-0.04; _gog1Ymax = _gog1Ymin + 0.08; _gog2Xmin = 0.555 + 0.08 + 0.02; _gog2Xmax = _gog2Xmin + 0.08; _gog2Ymin = (0.258+0.11)-0.04; _gog2Ymax = _gog1Ymin + 0.08; _ms1Xmin = 0.305;_ms1Xmax = _ms1Xmin + 0.05; _ms1Ymin = 0.7;_ms1Ymax = _ms1Ymin + 0.05; _ms2Xmin = 0.355;_ms2Xmax = _ms2Xmin + 0.05; _ms2Ymin = 0.7;_ms2Ymax = _ms2Ymin + 0.05; _ms3Xmin = 0.405;_ms3Xmax = _ms3Xmin + 0.05; _ms3Ymin = 0.7;_ms3Ymax = _ms3Ymin + 0.05; _ms4Xmin = 0.455;_ms4Xmax = _ms4Xmin + 0.05; _ms4Ymin = 0.7;_ms4Ymax = _ms4Ymin + 0.05; _ms5Xmin = 0.505;_ms5Xmax = _ms5Xmin + 0.05; _ms5Ymin = 0.7;_ms5Ymax = _ms5Ymin + 0.05; _ms6Xmin = 0.555;_ms6Xmax = _ms6Xmin + 0.05; _ms6Ymin = 0.7;_ms6Ymax = _ms6Ymin + 0.05; _ms7Xmin = 0.605;_ms7Xmax = _ms7Xmin + 0.05; _ms7Ymin = 0.7;_ms7Ymax = _ms7Ymin + 0.05; _ms8Xmin = 0.655;_ms8Xmax = _ms8Xmin + 0.05; _ms8Ymin = 0.7;_ms8Ymax = _ms8Ymin + 0.05; _ms9Xmin = 0.705;_ms9Xmax = _ms9Xmin + 0.05; _ms9Ymin = 0.7;_ms9Ymax = _ms9Ymin + 0.05; _ms10Xmin = 0.755;_ms10Xmax = _ms10Xmin + 0.05; _ms10Ymin = 0.7;_ms10Ymax = _ms10Ymin + 0.05; _ms11Xmin = 0.805;_ms11Xmax = _ms11Xmin + 0.05; _ms11Ymin = 0.7;_ms11Ymax = _ms11Ymin + 0.05; _ms12Xmin = 0.855;_ms12Xmax = _ms12Xmin + 0.05; _ms12Ymin = 0.7;_ms12Ymax = _ms12Ymin + 0.05; _ps1Xmin = 0.755;_ps1Xmax = _ps1Xmin + 0.05; _ps1Ymin = 0.328;_ps1Ymax = _ps1Ymin + 0.05; _ps2Xmin = 0.825;_ps2Xmax = _ps2Xmin + 0.05; _ps2Ymin = 0.328;_ps2Ymax = _ps2Ymin + 0.05; _ps3Xmin = 0.755;_ps3Xmax = _ps3Xmin + 0.05; _ps3Ymin = 0.428;_ps3Ymax = _ps3Ymin + 0.05; _ps4Xmin = 0.825;_ps4Xmax = _ps4Xmin + 0.05; _ps4Ymin = 0.428;_ps4Ymax = _ps4Ymin + 0.05; _ps5Xmin = 0.755;_ps5Xmax = _ps5Xmin + 0.05; _ps5Ymin = 0.528;_ps5Ymax = _ps5Ymin + 0.05; _ps6Xmin = 0.825;_ps6Xmax = _ps6Xmin + 0.05; _ps6Ymin = 0.528;_ps6Ymax = _ps6Ymin + 0.05; _ps7Xmin = 0.755;_ps7Xmax = _ps7Xmin + 0.05; _ps7Ymin = 0.628;_ps7Ymax = _ps7Ymin + 0.05; _ps8Xmin = 0.825;_ps8Xmax = _ps8Xmin + 0.05; _ps8Ymin = 0.628;_ps8Ymax = _ps8Ymin + 0.05; _is1Xmin = 0.895;_is1Xmax = _is1Xmin + 0.05; _is1Ymin = 0.328;_is1Ymax = _is1Ymin + 0.05; _is2Xmin = 0.955;_is2Xmax = _is2Xmin + 0.05; _is2Ymin = 0.328;_is2Ymax = _is2Ymin + 0.05; _is3Xmin = 0.895;_is3Xmax = _is3Xmin + 0.05; _is3Ymin = 0.428;_is3Ymax = _is3Ymin + 0.05; _is4Xmin = 0.955;_is4Xmax = _is4Xmin + 0.05; _is4Ymin = 0.428;_is4Ymax = _is4Ymin + 0.05; _is5Xmin = 0.895;_is5Xmax = _is5Xmin + 0.05; _is5Ymin = 0.528;_is5Ymax = _is5Ymin + 0.05; _is6Xmin = 0.955;_is6Xmax = _is6Xmin + 0.05; _is6Ymin = 0.528;_is6Ymax = _is6Ymin + 0.05; _is7Xmin = 0.895;_is7Xmax = _is7Xmin + 0.05; _is7Ymin = 0.628;_is7Ymax = _is7Ymin + 0.05; _is8Xmin = 0.955;_is8Xmax = _is8Xmin + 0.05; _is8Ymin = 0.628;_is8Ymax = _is8Ymin + 0.05; _priw = ctrlText 15012; _secw = ctrlText 15013; _pist = ctrlText 15014; _gog1 = ctrlText 15015; _gog2 = ctrlText 15016; _ms1 = ctrlText 15017; _ms2 = ctrlText 15018; _ms3 = ctrlText 15019; _ms4 = ctrlText 15020; _ms5 = ctrlText 15021; _ms6 = ctrlText 15022; _ms7 = ctrlText 15023; _ms8 = ctrlText 15024; _ms9 = ctrlText 15025; _ms10 = ctrlText 15026; _ms11 = ctrlText 15027; _ms12 = ctrlText 15028; _ps1 = ctrlText 15029; _ps2 = ctrlText 15030; _ps3 = ctrlText 15031; _ps4 = ctrlText 15032; _ps5 = ctrlText 15033; _ps6 = ctrlText 15034; _ps7 = ctrlText 15035; _ps8 = ctrlText 15036; _is1 = ctrlText 15037; _is2 = ctrlText 15038; _is3 = ctrlText 15039; _is4 = ctrlText 15040; _is5 = ctrlText 15041; _is6 = ctrlText 15042; _is7 = ctrlText 15043; _is8 = ctrlText 15044; _indx = lbCurSel 15011; _wep = player getvariable "WeaponsKit"; _kit = _wep select _indx; _pri = _kit select 0; _sec = _kit select 1; _pis = _kit select 2; _gog = _kit select 3; _mag = _kit select 4; _pmag = _kit select 5; _itm = _kit select 6; switch (true) do { case (((_x > _priwXmin) && (_x < _priwXmax)) && ((_y > _priwYmin) && (_y < _priwYmax))) : { if (_priw != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_pri) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _secwXmin) && (_x < _secwXmax)) && ((_y > _secwYmin) && (_y < _secwYmax))) : { if (_secw != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_sec) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _pistXmin) && (_x < _pistXmax)) && ((_y > _pistYmin) && (_y < _pistYmax))) : { if (_pist != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_pis) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _gog1Xmin) && (_x < _gog1Xmax)) && ((_y > _gog1Ymin) && (_y < _gog1Ymax))) : { if (_gog1 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_gog select 0) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _gog2Xmin) && (_x < _gog2Xmax)) && ((_y > _gog2Ymin) && (_y < _gog2Ymax))) : { if (_gog2 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_gog select 1) >> 'displayName');ctrlSetText [15045, _disp];}; }; //************************************************************************************* // show mag primary weapon & sec + batteries names case (((_x > _ms1Xmin) && (_x < _ms1Xmax)) && ((_y > _ms1Ymin) && (_y < _ms1Ymax))) : { if (_ms1 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 0) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms2Xmin) && (_x < _ms2Xmax)) && ((_y > _ms2Ymin) && (_y < _ms2Ymax))) : { if (_ms2 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 1) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms3Xmin) && (_x < _ms3Xmax)) && ((_y > _ms3Ymin) && (_y < _ms3Ymax))) : { if (_ms3 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 2) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms4Xmin) && (_x < _ms4Xmax)) && ((_y > _ms4Ymin) && (_y < _ms4Ymax))) : { if (_ms4 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 3) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms5Xmin) && (_x < _ms5Xmax)) && ((_y > _ms5Ymin) && (_y < _ms5Ymax))) : { if (_ms5 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 4) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms6Xmin) && (_x < _ms6Xmax)) && ((_y > _ms6Ymin) && (_y < _ms6Ymax))) : { if (_ms6 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 5) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms7Xmin) && (_x < _ms7Xmax)) && ((_y > _ms7Ymin) && (_y < _ms7Ymax))) : { if (_ms7 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 6) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms8Xmin) && (_x < _ms8Xmax)) && ((_y > _ms8Ymin) && (_y < _ms8Ymax))) : { if (_ms8 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 7) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms9Xmin) && (_x < _ms9Xmax)) && ((_y > _ms9Ymin) && (_y < _ms9Ymax))) : { if (_ms9 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 8) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms10Xmin) && (_x < _ms10Xmax)) && ((_y > _ms10Ymin) && (_y < _ms10Ymax))) : { if (_ms10 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 9) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms11Xmin) && (_x < _ms11Xmax)) && ((_y > _ms11Ymin) && (_y < _ms11Ymax))) : { if (_ms11 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 10) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ms12Xmin) && (_x < _ms12Xmax)) && ((_y > _ms12Ymin) && (_y < _ms12Ymax))) : { if (_ms12 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_mag select 11) >> 'displayName');ctrlSetText [15045, _disp];}; }; //************************************************************************************* // show pistol mag & launcher grenades case (((_x > _ps1Xmin) && (_x < _ps1Xmax)) && ((_y > _ps1Ymin) && (_y < _ps1Ymax))) : { if (_ps1 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 0) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps2Xmin) && (_x < _ps2Xmax)) && ((_y > _ps2Ymin) && (_y < _ps2Ymax))) : { if (_ps2 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 1) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps3Xmin) && (_x < _ps3Xmax)) && ((_y > _ps3Ymin) && (_y < _ps3Ymax))) : { if (_ps3 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 2) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps4Xmin) && (_x < _ps4Xmax)) && ((_y > _ps4Ymin) && (_y < _ps4Ymax))) : { if (_ps4 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 3) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps5Xmin) && (_x < _ps5Xmax)) && ((_y > _ps5Ymin) && (_y < _ps5Ymax))) : { if (_ps5 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 4) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps6Xmin) && (_x < _ps6Xmax)) && ((_y > _ps6Ymin) && (_y < _ps6Ymax))) : { if (_ps6 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 5) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps7Xmin) && (_x < _ps7Xmax)) && ((_y > _ps7Ymin) && (_y < _ps7Ymax))) : { if (_ps7 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 6) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _ps8Xmin) && (_x < _ps8Xmax)) && ((_y > _ps8Ymin) && (_y < _ps8Ymax))) : { if (_ps8 != "") then {_disp = getText(configFile >> 'CfgMagazines' >> (_pmag select 7) >> 'displayName');ctrlSetText [15045, _disp];}; }; //************************************************************************************* // show iteams such as map, clock etc etc case (((_x > _is1Xmin) && (_x < _is1Xmax)) && ((_y > _is1Ymin) && (_y < _is1Ymax))) : { if (_is1 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 0) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is2Xmin) && (_x < _is2Xmax)) && ((_y > _is2Ymin) && (_y < _is2Ymax))) : { if (_is2 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 1) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is3Xmin) && (_x < _is3Xmax)) && ((_y > _is3Ymin) && (_y < _is3Ymax))) : { if (_is3 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 2) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is4Xmin) && (_x < _is4Xmax)) && ((_y > _is4Ymin) && (_y < _is4Ymax))) : { if (_is4 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 3) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is5Xmin) && (_x < _is5Xmax)) && ((_y > _is5Ymin) && (_y < _is5Ymax))) : { if (_is5 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 4) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is6Xmin) && (_x < _is6Xmax)) && ((_y > _is6Ymin) && (_y < _is6Ymax))) : { if (_is6 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 5) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is7Xmin) && (_x < _is7Xmax)) && ((_y > _is7Ymin) && (_y < _is7Ymax))) : { if (_is7 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 6) >> 'displayName');ctrlSetText [15045, _disp];}; }; case (((_x > _is8Xmin) && (_x < _is8Xmax)) && ((_y > _is8Ymin) && (_y < _is8Ymax))) : { if (_is8 != "") then {_disp = getText(configFile >> 'CfgWeapons' >> (_itm select 7) >> 'displayName');ctrlSetText [15045, _disp];}; }; default {ctrlSetText [15045,""];}; }; }; now this may looks like utterly bullshit. but what i basicly do here is that i check the mouseposition and if its over one of the picture controls. it displays the name of the item in that picture in a nother text control. if your talking about scaling the dialog to small/big size. well. i'll just tell you this. you got a lot of work ahead of you in that case. thats no easy task. i took me a while with armapod to get it right, i suggest you rip apart my old armapod project in that case. Edited November 8, 2010 by nuxil Share this post Link to post Share on other sites
raptor 6 actual 13 Posted November 8, 2010 Ok, thanks again. I'll look into it some more. If it's a matter of a lot of work, I'm ok with that. I know this can be done, your ArmApod is proof of that, and even after seeing things like the concert lights and stage in the things you're working on thread, I'm sure just about anything is possible thanks to the tools and the people in the modding community. So, I'll keep looking into it, and if I make any progress, I'll post it, and IF I don't, I'll post that also. Share this post Link to post Share on other sites