How to implement a loop guard properly?

Al_Ananias
Tue, 30 Jan 2018 22:26:50 +0000
Platform & Builds

I’m trying to do something in a blueprint, using a logic that works in any other language on Earth form ancient Greek to Ruby but that for some reason doesn’t work in blueprints. A simple loop guard. So what I do is the following:

1. Create a global counter

2. Every time the macro is executed the counter is increased by 1

3. If the counter reaches a certain level, say 1,000, it prints a text (in my case it is “==== Failsafe loopguard ====”) and quits (as in, the printstring is directly connected to the quit game node)

Quite simple right? Then when I click ‘run’ the biomass hits the fan and this is what I find in the logs:

LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====
LogBlueprintUserMessages: [TestProto3x3_C_0] ==== Failsafe loopguard ====

thousands of times. So clearly it is fundamentally ignoring my quit node. What is very interesting though, which would also be funny if it wasn’t already past 10pm, is that when I just call the quit node directly through a key or something it actually quits the game. So there is a rat here somewhere and for the life of me I can’t figure out where it is.

Any illuminating insights would be incredibly appreciated. Also, other ways to implement this loopguard watchdog would be appreciated just as much.

Thanks all,
A

3 posts - 2 participants