"IF" and "ELSE IF" for the data received. Change Item by receiving some Value
You have to to use this example to make a condition in your script:
Conditions in iRidium must be performed inside of EVENTS, which allows you to use some data, generated by events:
EVENT_TAG_CHANGE sends you a name and value of the Driver's Feedback in your project, which changes now. So, you can use a name of the feedback and value of this feedback in your conditions.
if (condition1 && condition2) { <action> };
Conditions in iRidium must be performed inside of EVENTS, which allows you to use some data, generated by events:
IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice("MyDriver"), function(name,value) { <action> });
EVENT_TAG_CHANGE sends you a name and value of the Driver's Feedback in your project, which changes now. So, you can use a name of the feedback and value of this feedback in your conditions.
IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice("MyDriver"), function(name,value) { if (name == "Feedback 1" && value == 100) { IR.Log("got 100 from Feedback 1"); IR.GetItem("Page 1").GetItem("Item 1").Value = 1; //got 100 but set 1 in Item } else if () { IR.Log("got something else"); } });
Customer support service by UserEcho