karpiyon Posted May 6, 2021 Posted May 6, 2021 (edited) Hi, Can I set a default F10 command? When I create a mission, I use missionCommands.addCommandForGroup or addSubMenu to add my own commands. I want to set a default command which will always be present regardless of the mission I fly without the need to add it specifically to the mission itself. Can this be done? Is there anywhere I can add this command so that it will always be available? Edited May 6, 2021 by karpiyon
cfrag Posted May 6, 2021 Posted May 6, 2021 Since addCommand needs a callback (i.e. something specific) I don't think you can do it on a global basis unless you install a mod, or modify the central mission lua script. So yes, it can be done, but it would be specific to your install, will probably need re-doing on every update, and may break the integrity check.
karpiyon Posted May 6, 2021 Author Posted May 6, 2021 Thanks, That is good enough. Is there anywhere I can see an example of how to do this? Which file exactly to alter, where and how to add the command. e.g. Add a default menu item which will always call myTestFunction(). Thanks
cfrag Posted May 6, 2021 Posted May 6, 2021 You can try and patch any lua script that you know loads - e.g. autextec.lua or missionscripting.lua. I don't recommend it, and you must also ensure that myTestFunction also loads - meaning it'll have to be implemented or required in the same file that you patch.
karpiyon Posted May 6, 2021 Author Posted May 6, 2021 (edited) Any idea how I do that? I need to add to and existing F10 menu item or create a new one. I tried to add it in: ...DCS World\Scripts\UI\RadioCommandDialogPanel\RadioCommandDialogsPanel.lua as shown below, replacing the item with my own but that does not work. It corrupts the radio menus completely and no menu is displayed. janjanMenuItem = { name = _('JanJan menu'), items = { [1] = {name = _("Phrases"), command = sendMessage.new("janjan") } } } menus = {}, menuOther = { --Misson command menu name = _('Other'), submenu = { name = _('Other'), --items = {} <= replacing this items = {janjanMenuItem} } }, Any suggestion how to do it? If this is not the way, perhaps I can manually add :missionCommands.addSubMenu but the question is where do I plant it to be loaded for all missions. Edited May 6, 2021 by karpiyon
Recommended Posts