Although you can use the integrated debugger to find problems in your code, there are many cases where this is not possible or is inconvenient, but it would still be nice to know what the value of a particular variable is at particular point in code, or some other information. For that, you can use the print command to display the result of an expression to the Command / Alert window. The format is the exact same as you would enter in the command line in this window using the ?. For example:
? MyVariable
? "Reached point y in sequence"
? "Value of MyVar is " + DoubleToStr(MyVar)
A single ? shows up as black in the Command/Alert window. You can change the level of print by adding addition ?'s, so ?? will show blue, ??? will show green, and ???? will show yellow. You can use the filter in the command alert to make individual print types appear / disappear. Note that red is reserved for errors and not accessible using the ? command.
As a bonus, if you double click on the message in the Command / Alert window, it will jump the script editor to the line that generated the ? statement.
If you'd like to add a horizontal line to the Command/Alert window, simply do an empty ? statement, with nothing after the question mark.
In general, you will probably only want to use the ? statement for debugging as it is somewhat slow. For this reason, DAQFactory provides a simple way to completely disable all the ? statements in all your sequences. The variable, System.SequencePrint, when set to 0, will cause all the ? statements to be skipped. When set to 1, the default, the ? statements work as described and display to the Command / Alert window. This allows you to liter your code with ? statements to help you debug, and then when everything works, you can simply set System.SequencePrint = 0 in a start up sequence to prevent the ? statements from executing and slowing your code. This does not affect ? statements performed in the command part of the Command / Alert window.
Note: if your print statement itself generates an error, for example by printing a variable that doesn't exist, an error message will be displayed instead, but unlike other errors, your script will ignore the error and move to the next line.
Note: some sequence problems are caused by timing issues. Having ? statements in your code could change the timing of the execution of various steps of your code resulting in code that works with ? statements enabled, but stops working when disabled. If this happens you should immediately assume that your problem has to do with the timing of your loops.