Write a macro that goes to output after a frame if there was no input that frame

I need a macro that:

  1. After triggering input, launches a delay until next tick.
  2. If again triggering input, does NOT go to output.
  3. Goes to the output in the next tick after the LAST input triggering.

Input is from the tick of a widget so I need to go to the output when the ticking has been stopped. How to do this?

You can’t put latent actions in a macro.

Perhaps you could describe the actual problem you are trying to solve? Maybe someone has a solution.

That is not true.

Does nobody want to write seriously?

Bump. The topic is actual.

Double bump.

Triple bump.

im not sure we understand exactly what you mean.

if you just want to know when tick stopped you can create an event.

otherwise you can use a retriggerabledelay which will only fire if tick stops but thats an inefficient method

Which event it has to be? And what source to call it from?

depends how you turn off tick? or if the object is destroyed you can use that

It is a widget, the tick turns off when it disappears from the screen.

widgets have an EventDestruct node, or when you call it to RemoveFromParent

the tick turns off when it disappears from the screen

It sure does, unless it’s a widget component. Perhaps someone else, who can Tick, could query the widget:

image


But, most importantly:

  • why is it important to know when the widget goes off screen?
  • what are you really trying to solve?
  • what is that last Tick you’re trying to detect for?

Asking, as there may be an elegant solution to the issue you’re having rather than flooding the latent system with delays.

image

Perhaps there isn’t, but do consider elaborating on the ideal case behaviour you’re after.


I sense OP’s widget is self updating its own screen position on Tick, slides itself off-screen and is unable to return since it stops ticking - gets stuck. It’s a common scenario. I might be wrong, ofc.

This widget is not destructed or removed from parent, it is on the CanvasPanel that is larger than its viewport, and stops ticking when that CanvasPanel goes above or below its viewport.

Because I want to make one action when the widget comes onto screen and the other action when it goes off, and these two actions make no sense without each other.

Will this work when the target widget is NOT the root widget that is being hidden and stopping ticking?

What makes the widget move? How does it come and go?

Roots do not matter. Normally, you’d have a widget manager class that is ticking widgets and makes them move. Widgets are too volatile to update their own location. You can then detect when they exceed screen real estate, or query them with:

image

but then you have to set the Visibility right? and that’s your event.

It happens when the user clicks some button and the CanvasPanel changes its slot position (SetPosition node) along the viewport.

I do NOT set the Visibility. Even if I try, it will be set only on the root widget in that part of CanvasPanel, but the widget whose ticks I want to track for start and stop - is not the root and there are several tens of its instances.

So you know the location before you move the widget off-screen then. What’s the issue? Math it out - whether it exceed viewport size or not.

you can also use an Animation to move the widget which will give you a delegate for animation complete

Thanks, I will try, and I will also try the IsInViewport node. Good luck!