{"name":"diag_scope","title":"diag scope","type":"command","url":"https://community.bistudio.com/wiki/diag_scope","revid":369074,"updated":"2024-09-02T20:25:00Z","groups":["Diagnostic","Performance Profiling"],"status":"ok","games":{"arma3":"2.02"},"since":"arma3 2.02","arma3_since":"2.02","description":"Returns script scope depth. When script is directly executed by the engine or a new script is added to the scheduler, the scope depth is 0.\nThe examples of such execution are event handlers, spawn, etc. isNil Code will also create a parent scope.\nAny use of call and such will stack execution creating child scopes and increasing scope depth.","syntaxes":[{"syntax":"diag_scope","params":[],"returns":{"type":"Number","type_expr":"Number"},"form":"nullary"}],"examples":[{"text":"```sqf\n0 spawn\n{\n    systemChat str diag_scope; // 0\n    call\n    {\n        call\n        {\n            systemChat str diag_scope; // 2\n            isNil\n            {\n                systemChat str diag_scope; // 0\n                call\n                {\n                    systemChat str diag_scope; // 1\n                };\n            };\n        };\n    };\n};\n```","code":["0 spawn\n{ \n\tsystemChat str diag_scope; // 0\n\tcall \n\t{ \n\t\tcall\n\t\t{ \n\t\t\tsystemChat str diag_scope; // 2\n\t\t\tisNil \n\t\t\t{ \n\t\t\t\tsystemChat str diag_scope; // 0\n\t\t\t\tcall \n\t\t\t\t{\n\t\t\t\t\tsystemChat str diag_scope; // 1\n\t\t\t\t};\n\t\t\t};\n\t\t};\n\t};\n};"]}],"see_also":["exitWith","diag_fps","diag_fpsMin","diag_frameNo","diag_log","diag_tickTime","diag_deltaTime"]}