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.
One thing I've noticed is that, left to it self, Renpy runs off the end of the current scene and straight into the next one. Which is very useful if you're doing a pure VN of course, but if your project is driven by screen interaction, you need to suspend the narrative until the player clicks on something.
What's the recommended way to do this? The approach I've been using is:
That jumps out of the pause if the user clicks a button with a jump action, the pause should keep it from running too hot, and the loop means that if the user clicks around randomly we stay in the loop. It's just seems a little ... inelegant, I suppose.
Is there a better idiom for this sort of thing? Purely out of curiosity.
Renpy will not continue until you click, thats how it works.
If your game is continuing automatically, are you sure AFM is not enabled? (auto forward mode)
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
But if it gets to the end of a section of narrative, it runs off the end of that and onto the next one. If I jump it somewhere else, it continues down the file looking for narrative to display. I need a way to get it to stop talking and wait for a button press.
I was curious how others had handled it.
[edit]
Nevermind: the tutorials main menu does exactly what I wanted.
Basically, I have a UI panel with buttons to move, talk, etc, and I put that up with call rather than show.
So this means that the UI gets displayed and execution waits until it gets a click. Then I return back with a label string. Then I do some bookkeeping, call the label and when that returns I loop back and call the UI again.
I'll post some code in a bit (not at my dev machine right now) but that's the essence of it.
Sorry to take so long - things have been a bit hectic. "ibox" is my interaction box - currently just three buttons for look, talk, map. I call the screen and it returns either "map" or else a label string based on chapter and location variables. So if the location (set by the map screen) was "bar" then it might return "explore_bar_talk"
# The game starts here.
label start:
call chargen
call prologue
#
# set some useful variables
#
$ __first_loop = True
$ game.chapter = "explore"
#
# OK: explore activity loop
#
while True:
call screen ibox
#
# if it's the map button, we need to show the map GUI and get a button click from that
# let's wrap that in one call
#
if _return.kind == "map":
call do_map_screen
#
# otherwise, the label string will match a label based on chapter and current location
#
else:
call expression _return.label_str pass(_return) from __stuffy_func
# and then we go round again
# I need to think about how to break out of this properly.