Go to documentation repository
Page History
There are 3 three standard procedures that can be performed when the corresponding event occurs:
OnInit() – —used for initialization of variables (setting initial values) that will be used in scripts. It is executed before starting all modules of the system. It is recommended to call We recommend calling the procedure once for all scripts.
Example Example of use:Code Block OnInit(){ flag=1; num=8; //variables will be initialized at startup }
OnTime(DOW (1-7), day-month-year, hours, minutes, seconds)– Running —running at specific time.
Code Block OnTime(W,D,X,Y,H,C,S) { //W - DOW (0 - Monday, 6 - Sunday); //D - date in the day-month-year format, 16 August 2001 is "16-08-01" //X,Y - reserved //H - hour //C - minutes //S - seconds // COMPARING WITH PARAMETERS, THE ACTION IS SPECIFIED FURTHER }
Examples of use:Code Block OnTime(W,"16-08-01",X,Y,"11","11","30") { //the code will be executed on 16 August, 2001 at 11:11:30 }
Code Block OnTime(W,D,X,Y,"11","11","30") { //the code will be executed every day at 11:11:30 }
Code Block OnTime(W,"16-08-01",X,Y,H,C,S) { //the code will be executed on 16 August, 2001 //every second }
Code Block OnTime(W,"16-08-01",X,Y,"11","11",S) { //the code will be executed on 16 August, 2001 //every second from 11:11 to 11:12 }
Code Block OnTime("0",D,X,Y,"21","0","0") { //the code will be executed every Monday // at 21:00:00 }
OnEvent(source type, number,event) – —running if there is a specific event from the system object. This is the main procedure of creating when writing scripts.
Examples use:Code Block OnEvent("GRAY","1","ON") { //will be executed when closing sensor 1 }
Code Block OnEvent("CAM","12","MD_START") { //will be executed when motion detection tool of camera 12 triggers }
...
The procedure parameter can be defined or not. If it is defined, then its value is in quotes, otherwise the parameter is written in the Latin alphabet letters and the procedure will be executed for all events for which it can be defined.
Examples of use:
Code Block |
---|
OnEvent("GRAY","1","ON") // will be executed when closing sensor 1 { i=1; i=i+1; //as variables are string, then the sum will be 11 j=1; j=str(j+1); // str is a number-to-string conversion function. Inside the str //function all string variables (if any) are converted tointo integers and //then all integers are added together, therefore, the sum will be 2. } |
...