Debug Mode

From F2 EN
Jump to: navigation, search

Description

To assist the mission designer with testing new scripts and functionality, F2 includes a debug mode. The debug mode is activated by selecting an option in the mission parameters screen (during mission set-up). When the debug mode is activated many F2 scripts will generate special sideChat messages showing the value of certain variables etc.

Required files

All the code associated with this component is found in:

  • description.ext
  • f\common\f_processParamsArray.sqf

How to use

How it works

In the file description.ext is a segment of code entitled:

// F2 - Debug Mode

This segment is processed by the file f_processParamsArray.sqf at mission start, and if the parameter for debug mode is set to 1 then a global variable, f_var_debugMode, is automatically set to 1 on all machines, including the server.

Using debug mode in scripts

In your scripts you may want to include hint or sideChat commands (or other segments of code) which only execute if the mission is being run in debug mode. To take advantage of this feature its is suggested that you use the following code in your scripts:

// DEBUG
if (f_var_debugMode == 1) then
{
// Place code to run ONLY in debug mode after this line:


};

Tips

  • The sideChat command is often more useful than hint because if lots of debug messages are generated you can scroll back through them.

How to disable

You should not attempt to disable this component.

Credits

  • Fer
  • Messiah2
  • Mike84