stop the game quittin when u press ESC in blender player


(gorgan_almi) #1

Hiya people!

k does any1 know a way (usin python or whatever) to stop the game quitting when you press ESC in blenderplayer in full-screen mode?

i was thinkin maybe som python script to capture the ESC key event perhaps?

thanx anyway :stuck_out_tongue:

Keith.


(saluk) #2

In exe’s, you can use the game actuator to end the game when a key is pressed.


(gorgan_almi) #3

yeah i kno but how do u stop the game from ending when the ESC key is pressed, i want 2 use it 4 another purpose in my game.


(saluk) #4

In exe’s it doesn’t end automatically with esc, you have to set it up. In normal blender execuion (not exe’s) you can’t change what esc does, sorry. But if you make it an exe, you can bind esc to whatever command you want and it wont automatically quit.


(wiseman303) #5

That’s not quite true saluk, If you make your game fullscreen, it does quit when you push the escape key.


(saluk) #6

I know, he is trying to bind esc to do something instead of quit in fullscreen mode, which can’t really be done except for in exe’s.


(gorgan_almi) #7

i want 2 do it in exe’s but i cant work out how. yeah your right theres a logic brick to force the game to end but theres no logic brick to prevent the game from ending.

The game wont normally end when you press ESC if you compile it in non-full-screen mode, but in full screen mode the game ends when u press ESC just like it would if it was playing through blender. thats what i want to prevent.

Tieing the ESC event to another function is what i’d really like, but mainly i just want to stop it from exiting. cos if some1 wants to skip an animation sequence in a game their first instinct is to try pushing ESC and they’d get annoyed if that quit the game without even giving them a chance to save their progress. :slight_smile:

So how can i prevent the ESC ending the game and at the same time tie it to another function in exe’s saluk?

Cheers anyway :smiley:


(saluk) #8

Oh hehe, fullscreen exe’s. If you’ve already tried tying esc to another function, then I’m not sure how to prevent it. If it just defaults to that no matter what, bring it up with the developers at blender.org and hope they actually work on it:(


(gorgan_almi) #9

im not quite sure what you mean by tying it 2 another function. how would i do that?Theres no python equivilent of the VB subroutine…

object_keyPressed(keycode)

…is there?

and you can’t set a keyboard sensor to detect the ESC key cos when you click on the sensor to select a key pressing ESC cancels the selection. :-?


(saluk) #10

Uh, are you sure you are in 2.25? You CAN set esc in a keysensor. Click on the box, and hit esc, it will then say esc in the box. You might be getting a bug,or you might have accidentally opened the wrong blender, I dunno. But in mine I can put esc in the keysensor.

From what I can tell you can’t have esc do anything other than quit in fullscreen. I tried binding ANOTHER key to quit the game in case it was just a failsafe to make sure you have a quit option, but esc still quit the game. So it’s definately something hardcoded.


(gorgan_almi) #11

Yeah i just noticed that :smiley: i was sure it didnt work cos it never worked in 2.23 but i tried it again just now and low and behold it does work!

can’t stop blender quitting though.


(gorgan_almi) #12

theres actually 2 types of full-screen mode through, theres the proper full-screen mode that exits when you press ESC and theres the maximised version of the non-full-screen window which still displays the normal windows blue thingy at the top but it doesn’t quit when u press ESC.

Any ideas how i’d get it to maxime the non-full-screen window automatically when the game loads? I tried making a shortcut to the exe and telling the shortcut to run it maximised but it didn’t display right.

thanx 4 alll ya help though. :smiley:


(saluk) #13

Someone could probably write a compnent that loads the blenderplayer as if it were in windowed mode but puts it fullscreen, but it’s beyond me. I can’t play games in fullscreen because of a stupid refresh rate problem. Lots of stuff needs fixing:)


(gorgan_almi) #14

refresh rate problem?


(jeotero) #15

i tried too, bind esc to keysensor nothing, esc still quits the game in fullscreen mode.