f2k sel 164 Posted June 3, 2014 I have a working custom menu and I can get the greyed out actions or remove the line but only as long as I use system variables. Whenever I try using my own variable they work but only for the first run, after that they can't be changed. The question is how to get it to refresh. Purchase = [ ["Purchase",true], [((veh select 0) select 1),[2],"",-5,[["expression","nul=[1200, 'B_MBT_01_TUSK_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1",missionnamespace getvariable ["myvar","0"] ], [((veh select 1) select 1),[3],"",-5,[["expression","nul=[900, 'B_APC_Tracked_01_rcws_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1",if (myvar == "0") then {"1"} else {"0"}], [((veh select 2) select 1),[4],"",-5,[["expression","nul=[700, 'B_APC_Tracked_01_AA_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1","CursorOnGround"], [((veh select 3) select 1),[5],"",-5,[["expression","nul=[500, 'I_APC_Wheeled_03_cannon_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1","CursorOnEmptyVehicle"], [((veh select 4) select 1),[6],"",-5,[["expression","nul=[1100, 'B_MBT_01_mlrs_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"CursorOnGround","0"] ]; 1. only works once 2. only works once 3. works 4. works 5. works 1 and 2 are custom conditions and are not updating. I've also seen a couple of example which I now can't find of people using an If statement and two versions of the same line if (test) then { ["If test 1", [7], "", -5, [["expression", "hint str time"]], "1", "1"] } else { ["If tests 0", [8], "", -5, [["expression", "hint str time"]], "1", "0"] } However it still won't work as I still don't think it's being refreshed. Any Ideas on this one. Share this post Link to post Share on other sites
albertfish 11 Posted June 3, 2014 Have you tried formatting the condition as a string? [((veh select 0) select 1),[2],"",-5,[["expression","nul=[1200, 'B_MBT_01_TUSK_F'] execVM 'ObjectPositionAndDirectionD.sqf'"]],"1","missionnamespace getvariable ['myvar','0']" ], Share this post Link to post Share on other sites
f2k sel 164 Posted June 3, 2014 (edited) Cheers alberfish. I did make an attempt but I'm not sure I did it right, Format is not something I understand fully. Would it be just format or compile format? My other thought was is that it's an array which is called when needed so to update it it would need to change the correct element. if I wanted to change the fifth command and the condition I think the path would be ((Purchase select 5) select 6) select 6; How would the be done using Purchase set [path, "0"]; Edited June 3, 2014 by F2k Sel Share this post Link to post Share on other sites
albertfish 11 Posted June 3, 2014 You have to break it down by each depth of the array. _array1 = purchase select 5; _array2 = _array1 select 6; _array3 = _array2 select 6; _array3 set [6, "0"]; _array2 set[6, _array3]; _array1 set[5, _array2]; Also, are you using addaction with these actions? Share this post Link to post Share on other sites
f2k sel 164 Posted June 3, 2014 (edited) Thanks I'll give it a try and see what happens. Currently I'm not using addaction. Yea, thanks it's working now and it wasn't even deeply nested as I thought, I was over complicating it. So if anyone needs to use the grey out it's as follows _array1 = purchase select 2;// first line menu item _array1 set[6, "1"];// change grey out status showCommandingMenu "#USER:Purchase";// update menu only needed if you need it to update while open Edited June 3, 2014 by F2k Sel Share this post Link to post Share on other sites
BEAKSBY 11 Posted June 4, 2014 Thanks F2k Sel & albertfish, it works great! I posted my script below that employs this active or greyed out option depending on whether the player has enough money (DNA_money) to puchase the vehicle. I was using a MP money script provided by DNA_UK. The next step is to find a algorithmic solution to repeating this for all ivehicles listed in the menus. (I.e. There will be about 15 items to purchase). /* This script will create a custom menu, and display it once. Resources: https://community.bistudio.com/wiki/showCommandingMenu https://resources.bisimulations.com/w/index.php?title=Custom_Command_Menus http://forums.bistudio.com/showthread.php?178609-How-do-you-update-custom-menu */ _text1 = parseText format ["<img size='1' shadow='5' image='SlammerUp1_CA.paa'/> <t color='#00dd00' t size='1'> M2A4 Slammer UP $1200</t>"]; _text2 = parseText format ["<img size='1' shadow='5' image='SlammerUp1_CA.paa'/> <t color='#00dd00' t size='1'> AT AFV Gorgon $900</t>"]; _text3 = parseText format ["<img size='1' shadow='5' image='SlammerUp1_CA.paa'/> <t color='#00dd00' t size='1'> AA IVC Cheetah $700</t>"]; _text4 = parseText format ["<img size='1' shadow='5' image='SlammerUp1_CA.paa'/> <t color='#00dd00' t size='1'> APC Marshall $500</t>"]; MY_SUBMENU_inCommunication = [ ["MOTOR POOL",true], [_text1, [2], "", -5, [["expression", "[1200, ""B_MBT_01_TUSK_F""] execVM ""ObjectPositionAndDirectionD.sqf""; "]], "1", missionnamespace getvariable ["tankActive","1"] ], [_text2, [3], "", -5, [["expression", "[900, ""B_APC_Tracked_01_rcws_F""] execVM ""ObjectPositionAndDirectionD.sqf""; "]], "1", "1"], [_text3, [4], "", -5, [["expression", "[700, ""B_APC_Tracked_01_AA_F""] execVM ""ObjectPositionAndDirectionD.sqf""; "]], "1", "1"], [_text4, [5], "", -5, [["expression", "[500, ""I_APC_Wheeled_03_cannon_F""] execVM ""ObjectPositionAndDirectionD.sqf""; "]], "1", "1"] ]; if (DNA_Money >= 1200) then { tankActive = 1} else {tankActive = 0}; // if (DNA_Money <= 1200) then {hint "You don't have enough money."}; // hint format["Status of tankActive is %1",str tankActive]; // A CHECK TO CONFIRM THE STATUS OF "tankActive" _array1 = MY_SUBMENU_inCommunication select 1;// first line menu item _array1 set[6, str tankActive];// change grey out status showCommandingMenu "#USER:MY_SUBMENU_inCommunication"; // update menu only needed if you need it to update while open MY_SUBMENU2_inCommunication = [ ["ARMORY",true], ["Option-1", [2], "", -5, [["expression", "player sidechat ""-1"" "]], "0", "0", "\ca\ui\data\cursor_support_ca"], ["Option 0", [3], "", -5, [["expression", "player sidechat "" 0"" "]], "1", "0", "\ca\ui\data\cursor_support_ca"], ["Option 1", [4], "", -5, [["expression", "player sidechat "" 1"" "]], "1", "CursorOnGround", "\ca\ui\data\cursor_support_ca"] ]; MY_SUBMENU3_inCommunication = [ ["RADIO TOWER",true], ["Option-1", [2], "", -5, [["expression", "player sidechat ""-1"" "]], "0", "0", "\ca\ui\data\cursor_support_ca"], ["Option 0", [3], "", -5, [["expression", "player sidechat "" 0"" "]], "1", "0", "\ca\ui\data\cursor_support_ca"], ["Option 1", [4], "", -5, [["expression", "player sidechat "" 1"" "]], "1", "CursorOnGround", "\ca\ui\data\cursor_support_ca"] ]; _RADIO_TOWER_ACTIVATE = 1; // CAN CHANGE TO 1 or 0 IF CONDITIONS ARE MET MY_SUBMENU4_inCommunication = [ ["REINFORCEMENTS",true], ["Option-1", [2], "", -5, [["expression", "player sidechat ""-1"" "]], "0", "0", "\ca\ui\data\cursor_support_ca"], ["Option 0", [3], "", -5, [["expression", "player sidechat "" 0"" "]], "1", "0", "\ca\ui\data\cursor_support_ca"], ["Option 1", [4], "", -5, [["expression", "player sidechat "" 1"" "]], "1", "CursorOnGround", "\ca\ui\data\cursor_support_ca"] ]; MY_MENU_inCommunication = [ ["DESTRUCTION MENU",true], ["MOTOR POOL", [2], "#USER:MY_SUBMENU_inCommunication", -5, [["expression", "player sidechat ""Order Vehicles"" "]], "1", "1"], ["ARMORY", [3], "#USER:MY_SUBMENU2_inCommunication", -5, [["expression", "player sidechat ""Order Emplacements"" "]], "1", "0"], ["RADIO TOWER", [4], "#USER:MY_SUBMENU3_inCommunication", -5, [["expression", "player sidechat ""CALL IN SUPPORT"" "]], "1", "_RADIO_TOWER_ACTIVATE"], ["REINFORCEMENTS", [5], "#USER:MY_SUBMENU4_inCommunication", -5, [["expression", "player sidechat ""CALL IN PARATROOPERS"" "]], "1", "1"] ]; showCommandingMenu "#USER:MY_MENU_inCommunication"; Share this post Link to post Share on other sites
f2k sel 164 Posted June 4, 2014 I already have that sorted, when you increase the money you need to update the the menu, however you only need it to visibly show the updated menu when the menu is opened. That's also working fine. I've only tested on a single menu, I'd like to test it on more than one menu and see if I can find which submenu is open automatically, there is a command for this I just haven't had time to test it with the code. So many things to do so little time, I need another hour or two tonight and then I'll send you an example BEAKSBY Share this post Link to post Share on other sites
BEAKSBY 11 Posted June 4, 2014 I've only tested on a single menu, I'd like to test it on more than one menu and see if I can find which submenu is open automatically, there is a command for this I just haven't had time to test it with the code. So many things to do so little time, I need another hour or two tonight and then I'll send you an example BEAKSBY I did a bit more work last night and created the entire MOTOR POOL sub-menu with conditions based on each item's varying price, so a certain vehicle will be active only if you have enough money. I have about 7 or 8 different vehicles listed with different prices each. They all work fine with the MP money script I'm using. I will continue with the remaining sub-menus like the ARMORY for static weapon emplacements, RADIO TOWER to call in supports and REINFORCEMENTS to call in paratroopers, all based on money criteria. The other criteria I have to now add is: If you have captured the MOTOR POOL sector (from the sectors module) and have enough money then the vehicle will be active in the menu list. This does not seem too hard to do. Finally, I will have to create a separate CUSTOM MENU for OPPFOR side as they will have different vehicles, emplacements ...etc. I'll post my progress here. Share this post Link to post Share on other sites
f2k sel 164 Posted June 4, 2014 BEAKSBY How are you openeing the MY_MENU_inCommunication menus, it opens once for me but after that when I call it again it instantly shuts down. showCommandingMenu "#USER:MY_MENU_inCommunication"; Also pressing 0 8 has no effect and doesn't open the Menu. I do have it working but I'm just wondering how your doing it. Share this post Link to post Share on other sites
BEAKSBY 11 Posted June 4, 2014 I'll send it to you tonight 10PMish EST with more details...currently I'm at work and don't have acccess to my ARMA files...sigh. Share this post Link to post Share on other sites