Debugging Techniques: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (added SQDev)
(Page lifting)
Line 1: Line 1:
'''Debugging techniques''' are ways in which developers can debug, or find out where errors or unexpected outcomes are occurring within their scripts. Several methods of debugging exist, however there is no debugging system as such available to developers similar to that which is found within an Integrated Development Environment or with other languages.
{{SideTOC}}


== Debugging tools ==
[[Debugging Techniques]] are ways for a developers to debug (narrow down/determine the root source), or to learn and understand where and why errors or unexpected outcomes are occurring within their code.
=== RPT files ===
RPT files are the location where debug information is dumped to both by the Arma game and by any scripts that are running. For scripts which are running on a server, generally the file used is Arma2OAServer.RPT which has varying locations depending upon the type of server being run. For scripts which are running on a client, the Arma2.RPT or Arma2OA.RPT file will contain debug related information. The default locations for these files may vary, but should be based in the AppData folder in Windows 7 (C:\Users\User\AppData\Local\<Game Name>\).


=== Debug consoles ===
{{note|Debugging is the process of finding and resolving defects or problems within a computer program that prevent correct operation of computer software or a system – ''[https://en.wikipedia.org/w/index.php?title{{=}}Debugging Wikipedia - Debugging]''}}
Like in other games, several debug consoles are available which have been developed by community members, to either display or list useful information, display or analyse bugs within code, to allow code execution, or a variety of these functions.  


==== Arma: Cold War Assault ====
== Code basics ==
*[[User:Vektorboson|Vektorboson]] released a [http://home.arcor.de/vektorboson/res/console_3.7z debugging console] for advanced users that is very helpful at debugging your scripting in real time.


==== Arma: Armed Assault ====
Various links about code and how to write it:
*[http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=1593a8bb7375674288e681ba36b48dc3;act=ST;f=70;t=56294 Debug console] made by [[User:Str|Str]]. It's in form of addon and it's available in all singleplayer missions, intros and outros. Easy and simple to use (Escape-Enter execute).
* [[SQF syntax]]
*[http://www.flashpoint1985.com/cgi-bin/ikonboard311/ikonboard.cgi?s=c10d84cce14a63a54ac915506d008e80;act=ST;f=69;t=57493 TroopMon V 0.7 *Mission debugger] - Complex debugging system providing lot of informations for mission-makers, escpecially about AI.
* [[SQS syntax]]
* [[Code Optimisation]]


==== Arma 2 ====
=== IDE and Syntax Highlight ===
*[http://temp.moricky.com/arma2/stra_debug2.rar Debug console] by [[User:Str|Str]]
*[http://www.armaholic.com/page.php?id=7948 TroopMon2] by Charon Productions
*[http://forums.bistudio.com/showthread.php?t=126249 DevCon] by [[User:Kju|Kju]]


If you're at an advanced stage of a project, you can save the game when the bug appears and check the variable and script states with '''Chain of Command's''' [http://ofp.gamepark.cz/index.php?showthis=6989&newlang=eng Binary gamefile viewer].
Syntax errors are a frequent occurrence when developing scripts. '''Syntax highlight''' will help you find typos in commands and in your scripts.


==== Take On Helicopters ====
An '''I'''ntegrated '''D'''evelopment '''E'''nvironment (short '''IDE''') is a development environment software that provides among other things '''code analysis''', '''code completion''' and '''syntax highlight'''  to help you write better, more error free code.
The game already features [[Mission_Editor:_Debug_Console_(Take_On_Helicopters)|Debug Console]] in basic installation.


==== Arma 3 ====
See further [[#Debugging Tools|Debugging Tools]] page section for download links.
The game already features [[Mission_Editor:_Debug_Console_(Arma 3)|Debug Console]] in basic installation.


== General debugging techniques ==
=== Errors ===
=== Addons ===
If you're working with an existing addon, or are developing one, repacking a PBO can be time-intensive, and can be replaced simply by creating a basic mission in the "Missions" or "MPmissions" (if your feature is multiplayer-specific) folder of your game installation, and then running the scenario or mission locally. The easiest way of accomplishing this is by the use of [[Event Scripts]] to run your code such as [[init.sqf]]. Once you have tested your code, using missions in this way, you can then sequentially pack your PBO when major changes have been made, rather than for each debug session of a script or piece of code.


=== Syntax checking and highlighting ===
An error in SQF '''will''' purely and simply '''halt''' the current script, leading to unpredictable behavior.
Syntax errors can be a frequent occurrence when developing scripts. There are several methods of determining if the syntax is correct before running scripts; [https://sites.google.com/site/macsarmatools/squint squint] provides a fully-featured code editor which allows for syntax highlighting, displaying of errors and code correction. A simpler solution of code highlighting for Notepad++ is also available [http://www.armaholic.com/page.php?id=8680 here], although errors will only be visible from the absence of highlighting.  
Error are not to happen as it may reduce performance as well as break a mission/feature.
Using [https://forums.bohemia.net/forums/topic/202181-sqdev-sqf-developing-in-eclipse/ SQDev] you will get code validation (linting) while you are typing it. The plugin will automatically check if you are using all commands with the proper syntax and with proper argument types.
So if you notice an issue, address it as your script '''will''' stop.
 
=== Finding Errors ===
 
Debugging is usually as complicated as writing the actual code itself. You usually get hinted by the game, where some error happened, and what it was.<br />
There are instances where actual error reason might be something completely different than announced (eg. you get the error on a variable being [[nil]] somewhere, but the actual error is that you mistyped it where you set it initially).
 
{{Important|Make sure you enable ''Show Script Errors'' in the Launcher (for {{arma3}}) or set the corresponding [[Arma_3_Startup_Parameters|-showScriptErrors]] startup parameter.}}
 
A script error will greet you with this box:
[[File:A3_ScriptErrorMsg.jpg|thumb|Script error message|center|500px]]
 
It tells you what went wrong, shows a snippet of the code that failed and what file and line it occurred in (unless you used a command combination like eg. {{Inline code|[[compile]] [[loadFile]]}}).
Knowing this, you now can proceed to find the actual reason why that specific piece of code errored.
 
{{informative|This information can also be found in the [[arma.RPT|RPT log]].}}
 
To solve an issue, you must first to became aware that of it. Aside from your script not having the desired result/effect (if any), an error message can tell you about the problem.
* Be sure to use [[Arma 3 Startup Parameters#Developer Options|<tt>-showScriptErrors</tt>&nbsp;startup&nbsp;parameter]] to display the error on-screen when it happens
* To learn about the location in your script use [[preprocessFileLineNumbers]] to [[preprocessFile]]
* Read [[Crash Files|RPT files]] for more information (make sure [[Arma 3 Startup Parameters#Performance|<tt>-noLogs</tt> startup parameter]] is '''not''' active - otherwise the log will empty)
** Scripts running on a server use the '''Arma''X''Server.RPT''' file which has varying location depending upon the type of server being run.
** Scripts running on a client use the '''Arma''X''.RPT''' file.
 
 
==== RPT files ====
 
The [[arma.RPT|RPT]] is also used by the game's engine log other type of problems (low level engine issues, or content problems for example). Hence it will dump all kinds of debug information, warnings, errors as well as encountered script errors.
One can also write information to it by using commands like [[diag_log]].
 
{{Important|The RPT file might be disabled using the Arma 3 launcher or by setting the corresponding [[Arma_3_Startup_Parameters|-noLogs]] startup parameter ({{arma3}} or {{arma2oa}} option)}}
 
{|class="bikitable"
|+ RPT File location per game (See [[Crash Files]] for more information)
!Game
!Location
!Files
|-
| {{GVI|arma3|1.00}} {{arma3}}
| <code>'''%localappdata%'''\Arma 3</code>
| <code>Arma3_x64_yyyy-mm-dd_hh-mm-ss.rpt</code>
|-
| {{GVI|arma2|1.00}} {{arma2}}
| <code>'''%localappdata%'''\ArmA 2</code>
| <code>arma2.rpt</code>
|-
| {{GVI|arma|1.00}} {{arma}}
| <code>'''%localappdata%'''\ArmA</code>
| <code>arma.rpt</code>
|-
| {{GVI|ofp|1.00}} {{ofp}}
| <code>'''''OFP root directory'''''</code>
| <code>flashpoint.rpt<br />context.bin</code>
|}
 
 
=== Solving Errors ===
 
Once the script error is located: '''Make sure to check first the BiKi page corresponding to the command/function you are using to learn about potential misuse or other important information mentioned on the page!'''
 
The most simple thing you can do is to output expected values. This can be done using for example [[diag_log]] or [[systemChat]].
Output yourself a few [[Variables|variables]] that relate to your problem (for example: When the error occurs because you land in some [[if]] block, output the corresponding variables inside of the if).
You continue doing this until you hit the actual problem: When [[Variables|variable]] A is not set, go to where [[Variables|variable]] A gets set and check around there, repeat and continue.
 
The same can be done for non-critical errors like when a method is "just" computing the wrong values.
 
{{Informative|
If you're having great difficulty solving a problem, the good way is to narrow down the issue to the simplest code block possible;
or take the mission part that doesn't work, paste it into a new test mission and go from here.
Doing so will save you dealing with other scripts' potential side effects!}}
 
 
==== Common errors ====
 
{| class="bikitable sortable"
!Error message
!Cause
!Solution
|-
|<tt>Error Undefined variable in expression: _varName</tt>
|variable ''_varName'' has not been initialised properly in this context.
<code>[[hint]] _nonExistentVar;</code>
|
* in the case of a [[spawn]]ed code, previous local variables are '''not''' accessible and must be passed as arguments in order to access them.
* a variable may have been ''undefined'' ({{Inline code|_varName {{=}} [[nil]]}}). Unset it ''after'' you are done using it.
|-
|<tt>Error x elements provided, y is expected</tt>
|A wrong number of arguments in array was provided
<code>_unit [[setPos]] [0]; {{codecomment|// [[setPos]] only takes an array of 2 to 3 elements}}</code>
|rowspan="2" align="center"|'''Read the wiki about said command'''.<br /><br />Use [[typeName]] to output a variable type and compare it to the command's wiki page.
|-
|<tt>Error type x, expected y</tt>
|An ill-typed argument was provided.
<code>[[hint]] 5; {{codecomment|// must be [[String]] or [[Structured Text]], [[Number]] provided}}</code>
|-
|rowspan="2"|<tt>Error Zero divisor</tt>
|Pretty self-explanatory, somewhere in your code is a division by zero.
<code>[[private]] _number = 0;
[[private]] _result = 100/_number;</code>
|
* Make sure to check that your divisor is different from zero before dividing.
<code>[[private]] _result = [100, 100/_number] [[select]] (_number != 0);</code>
|-
|Also happens when using an invalid [[select]] index.
<code>["a","b","c"] [[select]] 20; {{codecomment|// index can only be 0, 1 or 2}}</code>
|
* Ensure your [[select]] happens within the array boundaries.
* use [[selectRandom]] to pick a random item in an array.
|-
|<tt>Local variable in global space</tt>
|An attempt to [[private]] a public variable
<code>[[private]] "myVar"; {{codecomment|// should be "_myVar"}}</code>
|Replace public variable usage with private variables.
|-
|rowspan="2"|<tt>Error Generic error in expression</tt>
|A [[sleep]]/[[uiSleep]]/[[waitUntil]] command has been used in an [[Scheduler#Unscheduled Environment|unscheduled environment]].
<code>[[player]] [[addEventHandler]] ["Fired", { [[sleep]] 1; [[hint]] "bang"; }];</code>
|
* Do '''not''' use such suspending commands in unscheduled environment; a common workaround could be:
<code>[[private]] _t = [[time]] + 5; {{codecomment|// having to wait for 5 seconds}}
[[waitUntil]] { [[time]] > _t };</code>
* [[spawn]] code:
<code>[[player]] [[addEventHandler]] ["Fired", { [] spawn { [[sleep]] 1; [[hint]] "bang"; }; }];</code>
|-
|Further code reading is required.
|
* cut your code in smaller pieces and locate the concerned line(s).
|}
 
=== Working with Addons ===
 
If you are working on an addon, repacking a PBO can be time-intensive.
This operation can be replaced simply by creating a basic mission in the "Missions" or "MPmissions" (if your feature is multiplayer-specific) folder of your game installation, and running the mission locally.
The easiest way of accomplishing this is by the use of [[Event Scripts]] to run your code such as [[init.sqf]].
Once you have tested your code this way, you can then sequentially pack your PBO when major changes have been made, rather than for each debug session of a script or piece of code.


=== Debugging specific sections of code ===
=== Debugging specific sections of code ===
Although primitive, the use of [[diag_log]] and [[format]] can be used to debug the content of variables when entering them into functions. In the case that specific pieces of code do not run, or if specific if conditions don't appear to fire, debugging the contents of that specific variable with diag_log can be useful. As with all debugging, so long as the developer is methodical and logical in checking each section of code that runs, finding bugs and resolving them can be straightforward.


===Keep it simple===
Although primitive, the combined use of [[diag_log]], [[systemChat]]/[[hint]] and [[format]] can help to debug the content of function arguments.
If you're having great difficulty solving a problem, simplify the problem, take the part of the mission which does not work, paste it into a new test mission so that you don't have to watch the effect of the rest of the script(s).  
In the case that specific pieces of code do not run, or if specific ''if'' conditions don't appear to fire, debugging the variable content with [[diag_log]] can be useful.
As with all debugging, as long as the developer is methodical and logical in checking each section of code that runs, finding bugs and resolving them can be straightforward.
 
 
== Debugging Tools ==
 
{| class="bikitable sortable"
! Game
! User
! Addon/Toolname
! Category
! Description
! Link
|-
|''N/A''
|[https://forums.bohemia.net/profile/797692-sanjo/ Sanjo]
|Notepad++ SQF
|Text editor plugin - Notepad++
|[https://notepad-plus-plus.org/download/ Notepad++] SQF Syntax highlighter plugin. [http://www.armaholic.com/page.php?id=8680 Forum post]
|[https://github.com/Sanjo/npp-sqf Download]
|-
|''N/A''
|[https://forums.bohemia.net/profile/1110763-k-town/ K-Town]
|Arma IntelliJ plugin
|IDE plugin - IntelliJ
|[https://forums.bohemia.net/forums/topic/190427-arma-intellij-plugin-smart-editing-for-header-and-sqf-files/ Forum post]
|[https://github.com/kayler-renslow/arma-intellij-plugin/releases Download]
|-
|''N/A''
|[https://forums.bohemia.net/profile/804281-armitxes/ Armitxes]
|SQF Language
|IDE plugin - Visual Studio Code
|[https://forums.bohemia.net/forums/topic/182917-vs-code-~-sqf-visual-studio-code-sqf-language/ Forum post]
|[https://marketplace.visualstudio.com/items?itemName=Armitxes.sqf Download]
|-
|''N/A''
|ole1986
|Arma Dev
|IDE plugin - Visual Studio Code
|
|[https://marketplace.visualstudio.com/items?itemName=ole1986.arma-dev Download]
|-
|''N/A''
|[https://forums.bohemia.net/profile/757308-skacekachna/ SkaceKachna]
|SQFLint
|IDE plugin - Visual Studio Code
|[https://forums.bohemia.net/forums/topic/194417-sqflint-syntax-error-checker-cli/ Forum post]
|[https://marketplace.visualstudio.com/items?itemName=skacekachna.sqflint Download]
|-
|''N/A''
|[https://forums.bohemia.net/profile/1044335-krzmbrzl/ krzmbrzl]
|SQDev
|IDE plugin - Eclipse
|Provides code validation (linting) while you are typing it. [https://forums.bohemia.net/forums/topic/202181-sqdev-sqf-developing-in-eclipse/ Forum post]
|[https://github.com/Krzmbrzl/SQDev Download]
|-
|''N/A''
|[[User:Sbsmac|Sbsmac]]
|Squint
|IDE
|Provides a fully-featured code editor which allows for syntax highlighting, displaying of errors and code correction. [https://forums.bohemia.net/forums/topic/101921-squint-the-sqf-editor-and-error-checker/ Forum post]
|[https://sites.google.com/site/macsarmatools/squint Download]
|-
|''N/A''
|[[User:X39|X39]]
|SQF VM
|Emulator
|[https://forums.bohemia.net/forums/topic/210118-sqf-vm-an-sqf-emulator/ Forum post]
|[https://github.com/SQFvm/vm Download]
|-
|''N/A''
|[[User:Dedmen|Dedmen]]
|Arma Script Profiler
|Tool
|[https://forums.bohemia.net/forums/topic/211626-arma-script-profiler/ Forum post]
|[https://github.com/dedmen/ArmaScriptProfiler/ Download]
|-
|''N/A''
|[[User:Dedmen|Dedmen]]
|Arma Debug Engine
|Tool
|[https://steamcommunity.com/sharedfiles/filedetails/?id=1585582292 Workshop link]
|[https://github.com/dedmen/ArmaDebugEngine/ Download]
|-
|{{GVI|arma3|1.00}}
|[[Bohemia_Interactive|Bohemia Interactive]]
| ''N/A''
|Debug console
|Debug Console capable of executing code and more.
|[[Mission Editor: Debug Console (Arma 3)|Wiki page]]
|-
|{{GVI|arma3|1.00}}
|[[User:Kju|Kju]]
|DevCon
|Debug console
|
|[https://forums.bohemia.net/forums/topic/140287-devcon-the-developer-console/ Download]
|-
|{{GVI|tkoh|1.00}}
|[[Bohemia_Interactive|Bohemia Interactive]]
| ''N/A''
|Debug console
|Debug Console capable of executing code and more.
|[[Mission Editor: Debug Console (Take On Helicopters)|Wiki page]]
|-
|{{GVI|arma2|1.00}}
|[[User:Kju|Kju]]
|DevCon
|Debug console
|
|[http://forums.bistudio.com/showthread.php?t=126249 Download]
|-
|{{GVI|arma2|1.00}}
|[https://forums.bohemia.net/profile/761667-charon-productions/ Charon Productions]
|TroopMon v3
|Debug system
|Debugging system containing informations relevant to mission-makers (especially about AI)
|[http://www.armaholic.com/page.php?id=19898 Download]
|-
|{{GVI|arma2|1.00}}
|[[User:Str|Str]]
|
|Debug console
|
|[http://temp.moricky.com/arma2/stra_debug2.rar Download]
|-
|{{GVI|arma|1.00}}
|[https://forums.bohemia.net/profile/761667-charon-productions/ Charon Productions]
|TroopMon v0.8b
|Debug system
|Complex debugging system providing lots of information for mission-makers, especially about AI.
|[http://www.armaholic.com/page.php?id=727 Download]
|-
|{{GVI|arma|1.00}}
|[[User:Str|Str]]
|
|Debug console
|available in all singleplayer missions, intros and outros. Easy and simple to use (Escape-Enter execute)
|[http://www.armaholic.com/page.php?id=549 Download]
|}
 
 
<!--
|{{GVI|arma|1.00}}
|[[User:Vektorboson|Vektorboson]]
|
|Debug console
|
|<s>[http://home.arcor.de/vektorboson/res/console_3.7z '''''DEAD LINK''''']</s>
|-
|{{GVI|arma2|1.00}}
|Chain of Command
|Binary gamefile viewer
|Tool
|Allows to check variables and script states in save files
|<s>[http://ofp.gamepark.cz/index.php?showthis=6989&newlang=eng '''''DEAD LINK''''']</s>
-->
 


[[Category:Operation Flashpoint: Editing]]
[[Category:ArmA: Editing]]
[[Category:ArmA 2: Editing]]
[[Category:Take_On Helicopters: Editing]]
[[Category:Arma 3: Editing]]
[[Category:Arma 3: Editing]]
[[Category:ArmA 2: Editing]]
[[Category:ArmA: Editing]]
[[Category:Operation Flashpoint: Editing]]
[[Category:Scripting Topics]]
[[Category:Scripting Topics]]
[[Category:Sandbox]]

Revision as of 10:32, 25 April 2019

Template:SideTOC

Debugging Techniques are ways for a developers to debug (narrow down/determine the root source), or to learn and understand where and why errors or unexpected outcomes are occurring within their code.

Template:note

Code basics

Various links about code and how to write it:

IDE and Syntax Highlight

Syntax errors are a frequent occurrence when developing scripts. Syntax highlight will help you find typos in commands and in your scripts.

An Integrated Development Environment (short IDE) is a development environment software that provides among other things code analysis, code completion and syntax highlight to help you write better, more error free code.

See further Debugging Tools page section for download links.

Errors

An error in SQF will purely and simply halt the current script, leading to unpredictable behavior. Error are not to happen as it may reduce performance as well as break a mission/feature. So if you notice an issue, address it as your script will stop.

Finding Errors

Debugging is usually as complicated as writing the actual code itself. You usually get hinted by the game, where some error happened, and what it was.
There are instances where actual error reason might be something completely different than announced (eg. you get the error on a variable being nil somewhere, but the actual error is that you mistyped it where you set it initially).

Make sure you enable Show Script Errors in the Launcher (for Arma 3) or set the corresponding -showScriptErrors startup parameter.

A script error will greet you with this box:

Script error message

It tells you what went wrong, shows a snippet of the code that failed and what file and line it occurred in (unless you used a command combination like eg. compile loadFile). Knowing this, you now can proceed to find the actual reason why that specific piece of code errored.

Template:informative

To solve an issue, you must first to became aware that of it. Aside from your script not having the desired result/effect (if any), an error message can tell you about the problem.


RPT files

The RPT is also used by the game's engine log other type of problems (low level engine issues, or content problems for example). Hence it will dump all kinds of debug information, warnings, errors as well as encountered script errors. One can also write information to it by using commands like diag_log.

The RPT file might be disabled using the Arma 3 launcher or by setting the corresponding -noLogs startup parameter (Arma 3 or Arma 2: Operation Arrowhead option)
RPT File location per game (See Crash Files for more information)
Game Location Files
Arma 3 logo black.png1.00 Arma 3 %localappdata%\Arma 3 Arma3_x64_yyyy-mm-dd_hh-mm-ss.rpt
Logo A2.png1.00 Arma 2 %localappdata%\ArmA 2 arma2.rpt
-wrong parameter ("Arma") defined!-1.00 Arma %localappdata%\ArmA arma.rpt
Logo A0.png1.00 Operation Flashpoint OFP root directory flashpoint.rpt
context.bin


Solving Errors

Once the script error is located: Make sure to check first the BiKi page corresponding to the command/function you are using to learn about potential misuse or other important information mentioned on the page!

The most simple thing you can do is to output expected values. This can be done using for example diag_log or systemChat. Output yourself a few variables that relate to your problem (for example: When the error occurs because you land in some if block, output the corresponding variables inside of the if). You continue doing this until you hit the actual problem: When variable A is not set, go to where variable A gets set and check around there, repeat and continue.

The same can be done for non-critical errors like when a method is "just" computing the wrong values.

If you're having great difficulty solving a problem, the good way is to narrow down the issue to the simplest code block possible;

or take the mission part that doesn't work, paste it into a new test mission and go from here.

Doing so will save you dealing with other scripts' potential side effects!


Common errors

Error message Cause Solution
Error Undefined variable in expression: _varName variable _varName has not been initialised properly in this context.

hint _nonExistentVar;

  • in the case of a spawned code, previous local variables are not accessible and must be passed as arguments in order to access them.
  • a variable may have been undefined (_varName = nil). Unset it after you are done using it.
Error x elements provided, y is expected A wrong number of arguments in array was provided

_unit setPos [0]; // setPos only takes an array of 2 to 3 elements

Read the wiki about said command.

Use typeName to output a variable type and compare it to the command's wiki page.
Error type x, expected y An ill-typed argument was provided.

hint 5; // must be String or Structured Text, Number provided

Error Zero divisor Pretty self-explanatory, somewhere in your code is a division by zero.

private _number = 0; private _result = 100/_number;

  • Make sure to check that your divisor is different from zero before dividing.

private _result = [100, 100/_number] select (_number != 0);

Also happens when using an invalid select index.

["a","b","c"] select 20; // index can only be 0, 1 or 2

  • Ensure your select happens within the array boundaries.
  • use selectRandom to pick a random item in an array.
Local variable in global space An attempt to private a public variable

private "myVar"; // should be "_myVar"

Replace public variable usage with private variables.
Error Generic error in expression A sleep/uiSleep/waitUntil command has been used in an unscheduled environment.

player addEventHandler ["Fired", { sleep 1; hint "bang"; }];

  • Do not use such suspending commands in unscheduled environment; a common workaround could be:

private _t = time + 5; // having to wait for 5 seconds waitUntil { time > _t };

player addEventHandler ["Fired", { [] spawn { sleep 1; hint "bang"; }; }];

Further code reading is required.
  • cut your code in smaller pieces and locate the concerned line(s).

Working with Addons

If you are working on an addon, repacking a PBO can be time-intensive. This operation can be replaced simply by creating a basic mission in the "Missions" or "MPmissions" (if your feature is multiplayer-specific) folder of your game installation, and running the mission locally. The easiest way of accomplishing this is by the use of Event Scripts to run your code such as init.sqf. Once you have tested your code this way, you can then sequentially pack your PBO when major changes have been made, rather than for each debug session of a script or piece of code.

Debugging specific sections of code

Although primitive, the combined use of diag_log, systemChat/hint and format can help to debug the content of function arguments. In the case that specific pieces of code do not run, or if specific if conditions don't appear to fire, debugging the variable content with diag_log can be useful. As with all debugging, as long as the developer is methodical and logical in checking each section of code that runs, finding bugs and resolving them can be straightforward.


Debugging Tools

Game User Addon/Toolname Category Description Link
N/A Sanjo Notepad++ SQF Text editor plugin - Notepad++ Notepad++ SQF Syntax highlighter plugin. Forum post Download
N/A K-Town Arma IntelliJ plugin IDE plugin - IntelliJ Forum post Download
N/A Armitxes SQF Language IDE plugin - Visual Studio Code Forum post Download
N/A ole1986 Arma Dev IDE plugin - Visual Studio Code Download
N/A SkaceKachna SQFLint IDE plugin - Visual Studio Code Forum post Download
N/A krzmbrzl SQDev IDE plugin - Eclipse Provides code validation (linting) while you are typing it. Forum post Download
N/A Sbsmac Squint IDE Provides a fully-featured code editor which allows for syntax highlighting, displaying of errors and code correction. Forum post Download
N/A X39 SQF VM Emulator Forum post Download
N/A Dedmen Arma Script Profiler Tool Forum post Download
N/A Dedmen Arma Debug Engine Tool Workshop link Download
Arma 3 logo black.png1.00 Bohemia Interactive N/A Debug console Debug Console capable of executing code and more. Wiki page
Arma 3 logo black.png1.00 Kju DevCon Debug console Download
tkoh logo small.png1.00 Bohemia Interactive N/A Debug console Debug Console capable of executing code and more. Wiki page
Logo A2.png1.00 Kju DevCon Debug console Download
Logo A2.png1.00 Charon Productions TroopMon v3 Debug system Debugging system containing informations relevant to mission-makers (especially about AI) Download
Logo A2.png1.00 Str Debug console Download
-wrong parameter ("Arma") defined!-1.00 Charon Productions TroopMon v0.8b Debug system Complex debugging system providing lots of information for mission-makers, especially about AI. Download
-wrong parameter ("Arma") defined!-1.00 Str Debug console available in all singleplayer missions, intros and outros. Easy and simple to use (Escape-Enter execute) Download