How to turn on and off player input.
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.
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.
How to turn on and off player input.
Basically for my transition sequences. For example when the game fades to black in order to control pacing I want to turn off player input so that when the player clicks on the screen their input does nothing and the game continues through its fade to black transition without being skipped through.
But the game shouldn't out and out pause. It will keep playing through the code written in the script file. Just that the player input is turned off so they can't skip through things. Then when we come back to text box and narrative I would give the player control again so they can click through it once more.
http://i.imgur.com/LUnAPFg.png
The problem with $ renpy.pause(3,hard=True) is that it outright freezes the game rather than turns off player input. So if I use $ renpy.pause(50,hard=True) then the game will pause and freeze for 50 seconds instead of continuing playing for the next 50 seconds with player input turned off. So in this code now here the game will freeze at line 38 and never move on to line 39 for fifty seconds:
http://i.imgur.com/QxY1bCK.png
I'm looking to turn off player input but have the game keep going through the lines.
But the game shouldn't out and out pause. It will keep playing through the code written in the script file. Just that the player input is turned off so they can't skip through things. Then when we come back to text box and narrative I would give the player control again so they can click through it once more.
http://i.imgur.com/LUnAPFg.png
The problem with $ renpy.pause(3,hard=True) is that it outright freezes the game rather than turns off player input. So if I use $ renpy.pause(50,hard=True) then the game will pause and freeze for 50 seconds instead of continuing playing for the next 50 seconds with player input turned off. So in this code now here the game will freeze at line 38 and never move on to line 39 for fifty seconds:
http://i.imgur.com/QxY1bCK.png
I'm looking to turn off player input but have the game keep going through the lines.
Re: How to turn on and off player input.
You could try overwriting keybinds for a while or using a bunch of hard pauses instead of one really long one.
Re: How to turn on and off player input.
How do I overwrite keybinds?
Re: How to turn on and off player input.
Several ways but no one-liners that I am aware of, there are many posts like this one:
http://lemmasoft.renai.us/forums/viewto ... ut#p259990
Just go through forums...
http://lemmasoft.renai.us/forums/viewto ... ut#p259990
Just go through forums...
Re: How to turn on and off player input.
But according to that post the person in question never actually got it working. Is there actually a way to turn off player inputs and bring it back?
This code does nothing but freeze the UI when I use it.
This code does nothing but freeze the UI when I use it.
Code: Select all
$ narrator("You can't get rid of this message!", interact=False)
$ ui.pausebehavior(5) -
$ ui.interact(suppress_overlay = True, suppress_underlay = True)
Last edited by zendavis on Wed May 27, 2015 12:53 pm, edited 1 time in total.
Re: How to turn on and off player input.
? But he was told how to solve it, block all user input by showing a screen or suppress the overlays. I never did either but there shouldn't be a reason for it not to work.
You can use multiple hard pauses instead of one long one.
You can use multiple hard pauses instead of one long one.
Re: How to turn on and off player input.
Trouble is that you need a good deal of know-how in order to do this properly... "DISABLE USER INPUT" means disabling all input... player will not even be able to turn the game of until you restore controls so you need to know what you're doing.
Last edited by xela on Wed May 27, 2015 1:00 pm, edited 1 time in total.
Re: How to turn on and off player input.
Hard pauses mess up transitions. For example:xela wrote:? But he was told how to solve it, block all user input by showing a screen or suppress the overlays. I never did either but there shouldn't be a reason for it not to work.
You can use multiple hard pauses instead of one long one.
Code: Select all
label start:
stop sound
<---------Turn Off Left-Clicking Here
scene Black space
with Pause(1)
play music "BG_01_Berkley_Heights_B.mp3"
with Pause(4)
scene BG01_Berkley_Heights
with Dissolve(3.4)
<---------Turn On Left-Clicking Here.
"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."
Code: Select all
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."
Re: How to turn on and off player input.
Yeah... but you can declare all of that as a single images and put the sounds between two hard-pauses. Use ATL instead of the ancient Pause statement.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: How to turn on and off player input.
The code from that thread should work fine. I used to use a version of it myself.
You create a screen that takes away all player agency by removing the dismiss actions, and then you show that screen when you want to the player to have no agency. Even when no textbox is on the screen that will work.
In your code, right before you want to take away the power for you player to interact with the game you just:
and when you want to give them back agency you:
You can check out the documentation of the entire keymap to see if you want to similarly disable rollback or rollforward, etc.
http://www.renpy.org/doc/html/keymap.html
There is also the config.say_allow_dismiss variable (http://www.renpy.org/doc/html/config.ht ... ow_dismiss) which I have used to great effect...that effect being a more nuanced way in dealing with how control works and the consequences of that control...but I think you seem to want to take away all user ability to interact with the game...so they key screen is the way to go. Note: some players will hate this...especially on second or third play throughs.
You create a screen that takes away all player agency by removing the dismiss actions, and then you show that screen when you want to the player to have no agency. Even when no textbox is on the screen that will work.
Code: Select all
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()
Code: Select all
show screen my_keys()
Code: Select all
hide screen my_keys
http://www.renpy.org/doc/html/keymap.html
There is also the config.say_allow_dismiss variable (http://www.renpy.org/doc/html/config.ht ... ow_dismiss) which I have used to great effect...that effect being a more nuanced way in dealing with how control works and the consequences of that control...but I think you seem to want to take away all user ability to interact with the game...so they key screen is the way to go. Note: some players will hate this...especially on second or third play throughs.
Last edited by trooper6 on Wed May 27, 2015 1:18 pm, edited 1 time in total.
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?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*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?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: How to turn on and off player input.
LoL I think I figured it out!!!!! Hold on
Troopers way is the screen way I mentioned earlier, this is another option:
You can bind that to simple functions so you do not have to type it out all the time. This could in theory have sideeffects as well. Do note that you take controls from player completely and only allow code to proceed (that usually pissed people off (A LOT)).
Troopers way is the screen way I mentioned earlier, this is another option:
Code: Select all
init python:
import pygame
label start:
$ pygame.event.set_allowed(None)
$ pygame.event.set_allowed(pygame.USEREVENT)
pause 5
$ pygame.event.set_blocked(None)
"LoL"
Last edited by xela on Wed May 27, 2015 1:27 pm, edited 2 times in total.
Re: How to turn on and off player input.
Code: Select all
## IT FOLLOWED US HOME DEMO Visual Novel Game Script
## Code by: Zen Davis
## 05.21.15
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()
#GAME RESOLUTION
init python:
config.screen_width = 1280
config.screen_height = 720
#MENUS
image splash: #Zen Davis Splash Screen Image"
contains:
"BG_Splash_Zen_Davis.jpg"
size(1280, 720)
image splash2: #Zen Davis Splash Screen Image With The Word Presents Added
contains:
"BG_Splash_Zen_Davis_Presents.jpg"
size (1280, 720)
image Black space: #Black image to use in case scene is required to be pitch black.
contains:
"BG_Black_Space.jpg"
size(1280, 720)
label splashscreen: #Splash Screen Implementation Including Animations + Dissolve
scene black
play sound "BG_00_Intro.mp3"
with Pause (3)
show splash with dissolve
with Pause (3)
scene splash2 with dissolve
with Pause(3)
scene black with dissolve
with Pause(1)
return
label main_menu: #Main Menu Dissolve
with None
$ renpy.transition(slowdissolve)
jump main_menu_screen
with dissolve (8)
#BACKGROUNDS
image BG01_Berkley_Heights:
contains:
"BG_01_Berkley_Heights.jpg"
size(1280, 720)
label start:
#SCENE01 - PRLOGUE
show screen my_keys()
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)
hide screen my_keys
I'm still able to skip through to the end. I'm also using Renpy 6.99 in case that makes a difference. What am I doing wrong?
Re: How to turn on and off player input.
You need to block skipping key as well in that screen if you use that (screen) way. I've added another option while you were posting*zendavis wrote:I'm still able to skip through to the end.
Re: How to turn on and off player input.
How do I block the skipping key?xela wrote:You need to block skipping key as well in that screen if you use that (screen) way. I've added another option while you were posting*zendavis wrote:I'm still able to skip through to the end.
Re: How to turn on and off player input.
I'm a little confused as to how I implement it.xela wrote:LoL I think I figured it out!!!!! Hold on
Troopers way is the screen way I mentioned earlier, this is another option:
You can bind that to simple functions so you do not have to type it out all the time. This could in theory have sideeffects as well. Do note that you take controls from player completely and only allow code to proceed (that usually pissed people off (A LOT)).Code: Select all
init python: import pygame label start: $ pygame.event.set_allowed(None) $ pygame.event.set_allowed(pygame.USEREVENT) pause 5 $ pygame.event.set_blocked(None) "LoL"
Code: Select all
define gamepause = init python:
import pygame
label start:
$ pygame.event.set_allowed(None)
$ pygame.event.set_allowed(pygame.USEREVENT)
pause 5
$ pygame.event.set_blocked(None)
"LoL"
Who is online
Users browsing this forum: Google [Bot]