AKA_Clutter Posted June 19, 2024 Posted June 19, 2024 Hi, I need a lot of help with this function, primarily revolving around the "path" argument. I am working with a mission that was originally setup by someone else in our squad. It is setup to automatically generate a F10 "Other" menu dynamically, based on a naming scheme. the naming scheme Root_Name1!Name2!Name 3! etc. with the "!" as the delimiter. I want to add a menu item about 3 levels down. I have tried recreating the "path as local subR = missionCommands.addSubMenu('Wargame Assets') local subN1 = missionCommands.addSubMenu('Helicoptor', subR) local subN2 = missionCommands.addSubMenu('Ground Range', subN1) local menuID = missionCommands.addSubMenuForCoalition('2' , 'Scout Recon Missions', subN2) The results of this is two "Wargame Assests" under the F10 "Other" menu, and neither works properly. Any ideas on how to do this, or IF it can be done? TIA ---------------- AKA_Clutter Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080 FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.
cfrag Posted June 21, 2024 Posted June 21, 2024 (edited) On 6/19/2024 at 8:24 PM, AKA_Clutter said: The results of this is two "Wargame Assests" under the F10 "Other" menu, and neither works properly. If I read you correctly what you are trying to do is attach your own menu to an existing sub-menu that was created by some other script, and you do not have access to that script's 'root' table. All you can go by is the 'path', and you attempt to access a previously created menu by re-creating said path. I'm afraid, from what I have seen of DCS's command API, it is impossible to do that without having access to the existing roots to attach your own menu. In other words: if you already have an F-10 Other sub-menu "My Stuff", and then invoke missionCommand.addSubMenu("MyStuff"), you aren't returned the path to existing "My Stuff", but DCS blithely creates a new, identically menu "My Stuff" in F-10, returning you a new 'path' to that entry. That is why you end up with two separate menus to "Wargame Assets". So what you need to do is get the menu root three levels down from the script that created that menu, and then add your own submenu to that. Until there is an accessor function getRootForPath() or similar, you are SOL otherwise. Edited June 21, 2024 by cfrag
AKA_Clutter Posted June 22, 2024 Author Posted June 22, 2024 18 hours ago, cfrag said: If I read you correctly what you are trying to do is attach your own menu to an existing sub-menu that was created by some other script, and you do not have access to that script's 'root' table. All you can go by is the 'path', and you attempt to access a previously created menu by re-creating said path. Yeap, you read my question 100% correct. And I suspect that your answer would be the answer. I have the script that generate the F10 menu. The person in our squad used something called "automan" and it appears to generate the menu items. I know enough lua/scripting to get into trouble. I will take another look and see if I can figure out where to insert my submenu. Thanks for the response and help. Now to dig myself a deeper hole. ---------------- AKA_Clutter Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080 FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.
Solution AKA_Clutter Posted August 28, 2024 Author Solution Posted August 28, 2024 OK, found the solution to this problem. I think @cfrag hit on the answer with the "root table" mention. I know the names of the levels and as such I think that is all I needed. See this thread ---------------- AKA_Clutter Win 10 Pro, Intel i7 12700k @4.6 GHz, EVGA RTX 3080 FTW, Ultra 64 GB G.Skill DDR4 3600 RAM, Acer 27" flat screen, HP Reverb G2, TM Warthog HOTAS with Virpil warBRD base, MFG Rudder Pedals, Virpil TCS Rotor Base with AH-64Dcollective, TrackIR 5 Pro w/Vector Expansion, PointCTRL.
Recommended Posts