Questions about rollbacks and forwards

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
Strum
Veteran
Posts: 215
Joined: Mon Sep 28, 2009 10:38 am
Contact:

Questions about rollbacks and forwards

#1 Post by Strum »

Hi, I have a button that jumps to a new label and in this label I want to be able to rollback and forward through the game's text. However the text is gone when I jump to the new label. I'm using the callsinnewcontext function to jump to the new label. I'm guessing that this is wrong, so what command shall I use instead to jump to a new label while still retaining the text from the main game?

My second question is about the rollforward feature that you get when using the mouse wheel. I've tried making a button that does that but no luck. I don't know what command does that, I've tried renpy.rollforward and renpy.roll_forward but they aren't correct. What would be the correct command as used by the mousewheel?
Image

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions about rollbacks and forwards

#2 Post by Jake »

Strum wrote: I'm using the callsinnewcontext function to jump to the new label. I'm guessing that this is wrong, so what command shall I use instead to jump to a new label while still retaining the text from the main game?
Just 'jump' in Ren'Py Script, or renpy.jump in Python.

callinnewcontext creates - as the name suggests - a new game context... which means a new rollback context. It's useful for things like menus which pop up and get returned from in the middle of the game and need to exist separate from the game itself, but it's not for branching-your-plot use.
Strum wrote: My second question is about the rollforward feature that you get when using the mouse wheel. I've tried making a button that does that but no luck. I don't know what command does that, I've tried renpy.rollforward and renpy.roll_forward but they aren't correct. What would be the correct command as used by the mousewheel?

You know, off the top of my head I'm not sure such a feature exists. You can get the same effect simply by clicking anywhere else on the screen, though; since rollback is the opposite of stepping through the game, I guess the opposite of rollback is just stepping through the game?
Server error: user 'Jake' not found

Strum
Veteran
Posts: 215
Joined: Mon Sep 28, 2009 10:38 am
Contact:

Re: Questions about rollbacks and forwards

#3 Post by Strum »

There is a roll forward feature using the mouse. It cleaverly stops at the point you left off not allowing you to roll any further. Hmm, not the effect I was looking for. I only want to rollback the dialogue not all the transitions as well. Now I got characters and backgrounds rolling back too. Is there a way to only rollback the dialogue?

Also using renpy.rollback from another label only lets me rollback a single piece of dialogue before returning to the main game.
Image

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Questions about rollbacks and forwards

#4 Post by JinzouTamashii »

Since "Ctrl" is skip, you can remap "rollforward" to a "Skip" command but it will mess with people just trying to scroll down ... so I would advise against it until you want to do an interface screw.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions about rollbacks and forwards

#5 Post by Jake »

Strum wrote: There is a roll forward feature using the mouse.
Yeah, I meant "I don't think I know of a feature in the API to do that - a function you can call, rather than a way the player can do it.


However:
Strum wrote: I only want to rollback the dialogue not all the transitions as well. Now I got characters and backgrounds rolling back too. Is there a way to only rollback the dialogue?
While I've never understood why anyone would actually prefer to only roll back the dialogue and not everything, if you want this, you don't want rollback. What you want is often called 'readback', to distinguish it... Delta made a readback module a while ago, which you can find here - but since it's for a version of Ren'Py a couple of releases old, you may have to do some tweaking to make it work, if you're unlucky.
Also using renpy.rollback from another label only lets me rollback a single piece of dialogue before returning to the main game.

Do you mean it only lets you roll back a single bit of dialogue for a single call to rollback, or that you can only roll back one bit of dialogue before the rollback stops working?
Server error: user 'Jake' not found

Strum
Veteran
Posts: 215
Joined: Mon Sep 28, 2009 10:38 am
Contact:

Re: Questions about rollbacks and forwards

#6 Post by Strum »

