Problems with skipping transitions [SOLVED]

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
Spat915
Newbie
Posts: 7
Joined: Thu Mar 06, 2014 10:56 pm
Contact:

Problems with skipping transitions [SOLVED]

#1 Post by Spat915 » Fri Jan 15, 2016 3:22 am

Okay, so I asked something similar a while ago and couldn't figure it out.

What I wanted to do was disable all clicking and other skipping functionality that would skip a series of images fading in/out. I've tried basically everything suggested such as

Code: Select all

key "theKey" action...
and

Code: Select all

config.keymap['dismiss'].remove/append('theKey')
as well as using ATL instead of basic transitions such as dissolve, assigning a function to

Code: Select all

config.say_allow_dismiss
and probably a few other things such as combining the above.

I just want to disable the skipping of the transition, so it is forced to be viewed, then set a persistent value that is checked each time it shows up so the user can skip it.

I imagine it would look something like this with the disable/enable clicks functions defined elsewhere:

Code: Select all

label start:
    scene Black
    $ disable_clicks() #only disables if persistent says they haven't watched
    show snow with dissolve
    pause(3)
    show title with dissolve
    pause(4)
    hide title with dissolve
    pause(3)
    scene background_1 with dissolve
    $ enable_clicks() #returns if clicks are already enabled otherwise it reenables them and sets persistent value
    "Now you can click all you want because you watched everything"
I think the persistent values would be relatively simple to navigate (haven't looked into it just yet) but I really really want to get this thing to stop skipping the transition if at all possible.

I'd love it if someone could help, I'm horrible with python and relatively new using renpy (I dropped it for a while so I'm just coming back now), if you can give me a working example, or link to one, I'd really appreciate it!
Last edited by Spat915 on Sat Jan 16, 2016 2:27 am, edited 1 time in total.

User avatar
Keinart
Regular
Posts: 133
Joined: Sun May 13, 2012 8:28 pm
Completed: One Thousand Lies
Projects: Lotus Reverie
Organization: Keinart Lobre
Tumblr: keinart
itch: keinart
Location: Spain
Contact:

Re: Problems with skipping transitions

#2 Post by Keinart » Fri Jan 15, 2016 5:02 am

This is the kind of thing that it's really easy but almost impossible to find out how to do it. Just put this in your code and the player won't be able to skip neither to click in the middle of transitions:
$ _skipping = False
And just change it to true when you want it to skip again

Code: Select all

$ _skipping = True
There's also these two bad boys to help you avoid the player going to the pause menu, settings or anything like that:

Code: Select all

$_dismiss_pause = False
$ _game_menu_screen = None
Keep in mind though that the user will still be able to skip by pressing TAB. I have not find a way to avoid this but I think it's fine to still let one way to skip if the player wants to no matter what.

Now if you want to add a persistent to make it so the user can skip this transition in a new playthough for example or after loading, a rollback or anything like that:

Code: Select all

label start:
    if not persistent.disable:
        $ _skipping = False
    scene Black
    show snow with dissolve
    pause(3)
    show title with dissolve
    pause(4)
    hide title with dissolve
    pause(3)
    scene background_1 with dissolve
    $ persistent.disable = True
    $ _skipping = True
    "Now you can click all you want because you watched everything"
I think that should work. Now if you want to do this same thing more times then you have to give it different names for each, disable1, disable2, disable3, things like that. I guess there may be an easier mode if you have to do this same thing a few times in your game, but I seriously don't recommend having your players forced to see transitions all the time for a visual novel.

Spat915
Newbie
Posts: 7
Joined: Thu Mar 06, 2014 10:56 pm
Contact:

Re: Problems with skipping transitions

#3 Post by Spat915 » Fri Jan 15, 2016 10:51 am

Hi, I'm not at my computer and can't give this a try till later, but it looks promising in comparison to what I had before. I'll update once I test but thanks in advance for your help!

Spat915
Newbie
Posts: 7
Joined: Thu Mar 06, 2014 10:56 pm
Contact:

Re: Problems with skipping transitions

#4 Post by Spat915 » Sat Jan 16, 2016 2:26 am

I tested the above extensively due to my wish to remove the code to an executable function, so the results:
Functions didn't work for whatever reason, I think it had something to do with the scope of the function wasn't local to the script, meaning if they changed something, it didn't take during runtime.
As a workaround, I used labels and the call statement so all I have to do is invoke a call whenever I want either of the functions (lets face it they're basically functions).
Now, the code in the main program...

Code: Select all

call skip_off
...do the transitions...
...before the first line of text...
call skip_on
and the code with the labels...

Code: Select all

label skip_off:
    $ _skipping = False
    $ _dismiss_pause = False
    $ _game_menu_screen = None
    return
        
label skip_on:
    $ _skipping = True
    $ _dismiss_pause = True
    $ _game_menu_screen = "save" #I found this using the line "echo _game_menu_screen" in skip_off before it set it to none, and it said save_screen in the console window. I assume it goes by the labelling method of name_objectType since the menu screen was the screen save, but that's just a guess, I'm probably wrong about that.
    return
Now a little breakdown of what I found out while trying out the functions... What the two call functions do is push the current code execution onto a First in, Last out stack. Then it executes a goto statement to transfer to the label and execute that code. Once return is called, the previous execution location is popped off the stack and continues executing the same as before. That means that the call executes in the same context as where it's called rather than a new subcontext as a function would execute which is what I assume was causing my issues with code such as

Code: Select all

init python:
    def skip_off():...
So there you have what I learned and my example code in case anyone else is having trouble with this too. And a massive, massive thanks to Keinart for the help!

Post Reply

Who is online

Users browsing this forum: No registered users