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.
"I look into the fridge to get something to eat."
menu:
"Limón Cheetos.":
jump afterfood
$BP += 1
$Yummymeal += 1
"Black Licorice.":
jump afterfood
label afterfood:
if $Yummymeal == 1:
"I grab the cheetos and have a taste. They're really great today."
else:
"I grab a piece of black licorice which I only bought because someone told me to."
"I only have one bite and I already don't like it."
return
"I look into the fridge to get something to eat."
menu:
"Limón Cheetos.":
$BP += 1
$Yummymeal += 1
jump after food # this should be the last thing done, not the first
"Black Licorice.":
jump afterfood
label afterfood: # labels must be fully left aligned
if Yummymeal == 1: # leave the $ symbol off variables
"I grab the cheetos and have a taste. They're really great today."
else:
"I grab a piece of black licorice which I only bought because someone told me to."
"I only have one bite and I already don't like it."
return # not necessary
return
For this setup, I would have used pass instead of jump
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
"I look into the fridge to get something to eat."
menu:
"Limón Cheetos.":
$BP += 1
$Yummymeal += 1
pass #This pass will go to the if Yummymeal == 1:
"Black Licorice.":
pass #This pass will go to else
if Yummymeal == 1: # leave the $ symbol off variables
"I grab the cheetos and have a taste. They're really great today."
jump next_label or pass again
else:
"I grab a piece of black licorice which I only bought because someone told me to."
"I only have one bite and I already don't like it."
pass #This pass will continue on to the rest of the dialogue
jump next_label or pass again
if you do use pass again make sure the rest of code match else:
doesn't matter whether you use pass or jump in that situation, both will yield the same events. `pass` is a python statement that you put inside blocks if you want to leave them empty for now but you're planning to add something inside it later. it does exist because python blocks should contain at least one statement or expression and must not be left blank. so you could say that pass is simply just a placeholder for things.
I think I would prefer having long lines of codes that are more concise and exact to the point, rather than making it shorter but not that direct to the point. all I'm saying is that using jump in your case is much better since its more understandable on where the code should go next. but everyone has their preference for this, it's really up to you. hope that made sense.