Its a standard feature in most visual novels to only roll back the text (and I've played quite a few "Snowdrop", "Tokemeki Check In", "X Change2" to name a few all had readback feature). Hence, I too want to have that in my game. I shall have a look at the readback module you pointed out.

Edit: I had a look at that module and ugh I can't make heads or tails out of it. I guess all I can do now is request a read back feature be added to future versions of renpy to go along side roll back.
Image

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions about rollbacks and forwards

#7 Post by Jake »

Strum wrote:Its a standard feature in most visual novels to only roll back the text (and I've played quite a few). Hence, I too want to have that in my game.
Seriously, please - think about why? If you're just mimicking other VNs, then it's equally true that it's a standard feature in most Ren'Py games to roll back everything, not just the text. I'm willing to bet that a good number of existing commercial VNs only choose to only roll back the text and not the images because their programmers haven't built so advanced and capable an engine as Ren'Py is. I can't think of any good reason to throw it away, since PyTom's already provided it for you.

Ultimately, it's your VN, and you can do what you want - but I'd ask you to try and think if there's any good design reason to put extra effort into reducing the functionality of the engine and giving the player less flexibility in the way they play your VN, rather than just mimicking what you've seen others do.

After all, if we all just mimicked previous things and never tried to make anything better, we'd still be hitting things with rocks and VNs - along with computers, electricity, clothes and cooked food - wouldn't exist at all.


Edit:
Strum wrote:I guess all I can do now is request a read back feature be added to future versions of renpy to go along side roll back.
As it goes, I'm pretty sure PyTom's made it clear in the past that he doesn't have any intention of doing that, for basically the same reasons I outlined above - he doesn't understand why anyone would prefer readback to rollback, particularly from a playing point of view. Which is why Delta did it himself and released it. I was under the impression that all you needed to do for Delta's thing was include the code he provided in your project and it would just work, though?
Server error: user 'Jake' not found

Strum
Veteran
Posts: 215
Joined: Mon Sep 28, 2009 10:38 am
Contact:

Re: Questions about rollbacks and forwards

#8 Post by Strum »

Jake wrote:Ultimately, it's your VN, and you can do what you want - but I'd ask you to try and think if there's any good design reason to put extra effort into reducing the functionality of the engine and giving the player less flexibility in the way they play your VN, rather than just mimicking what you've seen others do.
To put it simpily, its down to customization, I don't want to simpily slap a story on the script file then compile it. The tools provided is nice to have but I want the option of doing things my own way too. I'm mimiking what others do simpily because I want my game to feel like a commercial one and not home brew game even if that's what it really is.
Jake wrote: I was under the impression that all you needed to do for Delta's thing was include the code he provided in your project and it would just work, though?
Unfortuantly it needs adjustment. I'm studying the code seeing what needs to be changed. I tried putting it in a blank project with only a textbutton that rollsback but no luck. I may have to give up on the idea of read back though. Its no big loss since I was able to cusomize everything else.
Image

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions about rollbacks and forwards

#9 Post by Jake »

So... you're making your UI worse just because you want to fit in with other not-so-good UIs? Looking professional is a fine ambition, but couldn't you stick to the elements where the professional products are actually better?
Strum wrote: Unfortuantly it needs adjustment. I'm studying the code seeing what needs to be changed. I tried putting it in a blank project with only a textbutton that rollsback but no luck. I may have to give up on the idea of read back though. Its no big loss since I was able to cusomize everything else.
Looking at it briefly myself, it looks like it should work as-is if you're using the mouse-wheel to roll back. Although I'd have thought you'd be able to just change your code so you call:

Code: Select all

ui.callsinnewcontext("_game_menu", "text_history_screen")
instead of renpy.rollback(), and it should do what you want?
Server error: user 'Jake' not found

Strum
Veteran
Posts: 215
Joined: Mon Sep 28, 2009 10:38 am
Contact:

Re: Questions about rollbacks and forwards

#10 Post by Strum »

Sadly that's not what I'm after, it just puts all the text into a big box. I'm after rollback but without the graphical changes and to be able to jump instantly where you left off when you exit rollback mode.

Also as you pointed out before, this is my project. If I want to make my UI worse as you put it, then that's my buisness. I am greatful for the help you provided so far but you're starting to be a bit too concerned for someone else's project. If I simpily used renpy's default features I woundn't have a single question to ask. Though maybe that's a good thing.
Image

Jake
Support Hero
Posts: 3826
Joined: Sat Jun 17, 2006 7:28 pm
Contact:

Re: Questions about rollbacks and forwards

#11 Post by Jake »

Strum wrote:Sadly that's not what I'm after, it just puts all the text into a big box. I'm after rollback but without the graphical changes and to be able to jump instantly where you left off when you exit rollback mode.
At a guess, I'd say it should be possible to edit Delta's script so that instead of calling it as part of the game menu, the show-me-the-readback-text function gets called on its own, in a new context - then it should just be a case of styling it so that it fits directly over your regular text box and obscures it... so that then, when you hit the readback button it'll just look like it's changed the regular dialogue-box text to have a scroll bar and include all the earlier text, and when you hit the button to exit readback mode, you'll drop out of the nested context and back into your game right where you left off. But that's a bit more than I have the time to do myself, I'm afraid. You could try asking Delta, see if he has any tips, he's certainly capable of it.
Strum wrote: Also as you pointed out before, this is my project. If I want to make my UI worse as you put it, then that's my buisness.
Which is why I'm still trying to help you with it, even if it's something I wouldn't do to a game myself. :P
Strum wrote: you're starting to be a bit too concerned for someone else's project.
Well, you're perfectly at liberty to ignore the bits where I suggest not using readback - but it's something of a point of interest, for me, because I've seen a fair number of people insist on using it, and so far not one of them has been able to come up with any reason other than "because big-name commercial VNs do it like that and I want to emulate them". Which to my mind, seems a bit like saying "I could easily have my car run at 60mpg, but a car from Ford runs at 30mpg if you're really lucky and I want to emulate them because they're big and commercial".

And I'm being a bit self-interested, because on one hand it seems like you're doing a lot to customise your UI, which is something IMO not enough people do and the more examples of it being done are around, the better, so I really want to help you as much as I can... and on the other hand, I find readback annoying enough when it's in bespoke engines where they probably couldn't be bothered to implement rollback, it would frustrate me to no end to be playing a game I was enjoying that I knew was written in Ren'Py, miss a graphic and want to go back only to find that the game creator had intentionally barred me from doing so just because they wanted to emulate their heroes.
Server error: user 'Jake' not found

JinzouTamashii
Eileen-Class Veteran
Posts: 1686
Joined: Mon Sep 21, 2009 8:03 pm
Projects: E-mail me if you wanna rock the planet
Location: USA
Contact:

Re: Questions about rollbacks and forwards

#12 Post by JinzouTamashii »

I'd really like to see a follow-up on the scroll wheel = move one line of dialogue forward kind of thought ... or maybe 2 scrolls to go forward the dialogue, just so they don't overshoot too far. It would be like a user-controllable skip speed, changeable immediately.
Don't worry, we can get through it together. I didn't forget about you! I just got overwhelmed.
https://cherylitou.wordpress.com

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Sirifys-Al