neoTIP2: The AlertBox is your best/first debugging tool.
NeoBook has a very decent set of tools/facilities for Debugging your publications ... including the ability to view the content of your variables and the commands being serviced.
However, there are times ... particularly if you have Loop/EndLoop, While/EndWhile blocks of code ... or even code that is serviced inside a TimerObject ... your ability to read the happening events is not fast enough as your computer's ability to service NeoBook commands in your publication.
What is needed is some way of halting the process while you scan the debugging information available to you ... such a facility does not exist in NeoBook at the present time ... so this calls for a home-made workaround ... and I have found no better tool than the AlertBox command.
I have found this to be useful ... not only to examine the contents of specific variables at specific moments in my applications ... but also to verify if a certain code block is being serviced at all.
Consider the following ...
Now, when you run your publication ... tiny dialog boxes will popup to inform you about what is happening ... your program script will be halted until you click on the OK button or press the Enter key. By noting the sequence of pop ups, and their content ... you can easily zoom in on any pdifferences between expectations and experience.
And when you no longer need this kind of interruption, all you need to do is place one.more dots in front of the "A" within each AlertBox command ... turning them into comments that are ignored by NeoBook ... yes, you can remove the lines altogether ... but I find that if I ever have to return to this routine in the future, uncommenting the commented commands saves a lot of typing.
Here is what you would end up with ...
Note that you can not use such a workaround directly when examining the code inside a Timer object's Interval section ... this is because, while you are viewing the contents of a pop up box (usually of the order of seonds), the Interval code is being initiated at much smaller time intervals (e.g. 100 MilliSeconds) ... causing commands to be serviced out of sequence.
In such cases, it is best to log events/contents first ... then, after the Timer has been stopped, to view the previously logged information ... either with the AlertBox command ... or displaying it in a Text object that can be placed off screen when not required.
A simple method of logging information is to ...
Again, if you want to save some typing, you can make this into a custom command like ...