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.
-
suihakei
- Newbie
- Posts: 21
- Joined: Sun Jun 23, 2019 12:12 pm
-
Contact:
#1
Post
by suihakei » Tue Feb 08, 2022 11:12 am
I would like to create the function to go back to one previous choice.
I found renpy.checkpoint and ran it immediately.
https://www.renpy.org/doc/html/save_loa ... checkpoint
However, if I run the code as follows, the game will stop.
Code: Select all
human "hey"
$ roll_forward = renpy.roll_forward_info()
$ rv = ui.interact(roll_forward=roll_forward)
$ renpy.checkpoint(rv) # stop game here
human "hello"
Why is this?
Isn't renpy.checkpoint for temporary data saving and rollback?
I would like to learn more about RenPy.
If you know anything about it, please let me know.
Thank you.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Tue Feb 08, 2022 11:29 am
What is the purpose of ui.interact here? Have you actually placed anything for player to interact with? Why are you using renpy.checkpoint in one-line Python statement? FYI, there are 6 calls to renpy.checkpoint in snippet you provided, because every RenPy statement implicitely calls one.
< < insert Rick Cook quote here > >
-
Johan
- Regular
- Posts: 75
- Joined: Mon Jan 14, 2019 5:58 pm
- Projects: "And I saw the stars falling down..."
- Organization: Novel & You
- itch: johanww
- Location: Perú
- Discord: Johan#7444
-
Contact:
#3
Post
by Johan » Tue Feb 08, 2022 11:55 am
I would like to create the function to go back to one previous choice.
Uhm... without knowing the actual code of your game, I can only say that if you want to go back to a previous menu choice, you could just rollback to it. No need for any complicated stuff.
Or you could
jump to it, but only if you give the menu a name.
Code: Select all
menu the_name_of_doom:
"A":
"go back and try again"
jump the_name_of_doom
"B":
"you did it!"
jump random_scene
I'm not sure if this is what you are looking for though ^^;;
-
suihakei
- Newbie
- Posts: 21
- Joined: Sun Jun 23, 2019 12:12 pm
-
Contact:
#4
Post
by suihakei » Tue Feb 08, 2022 12:08 pm
Ocelot wrote: ↑Tue Feb 08, 2022 11:29 am
What is the purpose of
ui.interact here? Have you actually placed anything for player to interact with? Why are you using
renpy.checkpoint in one-line Python statement? FYI, there are 6 calls to
renpy.checkpoint in snippet you provided, because every RenPy statement implicitely calls one.
Thank you for your answer.
I used these codes as they were written in the official documentation.
However, I do not know how this works.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#5
Post
by Ocelot » Tue Feb 08, 2022 12:14 pm
Generally, renpy.checkpoint is only nessesary if you are doing something really complex not involving RenPy script and want to be able to rollback inside of it.
Almost every RenPy statement will do rollback management itself so nothing extra is nessesary.
< < insert Rick Cook quote here > >
-
suihakei
- Newbie
- Posts: 21
- Joined: Sun Jun 23, 2019 12:12 pm
-
Contact:
#6
Post
by suihakei » Tue Feb 08, 2022 12:14 pm
Johan wrote: ↑Tue Feb 08, 2022 11:55 am
I would like to create the function to go back to one previous choice.
Uhm... without knowing the actual code of your game, I can only say that if you want to go back to a previous menu choice, you could just rollback to it. No need for any complicated stuff.
Or you could
jump to it, but only if you give the menu a name.
Code: Select all
menu the_name_of_doom:
"A":
"go back and try again"
jump the_name_of_doom
"B":
"you did it!"
jump random_scene
I'm not sure if this is what you are looking for though ^^;;
Thank you for your answer.
if you want to go back to a previous menu choice, you could just rollback to it.
How can this be achieved?
However, I believe that renpy.checkpoint is needed to do rollback.
As an alternative approach I am also thinking of using $ renpy.save('hidden_save') and $ renpy.load('hidden_save') to achieve this.
-
Ocelot
- Eileen-Class Veteran
- Posts: 1882
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#7
Post
by Ocelot » Tue Feb 08, 2022 12:25 pm
suihakei wrote: ↑Tue Feb 08, 2022 12:14 pm
How can this be achieved?
However, I believe that renpy.checkpoint is needed to do rollback.
Rollback and rollforward are literally achieved by scrolling mousewheel. It is integral feature of RenPy.
< < insert Rick Cook quote here > >
-
suihakei
- Newbie
- Posts: 21
- Joined: Sun Jun 23, 2019 12:12 pm
-
Contact:
#8
Post
by suihakei » Tue Feb 08, 2022 9:06 pm
Ocelot wrote: ↑Tue Feb 08, 2022 12:25 pm
suihakei wrote: ↑Tue Feb 08, 2022 12:14 pm
How can this be achieved?
However, I believe that renpy.checkpoint is needed to do rollback.
Rollback and rollforward are literally achieved by scrolling mousewheel. It is integral feature of RenPy.
Thank you for your answer.
I see, rollback and rollforward are executed by mouse rotation.
On the other hand, when do we use renpy.checkpoint?
-
Imperf3kt
- Lemma-Class Veteran
- Posts: 3636
- Joined: Mon Dec 14, 2015 5:05 am
- Location: Your monitor
-
Contact:
#9
Post
by Imperf3kt » Tue Feb 08, 2022 10:21 pm
It is an internal function. Generally you would never use it unless you were attempting to do something renpy isn't designed to do.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project:
GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
-
suihakei
- Newbie
- Posts: 21
- Joined: Sun Jun 23, 2019 12:12 pm
-
Contact:
#10
Post
by suihakei » Mon Feb 14, 2022 10:12 am
Imperf3kt wrote: ↑Tue Feb 08, 2022 10:21 pm
It is an internal function. Generally you would never use it unless you were attempting to do something renpy isn't designed to do.
Ah, I see, you're right!
Thank you!
Now, I'll use the rollback function as usual.
Users browsing this forum: Bing [Bot]