Documentation for Intellect 4.10.4. Documentation for other versions of Intellect is available too.
- Set a general task.
- Outline the task into subtasks.
- Write subtasks and debug them.
- Find and fix bugs.
Setting a general task
There should be a clear vision of what is to be done in the system as a result of specific events. Specify the ID of devices that participate in creating events and actions.
Outlining the task into subtasks
If several events are to be processed in one task, then it must be clear what to do with each event. If possible exclude the possibility of loop script execution, i.e. exclude any recursive actions if they are not related to task execution.
Writing subtasks and debugging them
The most difficult part of writing scripts is creating the list of actions with possible use of logic and loop operations. Debugging of this part of programming takes much time. Events generation that needs processing is not usually easy-to-use, especially on a real object, for example fire sensor triggering - from the server to the system core. In this case, it is recommended to generate an event manually at the stage of debugging, the best way is to run an empty macro. After the body of the script is debugged there is a real event instead of running the empty macro. Moreover, one may check and vice versa - make sure whether the event is written correctly events without starting the action list – run an empty macro and watch its performance in the debug window.
Finding and fixing bugs
At startup embedded syntax analyzer checks if names of functions are spelled correctly, but does not check the position of key characters - commas, semicolons and nested parentheses, etc. In order to track the bugs in the program, if any, it is necessary to activate the Debug 4 debug mode (see Selecting and enabling the debug mode of Intellect software). In there are syntax errors, the Critical errors window will be displayed at the stage of the program body execution. This window lists the names of functions with incorrect syntax and other debugging information.
If the syntax is correct, but the program still does not work or works with errors, it is recommended to rewrite the program in JScript (see Programming Guide (JScript)).