0
Answered

API Script - Condition with Popup

j4zz J4zzee 4 years ago in iRidium Script updated by Dmitry - support (expert) 4 years ago 5

Hello everyone - One quick question please:


I would like to set an API script condition which would do this:


If popup1 is showed,

then show popup2 and hide popup1 and popup3


If popup1 is hidden

then toggle popup 2 and 3


I tried but couldn't figure out how to set the right script.


Any help would be much appreciated,

Thank you.


Answer

Answer

In the wiki: http://wiki2.iridiummobile.net/GUI_API#IR.EVENT_ITEM_SHOW


IR.AddListener(IR.EVENT_ITEM_SHOW,IR.GetItem("Popup 1"),function()
// Event is activated when popup 1 is shown
{
IR.Log("Popup 1 is Showing");//Outputting the message in the console
IR.ShowPopup("popup2")
IR.HidePopup("popup1")
IR.HidePopup("popup3")
});



IR.AddListener(IR.EVENT_ITEM_HIDE,IR.GetItem("Popup 1"),function()
// Event is activated when popup 1 is hidden
{
IR.Log("Popup 1 is hidden");//Outputting the message in the console
IR.TogglePopup("popup2")
IR.TogglePopup("popup3")
});

Answer

In the wiki: http://wiki2.iridiummobile.net/GUI_API#IR.EVENT_ITEM_SHOW


IR.AddListener(IR.EVENT_ITEM_SHOW,IR.GetItem("Popup 1"),function()
// Event is activated when popup 1 is shown
{
IR.Log("Popup 1 is Showing");//Outputting the message in the console
IR.ShowPopup("popup2")
IR.HidePopup("popup1")
IR.HidePopup("popup3")
});



IR.AddListener(IR.EVENT_ITEM_HIDE,IR.GetItem("Popup 1"),function()
// Event is activated when popup 1 is hidden
{
IR.Log("Popup 1 is hidden");//Outputting the message in the console
IR.TogglePopup("popup2")
IR.TogglePopup("popup3")
});

Thanks for the reply - I will try this script when I get back home this evening and will keep you posted on the result.


Regards.

Hi - I tried the script and this did not work exactly I wanted it to work. However, the concept of "IR.AddListener(IR.EVENT_ITEM_HIDE,IR.GetItem" is exactly what I needed to create the conditions. I was able to get what I wanted by changing few rows. Thanks so much for the support.


Regards.