Go to documentation repository
The Clone method creates a copy of an a MsgObject or Event and Event object.
Method call syntaxSyntax for method invocation:
| Code Block | ||
|---|---|---|
| ||
function Clone() : MsgObject |
Method arguments: There are no method arguments.
Usage examples
ProblemExample. When Relay №1 relay 1 closes, start video recording from Camera on camera 1 and close Relay №2relay 2. When Relay №1 relay 1 opens, start video recording from Camera on camera 2 and open Relay №2relay 2.
| Code Block | ||
|---|---|---|
| ||
if (Event.SourceType == "GRELE" && Event.SourceId == "1")
{
var msgevent = Event.Clone();
if(Event.Action == "ON")
{
msgevent.SourceId = "2";
DoReact(msgevent);
DoReactStr("CAM","1","REC","");
DoReactStr("GRELE","2","ON","");
}
if(Event.Action == "OFF")
{
msgevent.SourceId = "2";
DoReact(msgevent);
DoReactStr("CAM","2","REC","");
DoReactStr("GRELE","2","OFF","");
}
} |