-- How to use this file:
-- 1. Make a copy of this file and save it as "debugger.lua".
-- 2. Edit the copied file according to your requirements.
-- 3. Start your mission and open the communications menu in-game.
-- 4. Go to "F10. Other" and select "Debugger...".
return {
    -- flag names you want to watch or change during your mission
    flags = {
        "FLAG_A",
        "FLAG_B",
    },
    flagAssignments = {
        -- preset values you can assign to each flag from the debugger menu (other than just 0 or 1)
        values = { 50, 100 },
        -- step amounts for incrementing or decrementing the flag value (other than just 0 or 1)
        -- each step will be available in the debugger menu as both positive and negative
        steps = { 10, 20 },
    },
    -- lua functions to run from the debugger menu, this feature allows advanced control over the mission by running custom code
    macros = {
        -- Example: Set and log user flags to simulate a CAP spawn
        ["Spawn enemy CAP (demo)"] = function()
            local capSpawnedFlag = "CAP_SPAWNED"
            local capActiveFlag = "CAP_ACTIVE"
            -- You can set flags and global variables to change your mission's state.
            trigger.action.setUserFlag(capSpawnedFlag, 1) -- (simulate spawn)
            -- You can call other global functions.
            ToggleFlag(capActiveFlag) -- (simulate group activation)
            -- You can show messages to help you see the values of flags and global variables.
            local spawnedVal = trigger.misc.getUserFlag(capSpawnedFlag)
            local activeVal = trigger.misc.getUserFlag(capActiveFlag)
            trigger.action.outText(string.format(
                "[CAP Macro] %s = %d, %s = %d",
                capSpawnedFlag, spawnedVal, capActiveFlag, activeVal
            ), 10) -- (report flags state)
        end
    }
}
