[Fixed in HTML5] Once trigger is broken per behaviors described in users guide

The flowlab “what’s this?” Users guide states the following about the Once Trigger:
Reset on Level Start
When on, this trigger will be reset when the game level is restarted. When off, this trigger will only fire once, even if the level is restarted.

This optional property is only available when object containing the behavior is set to keep on level restart or keep between levels.

However I have found this not to be the case. I have GUI layer object in a platform game I am working on that is suppose to be the life counter. I have it configured to “Keep between levels” in the objects “edit game object” menu, once triggers in this objects behavior space show the “reset on level start” config option as expected and it is not selected. However I confirmed that this once trigger does in fact fire after the level restarts.

I have also tried changing the objects config from “Keep between levels” to “Keep on level restart”. I have tried using a “restart game” and a “next level -> restart current” in both object configurations. In all cases I have confirmed the once trigger fires when my level restarts. It appears this feature is completely non-functional. Which is unfortunate because it would be a great way to implement a life counter and Flowlab is otherwise pretty great for platform games.

I hope they fix this because the work around I developed for a life counter is extremely messy.

Here is a link to try yourself, press “d” to walk forward in to the pit and die.


Hello @kellyscar - thanks for the detailed report, it does indeed look like the Once block is misbehaving. I sent you an email about this, please let me know here if you do not receive it. I’ll look into this and try to figure out what is going on.

This could be because your using an interface object instead or maybe something as a parent??
Either way though, I see your point. Maybe this could be fixed/updated later after the HTML update.

Another good way to keep numbers for life, coins, any number system is to use the save behavior.
The Save behavior makes these easier to use and manage.

Hi @grazer , I got your email and replied, did you receive it? Thanks for looking in to this!

@“JR 01” It is an GUI layer object but the once trigger still offers “reset on level start” config option in this objects behavior space since I have the object set to “keep between levels”. It has no parent object.

The work around I developed for the life counter involved the save block, thanks for the advice though! The one thing that confused me about the save block was how to initialize the value saved in them. Someone in this forum told me the are by default initialized to 0, do you know if that is true? Have you figured out a good way to manage initialization of the numbers you save?

Hey @kellyscar - I did get your emails :slight_smile:

The counter block doesn’t exactly “initialize” to anything. You can think of the Save block like a file you store a value in.

It starts out empty, and if you read the value before saving something, then it just outputs 0. Once you put a value in, then that’s the value you get out. Does that make sense?

… I’m guessing ive been gone for a LONG while

@meburningslime you only missed a half million days, youll catch up soon!

This is fixed in the latest HTML5 version