Page 1 of 1

How to turn off player input.

Posted: Wed May 27, 2015 10:41 am
by zendavis
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.

Re: How to turn off player input.

Posted: Wed May 27, 2015 10:47 am
by zendavis
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.

Re: How to turn off player input.

Posted: Wed May 27, 2015 1:01 pm
by trooper6
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.

Re: How to turn off player input.

Posted: Wed May 27, 2015 1:55 pm
by trooper6
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?

Re: How to turn off player input.

Posted: Wed May 27, 2015 2:00 pm
by nyaatrap
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.