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.
The question here is, can I return to the start of a particular block without the use of labels?
That means, without using jump or call. That would seriously mess up my vibe, y'know.
block:
if cheeze.minutes < 60:
"It's not cheeze o'clock yet."
menu:
"Check the clock":
if cheeze.minutes > 55:
"But it will be soon."
menu:
"Go for the cheeze":
$ cheeze.minutes = 60
# Here I need it to go to the start again, to check for the cheeze time, which should now return the "else" option.
# Unless there's a way to jump to the "else" option from here?
"Play badminton":
# There's only text here, so this option leads to the badminton.
else:
"I think I'll go have a cup of coffee."
jump coffee
"Go play badminton":
# Here it goes to badminton normally, even without any jumps or calls.
else:
"Wait, I don't even like cheeze."
jump onoes
# There's badminton going on here.
I hope this example makes it clear what I need to achieve.
Last edited by Greeny on Thu Aug 05, 2010 12:43 am, edited 1 time in total.
It is certainly possible, but it requires use of a while statement, a control variable and careful attention to detail to make sure you don't get stuck in an infinite loop. Here is a simple example:
label start:
$ looping = True
while looping:
'Ohnoes, we\'re stuck in an infinite loop!'
menu:
'Do nothing':
pass
'Search for a way out':
$ looping = False
if looping:
'Halp!'
'Hooray, we got out!'
$ cheeze_action = None
while not cheeze_action:
if cheeze.minutes < 60:
"It's not cheeze o'clock yet."
menu:
"Check the clock":
if cheeze.minutes > 55:
"But it will be soon."
menu:
"Go for the cheeze":
$ cheeze.minutes = 60
"Play badminton":
$ cheeze_action = "badminton"
else:
"I think I'll go have a cup of coffee."
jump coffee
"Go play badminton":
$ cheeze_action = "badminton"
else:
"Wait, I don't even like cheeze."
jump onoes
# There's badminton going on here.