DarkBasic Pro Tutorial: Debugging Errors

James Cloud
While coding in any programming language you will inevitably encounter multiple errors and warning when compiling your source code. In DarkBasic Professional these errors are comprised into four different groups or categories, Parameter mismatches or Syntax errors and Runtime warnings and errors. This article will give a brief description of each of these and tell you some helpful tips as to how to avoid and fix them.

Runtime Warnings and Errors

When receiving a runtime warning during debugging it is important to note that this warning will not show up during the use of the actual released version of the program you are working on, the command will simply fail without giving a warning. Hence, it is vital for the stability of your game or application that you correct these warnings before the final build of the game/application is distributed.

The warning itself should give sufficient information to pinpoint the origin of the code that is raising the warning, giving you the basis to correct the problem.

Runtime errors are presented when there has been an error executing the code specified in the error message. Unlike runtime warnings, runtimes errors will cause the final build to crash or close upon the raising of the error. Once again, it is very important to rectify runtime errors as your game or application will not run properly and will most likely crash itself.

Syntax Errors and Parameter Mismatches

A syntax error will be raised when the execution of a specific command or function was unsuccessfully attempted because it was not recognized or found in the built-in functions. If a syntax error is found when calling a custom made function or sub make sure it was correctly created and defined. It the error was raised while trying to execute a built-in DarkBasic Pro function make sure the function was spelled properly and you passed the proper parameters.

Note: the spelling of commands and functions is not case sensitive in DarkBasic Professional.

Parameter mismatches are received when an incorrect parameter was given to a specific command or function. Make sure your gave the correct number of parameters, in the correct order, using the correct type of parameter data. For example, a math function would not take a string, but a number or integer.

Conclusion

Using correct syntax and supplying the correct parameters should help you in avoiding most error while coding your DarkBasic Professional game or application. Always make sure to rectify all error and warnings before distributing a build to the public to maximize your application stability and potential.

Published by James Cloud

I like to program and do basically anything that has to do with technology and computers.  View profile

To comment, please sign in to your Yahoo! account, or sign up for a new account.