How to turn off player input.

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.
Post Reply
Message
Author
zendavis
Regular
Posts: 46
Joined: Thu Nov 13, 2014 2:03 pm
Contact:

How to turn off player input.

#1 Post by zendavis » Wed May 27, 2015 10:41 am

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.

zendavis
Regular
Posts: 46
Joined: Thu Nov 13, 2014 2:03 pm
Contact:

Re: How to turn off player input.

#2 Post by zendavis » Wed May 27, 2015 10:47 am

I attempted to use the code from here: http://lemmasoft.renai.us/forums/viewto ... =8&t=22458 - but it only seems to stop player input when a textbox is on the screen.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3574
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to turn off player input.

#3 Post by trooper6 » Wed May 27, 2015 1:01 pm

The code from that thread should work fine. I 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 textbook is on the screen that will work.

Code: Select all

screen my_keyes():
    #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()    
In your code, right before you want to take away the power for you player to interact with the game you just:

Code: Select all

show screen my_keys()
and when you want to give them back agency you:

Code: Select all

hide screen my_keys
You can check out the documentation of the entire keymap to see if you want to similarly disable rollback or rollforward, etc.

There is also the config.say_allow_dismiss variable (which I also use), 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.
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

User avatar
trooper6
Lemma-Class Veteran
Posts: 3574
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: How to turn off player input.

#4 Post by trooper6 » Wed May 27, 2015 1:55 pm

Thanks for that tip about the easier way to make the key statement nyaatrap!
Btw--what do you mean about renpy.transition? How would you use it to block player interaction?
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

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: How to turn off player input.

#5 Post by nyaatrap » Wed May 27, 2015 2:00 pm

Sorry I deleted my reply because I noticed he posted same topic.
renpy.transition hasn't wait so you have to use pause statement along with it. Therefore, hard pause works with transition.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], emz911, Google [Bot]