run script with out True Level Trig?

When i code in the bge, i usually display prints in the console after i have done something (just for debugging purposes), but since i run my scripts using the Always actuator, with True Level Triggering enabled, i get too many of the same prints, is there a way to get around this?

any help appreciated

Hi! You can simply remove the true level triggering… But if you can’t, you can use:

if mySensor.status == 1: #just activated
if "init" not in own:
    own["init"] = True

Thanks very much!

Don’t use hard coded constants, use

@agoose77: It’s just really hard to write bge.logic.KX_INPUT_JUST_ACTIVATED on azerty keyboard :slight_smile: But for readability, it’s better…

As long as you have access to <ctrl+c> and <ctrl+p> it is really no problem :D.

You can also alias it to a shorter name, e.g

from bge import logic


def some_func(cont):