0
Under review

Listener for status change?

AlejandroG 4 years ago updated by Vladimir Ovchinnikov (expert) 4 years ago 5

Hello,

Is there a way in iridium script to  add a listener for every time an item changes its status?

I added an script call to a function every time the circular level is moved, but I want to call the function only when the status changes.

Thanks

Under review

Hello.

IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function(name, value)
{
IR.Log("Global Listener Activated: " + name + "\tValue: " + value);
});
IR.SubscribeTagChange("UI.Page 1.Item 2.Value");

The listener is triggered when the Value is changed.

Thank you, 

But I would like to trigger a listener when the status of a multistate lever is changed, not the value.

Hello.

Item does not have this property. Available properties are listed here. Please specify what you mean by status.

sorry, I ment state, not status 

+1

Hello.

For EditBox, there is an EVENT_ITEM_CHANGE event that is triggered when you enter text in EditBox. Similar events are not provided for other Item types. You can use SetInterval to do GetState, but this is a suboptimal solution to the problem.