mirror of
https://github.com/FlightControl-Master/MOOSE_Demos.git
synced 2025-08-15 10:37:47 +00:00
Updated Moose.lua
This commit is contained in:
parent
16f7281013
commit
095e26c2e7
Binary file not shown.
@ -1,38 +1,38 @@
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_MISSION class.
|
||||
-- We define a top menu entry, a sub menu entry and to menu commands.
|
||||
-- Both commands call the same function, but with different arguments.
|
||||
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and enter as GAME MASTER.
|
||||
-- 2. Wait for "loaded successfully" message.
|
||||
-- 3. Open menu by pressing #
|
||||
-- 4. Choose F10. Other...
|
||||
-- 5. Select F1. Menu for all players...
|
||||
-- 6. Select F1. Sub menu 1...
|
||||
-- 7. Select Cmd1
|
||||
-- 8. Repeat the same for Cmd2
|
||||
|
||||
|
||||
-- Example function
|
||||
local function execMenuCmd( name )
|
||||
MESSAGE:New( "Menu entry " .. name .. " selected", 25, "INFO" ):ToAll()
|
||||
end
|
||||
|
||||
local MenuTop = MENU_MISSION:New( "Menu for all players" )
|
||||
local MenuSub1 = MENU_MISSION:New( "Sub menu 1", MenuTop )
|
||||
MENU_MISSION_COMMAND:New( "Cmd1", MenuSub1, execMenuCmd, "Cmd1" )
|
||||
MENU_MISSION_COMMAND:New( "Cmd2", MenuSub1, execMenuCmd, "Cmd2" )
|
||||
|
||||
MESSAGE:New( "Moose Framework and Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_MISSION class.
|
||||
-- We define a top menu entry, a sub menu entry and to menu commands.
|
||||
-- Both commands call the same function, but with different arguments.
|
||||
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and enter as GAME MASTER.
|
||||
-- 2. Wait for "loaded successfully" message.
|
||||
-- 3. Open menu by pressing #
|
||||
-- 4. Choose F10. Other...
|
||||
-- 5. Select F1. Menu for all players...
|
||||
-- 6. Select F1. Sub menu 1...
|
||||
-- 7. Select Cmd1
|
||||
-- 8. Repeat the same for Cmd2
|
||||
|
||||
|
||||
-- Example function
|
||||
local function execMenuCmd( name )
|
||||
MESSAGE:New( "Menu entry " .. name .. " selected", 25, "INFO" ):ToAll()
|
||||
end
|
||||
|
||||
local MenuTop = MENU_MISSION:New( "Menu for all players" )
|
||||
local MenuSub1 = MENU_MISSION:New( "Sub menu 1", MenuTop )
|
||||
MENU_MISSION_COMMAND:New( "Cmd1", MenuSub1, execMenuCmd, "Cmd1" )
|
||||
MENU_MISSION_COMMAND:New( "Cmd2", MenuSub1, execMenuCmd, "Cmd2" )
|
||||
|
||||
MESSAGE:New( "Moose Framework and Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
|
||||
Binary file not shown.
@ -1,51 +1,51 @@
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_COALITION class.
|
||||
-- We define two top menu entries with the name "Mission phases". One for each coalition (red & blue).
|
||||
-- Also we add a COMMAND for each menu, which calls the same function.
|
||||
-- Note the different names of the menu items.
|
||||
-- Also we add one entry at the top level for coalition.side.BLUE.
|
||||
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and choose coalition Red.
|
||||
-- 2. Enter as GAME MASTER.
|
||||
-- 3. Wait for "loaded successfully" message.
|
||||
-- 4. Open menu by pressing #
|
||||
-- 5. Choose F10. Other...
|
||||
-- 6. Select F1. Mission phases...
|
||||
-- 7. Select F1. Start attack and see message.
|
||||
-- 8. Switch to coalition Blue.
|
||||
-- 9. Open menu by pressing #
|
||||
-- 10. Choose F10. Other...
|
||||
-- 11. Select F1. Mission phases...
|
||||
-- 12. Select F1. Start counter attack and see message.
|
||||
-- 13. Open menu by pressing # and select F10. Other...
|
||||
-- 14. See entry F2. Start attack of Allies and select it.
|
||||
-- 15. See the message.
|
||||
|
||||
|
||||
-- Example function
|
||||
local function execMenuCmd( side )
|
||||
MESSAGE:New( "The " .. side .. " side will start their attack phase!", 25, "INFO" ):ToAll()
|
||||
end
|
||||
|
||||
local menuRed = MENU_COALITION:New( coalition.side.RED, "Mission phases" )
|
||||
MENU_COALITION_COMMAND:New( coalition.side.RED, "Start attack", menuRed , execMenuCmd, "red" )
|
||||
|
||||
local menuBlue = MENU_COALITION:New( coalition.side.BLUE, "Mission phases" )
|
||||
MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Start counter attack", menuBlue , execMenuCmd, "blue" )
|
||||
|
||||
-- This is an example on how to place a COMMAND at top level of the menu. The third parameter must be nil.
|
||||
MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Start attack of Allies", nil , execMenuCmd, "purple" )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_COALITION class.
|
||||
-- We define two top menu entries with the name "Mission phases". One for each coalition (red & blue).
|
||||
-- Also we add a COMMAND for each menu, which calls the same function.
|
||||
-- Note the different names of the menu items.
|
||||
-- Also we add one entry at the top level for coalition.side.BLUE.
|
||||
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and choose coalition Red.
|
||||
-- 2. Enter as GAME MASTER.
|
||||
-- 3. Wait for "loaded successfully" message.
|
||||
-- 4. Open menu by pressing #
|
||||
-- 5. Choose F10. Other...
|
||||
-- 6. Select F1. Mission phases...
|
||||
-- 7. Select F1. Start attack and see message.
|
||||
-- 8. Switch to coalition Blue.
|
||||
-- 9. Open menu by pressing #
|
||||
-- 10. Choose F10. Other...
|
||||
-- 11. Select F1. Mission phases...
|
||||
-- 12. Select F1. Start counter attack and see message.
|
||||
-- 13. Open menu by pressing # and select F10. Other...
|
||||
-- 14. See entry F2. Start attack of Allies and select it.
|
||||
-- 15. See the message.
|
||||
|
||||
|
||||
-- Example function
|
||||
local function execMenuCmd( side )
|
||||
MESSAGE:New( "The " .. side .. " side will start their attack phase!", 25, "INFO" ):ToAll()
|
||||
end
|
||||
|
||||
local menuRed = MENU_COALITION:New( coalition.side.RED, "Mission phases" )
|
||||
MENU_COALITION_COMMAND:New( coalition.side.RED, "Start attack", menuRed , execMenuCmd, "red" )
|
||||
|
||||
local menuBlue = MENU_COALITION:New( coalition.side.BLUE, "Mission phases" )
|
||||
MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Start counter attack", menuBlue , execMenuCmd, "blue" )
|
||||
|
||||
-- This is an example on how to place a COMMAND at top level of the menu. The third parameter must be nil.
|
||||
MENU_COALITION_COMMAND:New( coalition.side.BLUE, "Start attack of Allies", nil , execMenuCmd, "purple" )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
|
||||
Binary file not shown.
@ -1,66 +1,66 @@
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_GROUP.
|
||||
-- We added two planes and give them different menu entries.
|
||||
-- We need a timer to check regularly if someone entered the plane.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission.
|
||||
-- 2. Enter as Plane-1.
|
||||
-- 3. Wait for "loaded successfully" message and then 5 seconds more.
|
||||
-- 4. Open menu by pressing #
|
||||
-- 5. Choose F11. Parent Menu
|
||||
-- 6. Choose F10. Other...
|
||||
-- 7. Select F2. Menu for Plane-1...
|
||||
-- 8. Select F1. Accept CAS mission and see the message.
|
||||
-- 9. Switch to Plane-2 and wait 5 seconds.
|
||||
-- 10. Open menu by pressing #
|
||||
-- 11. Choose F11. Parent Menu
|
||||
-- 12. Choose F10. Other...
|
||||
-- 13. Select F2. Menu for Plane-2...
|
||||
-- 12. Select F1. Accept BAI mission and see the message.
|
||||
|
||||
|
||||
-- Example function
|
||||
local function PrintTheTextToBlue( text )
|
||||
MESSAGE:New( text, 25, "INFO" ):ToBlue()
|
||||
end
|
||||
|
||||
-- Start a scheduler after a delay of 5 seconds and repeat it's execution very 5 seconds
|
||||
SCHEDULER:New( nil,
|
||||
function()
|
||||
-- Find both groups and save them in an object
|
||||
local PlaneGroup1 = GROUP:FindByName( "Plane-1" )
|
||||
local PlaneGroup2 = GROUP:FindByName( "Plane-2" )
|
||||
|
||||
-- Add menu for the first group
|
||||
if PlaneGroup1 and PlaneGroup1:IsAlive() then
|
||||
local MenuGroup1 = MENU_GROUP:New( PlaneGroup1, "Menu for Plane-1" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Accept CAS mission", MenuGroup1, PrintTheTextToBlue, "Plane-1 accepts the CAS mission" )
|
||||
MESSAGE:New( "Menu added to Group1.", 1, "INFO" ):ToLog()
|
||||
else
|
||||
MESSAGE:New( "Group1 is not available.", 1, "INFO" ):ToLog()
|
||||
end
|
||||
|
||||
-- Add menu for the second group
|
||||
if PlaneGroup2 and PlaneGroup2:IsAlive() then
|
||||
local MenuGroup2 = MENU_GROUP:New( PlaneGroup2, "Menu for Plane-2" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Accept BAI mission", MenuGroup2, PrintTheTextToBlue, "Plane-2 accepts the BAI mission" )
|
||||
MESSAGE:New( "Menu added to Group2.", 1, "INFO" ):ToLog()
|
||||
else
|
||||
MESSAGE:New( "Group2 is not available.", 1, "INFO" ):ToLog()
|
||||
end
|
||||
end, {}, 5, 5 )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
MESSAGE:New( "The script will check every 5 seconds if group is available and add the menu.", 25, "INFO" ):ToAll():ToLog()
|
||||
---
|
||||
-- Author: kaltokri
|
||||
-- Created: 16.03.2024
|
||||
-- Contributors: -
|
||||
-- Modified: -
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- Very simple example of the MENU_GROUP.
|
||||
-- We added two planes and give them different menu entries.
|
||||
-- We need a timer to check regularly if someone entered the plane.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission.
|
||||
-- 2. Enter as Plane-1.
|
||||
-- 3. Wait for "loaded successfully" message and then 5 seconds more.
|
||||
-- 4. Open menu by pressing #
|
||||
-- 5. Choose F11. Parent Menu
|
||||
-- 6. Choose F10. Other...
|
||||
-- 7. Select F2. Menu for Plane-1...
|
||||
-- 8. Select F1. Accept CAS mission and see the message.
|
||||
-- 9. Switch to Plane-2 and wait 5 seconds.
|
||||
-- 10. Open menu by pressing #
|
||||
-- 11. Choose F11. Parent Menu
|
||||
-- 12. Choose F10. Other...
|
||||
-- 13. Select F2. Menu for Plane-2...
|
||||
-- 12. Select F1. Accept BAI mission and see the message.
|
||||
|
||||
|
||||
-- Example function
|
||||
local function PrintTheTextToBlue( text )
|
||||
MESSAGE:New( text, 25, "INFO" ):ToBlue()
|
||||
end
|
||||
|
||||
-- Start a scheduler after a delay of 5 seconds and repeat it's execution very 5 seconds
|
||||
SCHEDULER:New( nil,
|
||||
function()
|
||||
-- Find both groups and save them in an object
|
||||
local PlaneGroup1 = GROUP:FindByName( "Plane-1" )
|
||||
local PlaneGroup2 = GROUP:FindByName( "Plane-2" )
|
||||
|
||||
-- Add menu for the first group
|
||||
if PlaneGroup1 and PlaneGroup1:IsAlive() then
|
||||
local MenuGroup1 = MENU_GROUP:New( PlaneGroup1, "Menu for Plane-1" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Accept CAS mission", MenuGroup1, PrintTheTextToBlue, "Plane-1 accepts the CAS mission" )
|
||||
MESSAGE:New( "Menu added to Group1.", 1, "INFO" ):ToLog()
|
||||
else
|
||||
MESSAGE:New( "Group1 is not available.", 1, "INFO" ):ToLog()
|
||||
end
|
||||
|
||||
-- Add menu for the second group
|
||||
if PlaneGroup2 and PlaneGroup2:IsAlive() then
|
||||
local MenuGroup2 = MENU_GROUP:New( PlaneGroup2, "Menu for Plane-2" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Accept BAI mission", MenuGroup2, PrintTheTextToBlue, "Plane-2 accepts the BAI mission" )
|
||||
MESSAGE:New( "Menu added to Group2.", 1, "INFO" ):ToLog()
|
||||
else
|
||||
MESSAGE:New( "Group2 is not available.", 1, "INFO" ):ToLog()
|
||||
end
|
||||
end, {}, 5, 5 )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
MESSAGE:New( "The script will check every 5 seconds if group is available and add the menu.", 25, "INFO" ):ToAll():ToLog()
|
||||
|
||||
Binary file not shown.
@ -1,75 +1,75 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 17.03.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo creates a menu structure for the planes within the red coalition.
|
||||
-- This time you can add and remove menu entries dynamic.
|
||||
-- We use other menu entries to add and remove the menu entry "Show Status".
|
||||
-- But this is only for simplification. You can change them in your mission code depending on the situation.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and choose Plane 1.
|
||||
-- 2. Wait for "loaded successfully" message.
|
||||
-- 3. Open menu by pressing #
|
||||
-- 4. Choose F10. Other...
|
||||
-- 5. Select F1. Manage Menus...
|
||||
-- 6. Select F1. Add Status Menu.
|
||||
-- 7. Open menu by pressing # again.
|
||||
-- 8. Choose F10. Other...
|
||||
-- 9. Select new entry F3. Status of Planes... and F1. Show Status.
|
||||
-- 10. See the message.
|
||||
-- 11. Switxh to Plane 2
|
||||
-- 12. Open menu by pressing #
|
||||
-- 13. Choose F10. Other...
|
||||
-- 14. The menu entry F2. Status of Planes... is available
|
||||
-- NOTE: The order of the menu entries may vary!
|
||||
-- 15. Select F2. Status of Planes... and F1. Show Status.
|
||||
-- 16. See the message again.
|
||||
-- 17. Open menu by pressing #
|
||||
-- 18. Choose F10. Other...
|
||||
-- 19. Select F1. Manage Menus...
|
||||
-- 20. Choose F2. Remove Status Menu
|
||||
-- 21. Open the menu and check the menu entry Status of Planes is gone.
|
||||
-- 22. Switch back to Planre 1 and check that the menu entry is also removed.
|
||||
|
||||
-- Find and save client object
|
||||
local Plane1 = CLIENT:FindByName( "Plane 1" )
|
||||
local Plane2 = CLIENT:FindByName( "Plane 2" )
|
||||
|
||||
-- This would create a menu for the red coalition under the main DCS "Others" menu.
|
||||
local MenuCoalitionRed = MENU_COALITION:New( coalition.side.RED, "Manage Menus" )
|
||||
|
||||
-- We define the variable here, so we can use them in the functions, but the status is saved on mission script level.
|
||||
local MenuStatus -- Menu#MENU_COALITION
|
||||
|
||||
-- A simple function to show a status text.
|
||||
local function ShowStatus( StatusText, TextToCoalition )
|
||||
MESSAGE:New( TextToCoalition, 15 ):ToRed()
|
||||
Plane1:Message( StatusText, 15 )
|
||||
Plane2:Message( StatusText, 15 )
|
||||
end
|
||||
|
||||
-- This function creates a menu entry for the red coalition to show a status message.
|
||||
local function AddStatusMenu()
|
||||
MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status of Planes" )
|
||||
local MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
|
||||
end
|
||||
|
||||
-- This function removes the menu entry for the red coalition to show a status message.
|
||||
local function RemoveStatusMenu()
|
||||
MenuStatus:Remove()
|
||||
end
|
||||
|
||||
-- Add two entries to add and remove another
|
||||
local MenuAdd = MENU_COALITION_COMMAND:New( coalition.side.RED, "Add Status Menu", MenuCoalitionRed, AddStatusMenu )
|
||||
local MenuRemove = MENU_COALITION_COMMAND:New( coalition.side.RED, "Remove Status Menu", MenuCoalitionRed, RemoveStatusMenu )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 17.03.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo creates a menu structure for the planes within the red coalition.
|
||||
-- This time you can add and remove menu entries dynamic.
|
||||
-- We use other menu entries to add and remove the menu entry "Show Status".
|
||||
-- But this is only for simplification. You can change them in your mission code depending on the situation.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- 1. Start the mission and choose Plane 1.
|
||||
-- 2. Wait for "loaded successfully" message.
|
||||
-- 3. Open menu by pressing #
|
||||
-- 4. Choose F10. Other...
|
||||
-- 5. Select F1. Manage Menus...
|
||||
-- 6. Select F1. Add Status Menu.
|
||||
-- 7. Open menu by pressing # again.
|
||||
-- 8. Choose F10. Other...
|
||||
-- 9. Select new entry F3. Status of Planes... and F1. Show Status.
|
||||
-- 10. See the message.
|
||||
-- 11. Switxh to Plane 2
|
||||
-- 12. Open menu by pressing #
|
||||
-- 13. Choose F10. Other...
|
||||
-- 14. The menu entry F2. Status of Planes... is available
|
||||
-- NOTE: The order of the menu entries may vary!
|
||||
-- 15. Select F2. Status of Planes... and F1. Show Status.
|
||||
-- 16. See the message again.
|
||||
-- 17. Open menu by pressing #
|
||||
-- 18. Choose F10. Other...
|
||||
-- 19. Select F1. Manage Menus...
|
||||
-- 20. Choose F2. Remove Status Menu
|
||||
-- 21. Open the menu and check the menu entry Status of Planes is gone.
|
||||
-- 22. Switch back to Planre 1 and check that the menu entry is also removed.
|
||||
|
||||
-- Find and save client object
|
||||
local Plane1 = CLIENT:FindByName( "Plane 1" )
|
||||
local Plane2 = CLIENT:FindByName( "Plane 2" )
|
||||
|
||||
-- This would create a menu for the red coalition under the main DCS "Others" menu.
|
||||
local MenuCoalitionRed = MENU_COALITION:New( coalition.side.RED, "Manage Menus" )
|
||||
|
||||
-- We define the variable here, so we can use them in the functions, but the status is saved on mission script level.
|
||||
local MenuStatus -- Menu#MENU_COALITION
|
||||
|
||||
-- A simple function to show a status text.
|
||||
local function ShowStatus( StatusText, TextToCoalition )
|
||||
MESSAGE:New( TextToCoalition, 15 ):ToRed()
|
||||
Plane1:Message( StatusText, 15 )
|
||||
Plane2:Message( StatusText, 15 )
|
||||
end
|
||||
|
||||
-- This function creates a menu entry for the red coalition to show a status message.
|
||||
local function AddStatusMenu()
|
||||
MenuStatus = MENU_COALITION:New( coalition.side.RED, "Status of Planes" )
|
||||
local MenuStatusShow = MENU_COALITION_COMMAND:New( coalition.side.RED, "Show Status", MenuStatus, ShowStatus, "Status of planes is ok!", "Message to Red Coalition" )
|
||||
end
|
||||
|
||||
-- This function removes the menu entry for the red coalition to show a status message.
|
||||
local function RemoveStatusMenu()
|
||||
MenuStatus:Remove()
|
||||
end
|
||||
|
||||
-- Add two entries to add and remove another
|
||||
local MenuAdd = MENU_COALITION_COMMAND:New( coalition.side.RED, "Add Status Menu", MenuCoalitionRed, AddStatusMenu )
|
||||
local MenuRemove = MENU_COALITION_COMMAND:New( coalition.side.RED, "Remove Status Menu", MenuCoalitionRed, RemoveStatusMenu )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
|
||||
Binary file not shown.
@ -1,71 +1,71 @@
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 18.03.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Scheduler.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo creates a menu structure for the two groups of planes.
|
||||
-- Each group will receive a different menu structure.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- To test this mission join the planes, look at the radio menus (option F10).
|
||||
-- Then switch planes and check if the menu is still there.
|
||||
-- And play with the Add and Remove menu options.
|
||||
-- NOTE: That will only work on multiplayer after the DCS groups bug is solved.
|
||||
|
||||
|
||||
-- We define the variable here, so we can use it in the functions, but the status is saved on mission script level.
|
||||
local MenuStatus = {}
|
||||
|
||||
-- A simple function to show a status text.
|
||||
local function ShowStatus( PlaneGroup, StatusText, TextToCoalition )
|
||||
MESSAGE:New( TextToCoalition, 15 ):ToRed()
|
||||
PlaneGroup:Message( StatusText, 15 )
|
||||
end
|
||||
|
||||
--- This function creates a menu entry for the red coalition to show a status message.
|
||||
-- @param Wrapper.Group#GROUP MenuGroup
|
||||
local function AddStatusMenu( MenuGroup )
|
||||
local MenuGroupName = MenuGroup:GetName()
|
||||
-- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||
MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
||||
MENU_GROUP_COMMAND:New( MenuGroup, "Show Status", MenuStatus[MenuGroupName], ShowStatus, MenuGroup, "Status of planes is ok!", "Message to Red Coalition" )
|
||||
end
|
||||
|
||||
-- This function removes the menu entry for the red coalition to show a status message.
|
||||
local function RemoveStatusMenu( MenuGroup )
|
||||
local MenuGroupName = MenuGroup:GetName()
|
||||
MenuStatus[MenuGroupName]:Remove()
|
||||
end
|
||||
|
||||
-- Start a scheduler after a delay of 5 seconds and repeat it's execution very 5 seconds
|
||||
SCHEDULER:New( nil,
|
||||
function()
|
||||
-- Find both groups and save them in an object.
|
||||
local PlaneGroup1 = GROUP:FindByName( "Plane 1" )
|
||||
local PlaneGroup2 = GROUP:FindByName( "Plane 2" )
|
||||
|
||||
-- Add menu for the first group
|
||||
if PlaneGroup1 and PlaneGroup1:IsAlive() then
|
||||
local MenuGroup1 = MENU_GROUP:New( PlaneGroup1, "Manage Menus" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Add Status Menu Plane 1", MenuGroup1, AddStatusMenu, PlaneGroup1 )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Remove Status Menu Plane 1", MenuGroup1, RemoveStatusMenu, PlaneGroup1 )
|
||||
end
|
||||
|
||||
-- Add menu for the second group
|
||||
if PlaneGroup2 and PlaneGroup2:IsAlive() then
|
||||
local MenuGroup2 = MENU_GROUP:New( PlaneGroup2, "Manage Menus" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Add Status Menu Plane 2", MenuGroup2, AddStatusMenu, PlaneGroup2 )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Remove Status Menu Plane 2", MenuGroup2, RemoveStatusMenu, PlaneGroup2 )
|
||||
end
|
||||
end, {}, 5, 5 )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
MESSAGE:New( "The script will check every 5 seconds if group is available and add the menu.", 25, "INFO" ):ToAll():ToLog()
|
||||
---
|
||||
-- Author: FlightControl
|
||||
-- Created: 20.10.2018
|
||||
-- Contributors: kaltokri
|
||||
-- Modified: 18.03.2024
|
||||
--
|
||||
-- # Documentation:
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Menu.html
|
||||
-- https://flightcontrol-master.github.io/MOOSE_DOCS_DEVELOP/Documentation/Core.Scheduler.html
|
||||
--
|
||||
-- # Description:
|
||||
--
|
||||
-- This demo creates a menu structure for the two groups of planes.
|
||||
-- Each group will receive a different menu structure.
|
||||
--
|
||||
-- # Guide:
|
||||
--
|
||||
-- To test this mission join the planes, look at the radio menus (option F10).
|
||||
-- Then switch planes and check if the menu is still there.
|
||||
-- And play with the Add and Remove menu options.
|
||||
-- NOTE: That will only work on multiplayer after the DCS groups bug is solved.
|
||||
|
||||
|
||||
-- We define the variable here, so we can use it in the functions, but the status is saved on mission script level.
|
||||
local MenuStatus = {}
|
||||
|
||||
-- A simple function to show a status text.
|
||||
local function ShowStatus( PlaneGroup, StatusText, TextToCoalition )
|
||||
MESSAGE:New( TextToCoalition, 15 ):ToRed()
|
||||
PlaneGroup:Message( StatusText, 15 )
|
||||
end
|
||||
|
||||
--- This function creates a menu entry for the red coalition to show a status message.
|
||||
-- @param Wrapper.Group#GROUP MenuGroup
|
||||
local function AddStatusMenu( MenuGroup )
|
||||
local MenuGroupName = MenuGroup:GetName()
|
||||
-- This would create a menu for the red coalition under the MenuCoalitionRed menu object.
|
||||
MenuStatus[MenuGroupName] = MENU_GROUP:New( MenuGroup, "Status for Planes" )
|
||||
MENU_GROUP_COMMAND:New( MenuGroup, "Show Status", MenuStatus[MenuGroupName], ShowStatus, MenuGroup, "Status of planes is ok!", "Message to Red Coalition" )
|
||||
end
|
||||
|
||||
-- This function removes the menu entry for the red coalition to show a status message.
|
||||
local function RemoveStatusMenu( MenuGroup )
|
||||
local MenuGroupName = MenuGroup:GetName()
|
||||
MenuStatus[MenuGroupName]:Remove()
|
||||
end
|
||||
|
||||
-- Start a scheduler after a delay of 5 seconds and repeat it's execution very 5 seconds
|
||||
SCHEDULER:New( nil,
|
||||
function()
|
||||
-- Find both groups and save them in an object.
|
||||
local PlaneGroup1 = GROUP:FindByName( "Plane 1" )
|
||||
local PlaneGroup2 = GROUP:FindByName( "Plane 2" )
|
||||
|
||||
-- Add menu for the first group
|
||||
if PlaneGroup1 and PlaneGroup1:IsAlive() then
|
||||
local MenuGroup1 = MENU_GROUP:New( PlaneGroup1, "Manage Menus" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Add Status Menu Plane 1", MenuGroup1, AddStatusMenu, PlaneGroup1 )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup1, "Remove Status Menu Plane 1", MenuGroup1, RemoveStatusMenu, PlaneGroup1 )
|
||||
end
|
||||
|
||||
-- Add menu for the second group
|
||||
if PlaneGroup2 and PlaneGroup2:IsAlive() then
|
||||
local MenuGroup2 = MENU_GROUP:New( PlaneGroup2, "Manage Menus" )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Add Status Menu Plane 2", MenuGroup2, AddStatusMenu, PlaneGroup2 )
|
||||
MENU_GROUP_COMMAND:New( PlaneGroup2, "Remove Status Menu Plane 2", MenuGroup2, RemoveStatusMenu, PlaneGroup2 )
|
||||
end
|
||||
end, {}, 5, 5 )
|
||||
|
||||
MESSAGE:New( "Mission script loaded successfully", 25, "INFO" ):ToAll():ToLog()
|
||||
MESSAGE:New( "The script will check every 5 seconds if group is available and add the menu.", 25, "INFO" ):ToAll():ToLog()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user