# IF so long has past without interaction THEN reset to main screen...

**URL:** <https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [April 15, 2016, 1:21am UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168 "2016-04-15T01:21:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![ajvilla372](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajvilla372](https://forums.unrealengine.com/u/ajvilla372)\
**Post date:** [April 15, 2016, 1:21am UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/1 "2016-04-15T01:21:11Z")

</div>

I am making a menu system, Relatively simple stuff… However I want an IF and Statement saying that if there hasn’t been any input in a certain amount of time, then reset and go to the main menu.

However I am not sure how to do If and Then statements in blueprints in Unreal 4. Can anyone help me?

---

<div class="post-metadata">

**Author:** ![TarlRaney](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tarlraney/32/1016964_2.png) [@TarlRaney](https://forums.unrealengine.com/u/TarlRaney)\
**Post date:** [April 15, 2016, 1:57am UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/2 "2016-04-15T01:57:15Z")

</div>

Not sure of the best way to do the input part, but if statements are called Branches in BP.

---

<div class="post-metadata">

**Author:** ![ajvilla372](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajvilla372](https://forums.unrealengine.com/u/ajvilla372)\
**Post date:** [April 15, 2016, 12:23pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/3 "2016-04-15T12:23:05Z")

</div>

I thought branches were for True/False statements not IF THEN statements.

---

<div class="post-metadata">

**Author:** ![TK-Master](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@TK-Master](https://forums.unrealengine.com/u/TK-Master)\
**Post date:** [April 15, 2016, 12:44pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/4 "2016-04-15T12:44:25Z")

</div>

> [@ajvilla372;513336](#):
>
> I thought branches were for True/False statements not IF THEN statements.

It’s the same exact thing 😛 if true … do that, if false … do something else.

---

<div class="post-metadata">

**Author:** ![ajvilla372](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajvilla372](https://forums.unrealengine.com/u/ajvilla372)\
**Post date:** [April 15, 2016, 1:18pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/5 "2016-04-15T13:18:10Z")

</div>

I see what you are saying. But I think then my problem lies with I’m not sure how to code for lack of input…

---

<div class="post-metadata">

**Author:** ![Kowbell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kowbell](https://forums.unrealengine.com/u/Kowbell)\
**Post date:** [April 15, 2016, 7:00pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/6 "2016-04-15T19:00:52Z")

</div>

Make a float variable by the name of TimeSinceInteract and a bool variable called HasInteracted. In each of your input event nodes, set HasInteracted to true. For your Tick node, check if HasInteracted == true. If it is true, that means…well, the player just interacted! Set TimeSinceInteract to 0 and set HasInteracted to false. This in effect resets our counter and turns HasInteracted back off (if we didn’t do this, then if they pressed a button once, we’d keep thinking they pressed it every frame!)

If HasInteracted ISN’T true, then add the Tick’s DeltaTime to TimeSinceInteract.

After this adding bit, check if TimeSinceInteract \>= [however long the idle time is]. If so, then change the level to the main menu.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2c072083](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2c072083](https://forums.unrealengine.com/u/anonymous_user_2c072083)\
**Post date:** [April 15, 2016, 8:30pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/7 "2016-04-15T20:30:40Z")

</div>

> [@Kowbell;513579](#):
>
> Make a float variable by the name of TimeSinceInteract and a bool variable called HasInteracted. In each of your input event nodes, set HasInteracted to true. For your Tick node, check if HasInteracted == true. If it is true, that means…well, the player just interacted! Set TimeSinceInteract to 0 and set HasInteracted to false. This in effect resets our counter and turns HasInteracted back off (if we didn’t do this, then if they pressed a button once, we’d keep thinking they pressed it every frame!)
> 
> If HasInteracted ISN’T true, then add the Tick’s DeltaTime to TimeSinceInteract.
> 
> After this adding bit, check if TimeSinceInteract \>= [however long the idle time is]. If so, then change the level to the main menu.

So Event tick-\> branch (Checking "Hasinteracted) true-\>nothing False-\> Delay 10 secs-\> blah blah blah

I’m sorry I am not SUPER great at blueprinting yet,

Could you post a picture? Im not really accustomed to using float nodes yet.

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![Kowbell](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kowbell](https://forums.unrealengine.com/u/Kowbell)\
**Post date:** [April 15, 2016, 8:39pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/8 "2016-04-15T20:39:56Z")

</div>

Afraid I’m stuck on mobile through Sunday. For interface tips, check out the official tutorials on YouTube.

---

<div class="post-metadata">

**Author:** ![HaxO](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/haxo/32/1008648_2.png) [@HaxO](https://forums.unrealengine.com/u/HaxO)\
**Post date:** [April 15, 2016, 8:44pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/9 "2016-04-15T20:44:05Z")

</div>

Here is how I would do it. Every time there is an interaction the delay is reset. When it gets to zero you can do whatever you want at that point, it also will never get in the way of other functionality.

[![](https://i.imgur.com/DLXTNEs.jpg) ](https://i.imgur.com/DLXTNEs.jpg)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2c072083](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2c072083](https://forums.unrealengine.com/u/anonymous_user_2c072083)\
**Post date:** [April 15, 2016, 8:48pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/10 "2016-04-15T20:48:51Z")

</div>

> [@Kowbell;513579](#):
>
> Make a float variable by the name of TimeSinceInteract and a bool variable called HasInteracted. In each of your input event nodes, set HasInteracted to true. For your Tick node, check if HasInteracted == true. If it is true, that means…well, the player just interacted! Set TimeSinceInteract to 0 and set HasInteracted to false. This in effect resets our counter and turns HasInteracted back off (if we didn’t do this, then if they pressed a button once, we’d keep thinking they pressed it every frame!)
> 
> If HasInteracted ISN’T true, then add the Tick’s DeltaTime to TimeSinceInteract.
> 
> After this adding bit, check if TimeSinceInteract \>= [however long the idle time is]. If so, then change the level to the main menu.

 ![Help with time.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/9/99aa4c99de9c81c0cf172b257a7b6686f942fa22.jpeg)

Something like this?

Could you post a picture… Im still abit new to floats.

---

<div class="post-metadata">

**Author:** ![ajvilla372](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ajvilla372](https://forums.unrealengine.com/u/ajvilla372)\
**Post date:** [April 15, 2016, 9:01pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/11 "2016-04-15T21:01:44Z")

</div>

This worked awesome! Thank you!!!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_2c072083](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_2c072083](https://forums.unrealengine.com/u/anonymous_user_2c072083)\
**Post date:** [April 15, 2016, 9:02pm UTC](https://forums.unrealengine.com/t/if-so-long-has-past-without-interaction-then-reset-to-main-screen/61168/12 "2016-04-15T21:02:31Z")

</div>

> [@HaxO;513642](#):
>
> Here is how I would do it. Every time there is an interaction the delay is reset. When it gets to zero you can do whatever you want at that point, it also will never get in the way of other functionality.
> 
> [http://i.imgur.com/DLXTNEs.jpg](http://i.imgur.com/DLXTNEs.jpg)

This worked AWESOME THANK YOU
