Go to documentation repository
...
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 the procedure once for all scripts.
Example 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 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 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 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
} |
...
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 to integers and //then all integers are added together, therefore, the sum will be 2. } |
Code Block |
---|
OnEvent("GRAY",N,"ON") //will be executed when any sensor is closed { if(strequal(N,"3") { // will be executed if this is sensor 3 } } |