Home | A simple start. |
|
Introduction
Onyx scripts are quite strict when compiling, to avoid subtle errors that often come with more expressive languages such as PHP (where you don't have to explicitly variables, for example). Debugging is really an art form, but some general tools and tips are noted here.
Outputting debug information
To track what's going on, the echo() function is very useful to print out variable contents or just text. I.e. float f; f=123; echo(f); will output 123.
The output will be sent to Racer's console and the terminal (see Racer development in general for more information on the terminal, which can be configured to be a UDP output as well, to see debug output on a 2nd PC).
Message boxes
Use Onyx' debugDialog() command to pop up a messagebox (v090rc6+). This is quite an intrusive way of determining a point of execution, and is used for example when trying to figure out whether a script passes a certain piece of code. Often, recovering from a dialog is not that easy, so use this command sparsely.
An example is:
void f() { debugDialog("We are now in f()"); }
Debugging options in-game
Note the existence of some useful script commands:
(last updated March 25, 2013 )