Nifty interact events cancelling eachother out

Hi,

I was working on a GUI and got a bit confused. I wanted to test out triggering of different nifty events, and I added the following to my simple nifty panel:

[xml]

[/xml]

I used to only have onClick events, but when adding this all events cease working. By commenting in and out different events, I found that there is a long list of events that cancel each other out. For instance if I have
onClick and onRelease - onRelease is the only event to trigger
onClick and onClickMouseMove - onClickMouseMove is the only event to trigger

Is the to be the expected behavior? And is there any resource that lists which events work together?

1 Like

I’m having a similar issue. I’m trying to make a loading screen with a start/end effect. However if the loading is completed before the effects finish… the result is that the switch screen statement gets ignored. (thus the player stays on the loading screen instead of being shown the game hud screen)

It seems instead doing anything to “enqueue” effects or events, the system just completely ignores them if the state of the GUI isn’t prepared for it. As far as I can tell the only thing you can do is some manual checks and/or write code in a way to make sure there is no overlapping.

I randomly found the solution today ( many months later )… For any future monkeys with similar issues, here it is. In XML to setup multiple interacts, you need to define them in the same xml statement.

Correct:
[xml]
<interact onMouseOver=“onMouseOver()” onPrimaryRelease=“onButtonReleased()” onPrimaryClick=“onButtonClicked()” />
[/xml]

Incorrect, each statement will overwrite, making only the last statement effective.
<span style=“text-decoration:line-through;”>[xml]
<interact onMouseOver=“onMouseOver()”/>
<interact onPrimaryClick=“onButtonClicked()”/>
<interact onPrimaryRelease=“onButtonReleased()”/>
[/xml]
</span>

3 Likes

Ahh, that’s useful to know :slight_smile: