First off, i have little to no prior experience in programming (it starts only next year for my school course), so i am not exactly familiar with the logics of programming (so i would like you to explain the concepts as simple as possible).
The problem: Let's imagine the following scenario - i have a time based system for my application/game, where a variable is increased by 1 every second up until it hits 10, then it is brought back to 0, creating a looping clock or something similar.
Let's say, that i want to have an object spawned for every time the variable is 5.
If i put a simple "while true" condition, then the object will be spawned every tick for the duration of the second, which is likely to spawn way more objects, than i need. If i add a "trigger once while true" condition, then the object will be spawned only for the first iteration, meaning, that the second time the clock hits 5, nothing will happen.
//Mistake here: i misinterpreted the "trigger once while true" condition, however i made an example at the bottom of this page.
Is there an efficient way, to trigger an action to execute only once per occurrence of the conditions being true? (that doesn't require creation of extra variables, local variable or such?)
What i have tried (inneficient method):
1.) Creating a variable "is triggered" and putting "is 1?" in the conditions for my event.
2.) Putting "set to 0" in the actions of my event.
3.) Somehow resetting the variable to 1 after conditions are no longer true.