DCS func addSubMenu

From DCS World Wiki - Hoggitworld.com
Revision as of 21:39, 11 January 2024 by Grimes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Scripting Root

Envrioment: Mission Scripting
Function: addSubMenu Added with: 1.2.4
Member Of: missionCommands
Syntax: table missionCommands.addSubMenu(string name , table path)
Description: Creates a submenu of a specified name for all players. Can be used to create nested sub menues. If the path is not specified, submenu is added to the root menu.


Return Value: table
Return Example: The following is a submenu named "SubMenuInRoot" that resides in the root of the F10 menu.
 {
   [1] = "SubMenuInRoot",
 }
Examples: The following creates a submenu named "Request Asset" and fills it with 3 options "SEAD", "CAS", and "CAP".
 local requestM = missionCommands.addSubMenu('Request Asset')
 local rSead = missionCommands.addCommand('SEAD', requestM, doRequestFunction, {type = "SEAD"})
 local rCAS = missionCommands.addCommand('CAS', requestM, doRequestFunction, {type = "CAS"})
 local rCAP= missionCommands.addCommand('CAP', requestM, doRequestFunction, {type = "CAP"})

An example of how to create nested submenus...

 local subR = missionCommands.addSubMenu('Root SubMenu')
 local subN1 = missionCommands.addSubMenu('SubMenu within RootSubmenu', subR)
 local subN2 = missionCommands.addSubMenu('we must go deeper', subN1)
 local subN3 = missionCommands.addSubMenu('Go take a UX class', subN2)
Related Functions: missionCommands Functions: addCommand, addSubMenu, removeItem, addCommandForCoalition, addSubMenuForCoalition, removeItemForCoalition, addCommandForGroup, addSubMenuForGroup, removeItemForGroup
Notes: