Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
define e = Character('Eileen', color="#c8ffc8")
screen my_keys():
#Dismiss keys
key "mouseup_1" action NullAction()
key "K_RETURN" action NullAction()
key "K_SPACE" action NullAction()
key "K_KP_ENTER" action NullAction()
key "joy_dismiss" action NullAction()
# The game starts here.
label start:
e "You've created a new Ren'Py game."
show screen my_keys()
e "Once you add a story, pictures, and music, you can release it to the world!"
hide screen my_keys
return
Then try to move past the second Eileen line. You won't be able to, proving that this method does actually work. Then we can look at what is going on with your implementation.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Find keybinds that you want to block here and add them to the screen.
zendavis wrote:Like that?
No, just put your animation/transition where """pause 5""" currently is and see if it works for you. Because you still need to somehow know when to restore controls... but you can prolly just use pause statement since they cannot be interrupted anymore.
init python:
import pygame
label start:
$ pygame.event.set_allowed(None)
$ pygame.event.set_allowed(pygame.USEREVENT)
stop sound #Stops Main Menu music
scene Black space # SCENE 01 - Black Space Introduction
with Pause(1)
play music "BG_01_Berkley_Heights_B.mp3"
with Pause(4)
scene BG01_Berkley_Heights
with Dissolve(3.4)
scene BG01_Berkley_Heights
with Pause(1)
$ pygame.event.set_blocked(None)
"I am Samantha Kurosawa and I am freezing. The winter wind cuts through me like a guillotine but I trudge onwards with relentless stubbornness. I will not be stopped tonight."
define e = Character('Eileen', color="#c8ffc8")
screen my_keys():
#Dismiss keys
key "mouseup_1" action NullAction()
key "K_RETURN" action NullAction()
key "K_SPACE" action NullAction()
key "K_KP_ENTER" action NullAction()
key "joy_dismiss" action NullAction()
# The game starts here.
label start:
e "You've created a new Ren'Py game."
show screen my_keys()
e "Once you add a story, pictures, and music, you can release it to the world!"
hide screen my_keys
return
Then try to move past the second Eileen line. You won't be able to, proving that this method does actually work. Then we can look at what is going on with your implementation.
I tested this. This looks to only work when there is text on the screen. When you remove text and only have images you can still skip through them.
zendavis wrote:I tested this. This looks to only work when there is text on the screen. When you remove text and only have images you can still skip through them.
It doesn't block user-input, it just reassigns keys while the screen is shown. Just with those keys it is to a degree useless as it will not prevent skipping (everything), will not prevent rollbacks unless implicitly disabled before the menu/preferences and skipping of animations/transitions without additional code.
But it is a LOT more gentle and you have a far better control of what user should be allowed to do... You can also mess with config.keymap/config.default_keymap which will serve in a very similar way and you can disable controls by their functionality instead of specific keys.
There are lots of ways... like with everything else in the Ren'Py. I still think best way was to use ATL for your transitions/animations with a hard or normal pause but whatever works for you
I haven't tested your code so it's hard to rewrite it, I just know that I had (a lot of) issues like yours (animation control vs user input) and always solved these things with atl (it's documented but requires a bit of getting used to and going over this forum sections for examples).
I still think hard pauses for graphics are the way to go here, with the key screen only if you need to deal with text. I looked at your original code you said wouldn't work with hard pauses:
label start:
stop sound
scene Black space
with Pause(1)
play music "BG_01_Berkley_Heights_B.mp3"
with Pause(4)
$ renpy.pause(3,hard=True)
scene BG01_Berkley_Heights
with Dissolve(3.4)
$ renpy.pause(3,hard=True)
"I am Samantha Kurosawa and I am freezing. The winter wind cuts through me like a guillotine but I trudge onwards with relentless stubbornness. I will not be stopped tonight."
Now I was a bit confused about why you had play music with a pause of 4 followed by a pause of 3. I'm going to assume this means you just want a 7 second pause. If you just write it so, you should be fine (I just tested this and it worked for me):
define odd_dissolve = Dissolve(3.4)
label start:
stop sound
scene black #you don't need your own black image, you can use the default
$ renpy.pause(1,hard=True)
play music "BG_01_Berkley_Heights_B.mp3"
$ renpy.pause(7,hard=True)
$ renpy.transition(odd_dissolve)
scene BG01_Berkley_Heights
$ renpy.pause(3,hard=True)
"I am Samantha Kurosawa and I am freezing. The winter wind cuts through me like a guillotine but I trudge onwards with relentless stubbornness. I will not be stopped tonight."
No dismissing allowed because of the hard pauses, but the game keeps going the way you wanted it to.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
I didn't even know one could use a transition over music... with Pause() is supposed to show a displayable for a specified delay, not set a pause of any kind (unless I got confused by documentation, I never used it once in almost 3 years of using Ren'Py).
At the end of the day you can do anything with Screens/ATL/UDD/DD or combination of some/all. Which one is right for the occasion you will only know from experience. But as far as the name of the thread (turning on/off player input), my suggestion does the trick
That is an unending loop the program never gets out of. Why would you want that?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Sorry for necroing this thread yet again, but for me this is a recurring issue that none of the above solutions have fixed so far.
I would have thought that a modal screen should suffice, but nope.. Modal screen, screen that turns off key inputs, screen with a transparent button that does nothing, a high zorder screen... all of these still allow user input to click straight through all my transforms. Using xela's ui shutdown acts as a hard pause for me through which the transforms refuse to act (and also prevents you from just hard-x:ing out of the application itself, to boot).
It's not just about "oh, the users need to see these nifty animations!" but I'm thinking about people like my partner, who has involuntary neurological finger twitches that frequently make him click when or where he didn't mean to. Ren'py's text rollback is great to fix that stuff, but animations are often one time only, and I just dearly want to stop for like.. eight seconds?
Any takers?