Debug: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(User:Dedmen -> Debug)
 
(Redirect to main page)
 
(One intermediate revision by the same user not shown)
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 before Arma 3 there were no debugging system as such available to developers similar to that which is found within an Integrated Development Environment or with other languages.
#REDIRECT [[Debugging_Techniques]]
 
== Debugging tools ==
===  Integrated Development Environments ===
Arma.Studio placeholder. Includes Script Debugger and syntax checking
 
=== 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 Arma3Server.RPT which has varying locations depending upon the type of server being run.
For scripts which are running on a client, the Arma3.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 Name>\AppData\Local\<Game Name>\).
For more Information about the RPT see [[Crash_Files]].
 
=== Debug consoles ===
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 2 ====
*[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].
 
==== Take On Helicopters ====
The game already features [[Mission_Editor:_Debug_Console_(Take_On_Helicopters)|Debug Console]] in basic installation.
 
==== Arma 3 ====
The game already features [[Mission_Editor:_Debug_Console_(Arma 3)|Debug Console]] in basic installation.
 
== General debugging techniques ==
=== 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.
<TODO load scripts via filePatching and PBO prefix>
 
=== Syntax checking and highlighting ===
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.
 
=== 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===
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).
 
[[category:ArmA: Editing]]
[[category:ArmA 2: Editing]]
[[category:ArmA 3: Editing]]
[[category:Operation Flashpoint: Editing]]
[[Category: Scripting Topics]]

Latest revision as of 07:38, 11 November 2017