Exit in Python

it is a shame but i cant find the code that simply ends the Game engine,
i do NOT mean doing it with the actuators.

exit()

was what i was thinking of but… i dont think its all its needed here

greets Equal

exit() ends Blender.
The GameActuator ends the BGE.

I do not know what you could mean.

i mean a simple code that ends the bge

like

 if bla is true:
bge.end()

so that i dont have to set up a actuator to ent the bge.

greets equal

Try bge.logic.getCurrentScene().end(), maybe removing the active scene ends the GE.

Unfortunately this isn’t doable in 2.49 without logic bricks. In 2.50 however, you can do this:


import bge

if foo:
    bge.logic.endGame()

That function isn’t in the API docs btw.

I do not understand the problem to use the actuator.

so even a monster pro-programmer like you dont understand all :wink:

but thx for all the informations, well it looks like i have to set up an actuator.

the situation was like this, i have some stuff ongoing in a very short time, so when the
specific situation (the bug) happens, other things build extremly fast up on this, making it imposible for me, to find out what is wrong.
a INSTANTLY end would help me, btw i dont like logic brinks >.>

anyway thx and greets equal

You are so true :D.

It seems the requested function is sys.exit() .
Be warned it quits Blender as well (inkl. console).

I had the exit() by mistake before and loosing all my work. I thought it was just exit(). I remembered not to use it ;).

If your bug is a problem with a script, you might better put everything into a function and use return to exit the function.