MechSlayer 18 Posted February 12, 2019 class taximetro: RscButton { idc = 1600; onMouseButtonClick = "closeDialog 1; createDialog 'interfazTaximetro'; ctrlSetText [1001, format ['%1', Dinero]];"; text = "Taximetro"; //--- ToDo: Localize; x = 0.040674 * safezoneW + safezoneX; y = 0.90607 * safezoneH + safezoneY; w = 0.0787416 * safezoneW; h = 0.0420073 * safezoneH; }; I want this to be created only if a condition is true. How can i make it? Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 Two choices: Create it using ctrlCreate command or just hide your current one until ready. https://community.bistudio.com/wiki/ctrlCreate https://community.bistudio.com/wiki/ctrlShow These will get you started. Easier to create some display init function which you have in onLoad at top. Maybe some switch case to select which display, etc... Set initial state to hidden. https://community.bistudio.com/wiki/switch_do Try first, if you get stuck, let me know and I'll provide further help. 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 Thanks, I made it work with ctrlShow, but I have another question. How can I set layers? For example: The background behind a button 1 Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 Button can have its own background. Usually priority is a little hacky. Move stuff around. Background (for me at least) usually is under everything else. 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 I mean, for example: I have 4 buttons and an image as background, the 4 buttons must be layer 1 and the image layer 0 Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 So the background is over the buttons? Weird. Add that to controlsBackground instead. class controlsBackground { }; class controls { }; 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 Thanks! One last question, how can I change the opacity of a picture? Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 https://community.bistudio.com/wiki/ctrlSetFade Don't think this will cut it. Try changing last value in colorBackground[] like so: colorBackground[] = {0, 0, 0, 0.25}; Brain not working at the moment. Haha. Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 Where do I put that? Inside the picutre RcsClass ? Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 Can you show me what you got already please? 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 class Taximetro { idd = -1; class controls { class taximetro: RscButton { idc = 1600; onMouseButtonClick = "closeDialog 1; createDialog 'interfazTaximetro'; ctrlSetText [1000, '0'];"; text = "Taximetro"; //--- ToDo: Localize; x = 0.040674 * safezoneW + safezoneX; y = 0.90607 * safezoneH + safezoneY; w = 0.0787416 * safezoneW; h = 0.0420073 * safezoneH; }; }; }; class interfazTaximetro { idd = -1; class controlsBackground { class RscPicture_1200: RscPicture { idc = 1200; text = "hud.paa"; x = 0.257213 * safezoneW + safezoneX; y = 0.205949 * safezoneH + safezoneY; w = 0.492135 * safezoneW; h = 0.560097 * safezoneH; }; }; class controls { class Contador: RscText { idc = 1000; x = 0.270337 * safezoneW + safezoneX; y = 0.219951 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; colorBackground[] = {0,0,0,0.5}; }; class iniciarContador: RscButton { idc = 1600; text = "Iniciar"; //--- ToDo: Localize; onMouseButtonClick = "Contando = true; call Taxi_fnc_contador;"; x = 0.270337 * safezoneW + safezoneX; y = 0.373978 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; class Tarifa1: RscButton { idc = 1601; text = "Tarifa 1"; //--- ToDo: Localize; onMouseButtonClick = "Tarifa1 = true; Tarifa2 = false; Tarifa3 = false;"; x = 0.440944 * safezoneW + safezoneX; y = 0.219951 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; class Tarifa2: RscButton { idc = 1602; text = "Tarifa 2"; //--- ToDo: Localize; onMouseButtonClick = "Tarifa1 = false; Tarifa2 = true; Tarifa3 = false;"; x = 0.440944 * safezoneW + safezoneX; y = 0.331971 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; class Tarifa3: RscButton { idc = 1603; text = "Tarifa 3"; //--- ToDo: Localize; onMouseButtonClick = "Tarifa1 = false; Tarifa2 = false; Tarifa3 = true;"; x = 0.440944 * safezoneW + safezoneX; y = 0.44399 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; class pararContador: RscButton { idc = 1604; text = "Parar"; //--- ToDo: Localize; onMouseButtonClick = "Contando = false;"; x = 0.335955 * safezoneW + safezoneX; y = 0.373978 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; class contadorReiniciar: RscButton { idc = 1605; text = "Reiniciar"; //--- ToDo: Localize; onMouseButtonClick = "Dinero = 0; Inicio = 0; ctrlSetText [1000, '0'];"; x = 0.303146 * safezoneW + safezoneX; y = 0.485998 * safezoneH + safezoneY; w = 0.0524944 * safezoneW; h = 0.0700121 * safezoneH; }; }; }; Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 class image : RscPicture { idc = 100; /* x y w h values, etc */ colorText[] = {1, 1, 1, 0.5}; // 1 = fully visible and 0 = fully transparent }; 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 Nope, it didn't work. Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 Uhm. Does for me ? What image you using? class image : RscPicture { idc = 1200; x = 0.257213 * safezoneW + safezoneX; y = 0.205949 * safezoneH + safezoneY; w = 0.492135 * safezoneW; h = 0.560097 * safezoneH; text = "hud.paa"; colorBackground[] = {1, 1, 1, 0.25}; }; Does this do nothing? 1 Share this post Link to post Share on other sites
MechSlayer 18 Posted February 12, 2019 Nope it didn't work This is the image: The images is visible but it's nearly invisible: Share this post Link to post Share on other sites
HazJ 1287 Posted February 12, 2019 Review your image size. Also, I meant colorText not colorBackground, my bad. class test { idd = 12345; movingEnable = 1; class controlsBackground { class image : RscPicture { idc = 1200; x = 0.257213 * safezoneW + safezoneX; y = 0.205949 * safezoneH + safezoneY; w = 0.492135 * safezoneW; h = 0.560097 * safezoneH; text = "image.paa"; colorText[] = {1, 1, 1, 0.25}; }; }; }; Works. 0.25 opacity. Tweak that to say 1 and you see it fully. I think what you was asking about was the fact that your image wasn't fully visible to begin with, this being due to your image size. https://community.bistudio.com/wiki/PAA_File_Format Use this and you'll see. https://hazjohnson.com/ArmA/image.paa 512x256 1 Share this post Link to post Share on other sites