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.
scene about_to_leave
t "Okay, class will end in five minutes, please pack your things."
"You pass your note to Kiki hastily." if selection == "kiki_noteg":
"You pass your note to Puki hastily." if selection == "puki_noteg":
"You pass your note to Naname hastily." if selection == "naname_noteg":
"You pass your note to Hiro hastiy." if selection == "hiro_noteg":
"You pass your note to Ameko hastily." if selection == "ameko_noteg":
"You pass your note to Irashi hastily." if selection == "irashi_noteg":
scene about_to_leave
t "Okay, class will end in five minutes, please pack your things."
if selection == "kiki_noteg":
"You pass your note to Kiki hastily." if selection == "kiki_noteg":
scene about_to_leave
t "Okay, class will end in five minutes, please pack your things."
if selection == "kiki_noteg":
"You pass your note to Kiki hastily." if selection == "kiki_noteg":
if selection == "puki_noteg":
"You pass your note to Puki hastily." if selection == "puki_noteg":
if selection == "naname_noteg":
"You pass your note to Naname hastily." if selection == "naname_noteg":
if selection == "hiro_noteg":
"You pass your note to Hiro hastiy." if selection == "hiro_noteg":
if selection == "ameko_noteg":
"You pass your note to Ameko hastily." if selection == "ameko_noteg":
if selection == "irashi_noteg":
"You pass your note to Irashi hastily." if selection == "irashi_noteg":
When you write the new block of code(for example, in 'if' statement or 'label' statement) you should add indentation. In other cases it will cause the error. Well, maybe I've written something unclear, because my english is bad, so, if someone have seen any mistakes in my message, please tell about it Try this code:
scene about_to_leave
t "Okay, class will end in five minutes, please pack your things."
if selection == "kiki_noteg":
"You pass your note to Kiki hastily."
if selection == "puki_noteg":
"You pass your note to Puki hastily."
if selection == "naname_noteg":
"You pass your note to Naname hastily."
if selection == "hiro_noteg":
"You pass your note to Hiro hastiy."
if selection == "ameko_noteg":
"You pass your note to Ameko hastily."
if selection == "irashi_noteg":
"You pass your note to Irashi hastily."
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.
Did you try Yuuji's code? Follow Yuuji's example and everything should work fine. Also, in my opinion, only one of those lines should display, right? Then, maybe you should modify Yuuji's code as this:
scene about_to_leave
t "Okay, class will end in five minutes, please pack your things."
if selection == "kiki_noteg":
"You pass your note to Kiki hastily."
elif selection == "puki_noteg":
"You pass your note to Puki hastily."
elif selection == "naname_noteg":
"You pass your note to Naname hastily."
elif selection == "hiro_noteg":
"You pass your note to Hiro hastily."
elif selection == "ameko_noteg":
"You pass your note to Ameko hastily."
elif selection == "irashi_noteg":
"You pass your note to Irashi hastily."
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
label start:
scene bg1 #this is just sample background
"Okay, class will end in five minutes, please pack your things."
"You pass your note to Kiki hastily."
$selection = "puki_noteg" #'selection' should be initialized before using
if selection == "kiki_noteg":
e "You pass your note to Puki hastily."
if selection == "puki_noteg":
e "You pass your note to Naname hastily."
if selection == "naname_noteg":
e "You pass your note to Hiro hastiy."
if selection == "hiro_noteg":
e "You pass your note to Ameko hastily."
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.
shivanshs9 wrote:Then, maybe you should modify Yuuji's code as this:
Yeah, you code is more optimizied, so it'd be better to use it.
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.
My bad, I meant to delete the if statement coming at the end of the line and forgot to.
Just to be perfectly explicit, use the if statement followed by a colon, line break, indent, and then DON'T repeat the if statement at the end of the dialogue string. Or, you know, copy/paste.
I don't think it really makes a difference whether you use elif vs. if in this context -- as the variable 'selection' can only be one thing at a time.
label start:
scene bg1 #this is just sample background
"Okay, class will end in five minutes, please pack your things."
"You pass your note to Kiki hastily." # <- This line means that it will always display, no matter what
$selection = "puki_noteg" #'selection' should be initialized before using
# I think selection is already defined in a previous menu(my guess), so aren't you overwriting the value?
if selection == "kiki_noteg":
e "You pass your note to Puki hastily."
if selection == "puki_noteg":
e "You pass your note to Naname hastily."
if selection == "naname_noteg":
e "You pass your note to Hiro hastiy."
if selection == "hiro_noteg":
e "You pass your note to Ameko hastily."
I don't think you should find too much mistakes in your code, since your previous posted code was fine and had no errors... Just relax and think of the ways the questioner could have gone wrong, instead of saying "my code must be the culprit here!" This advice can help long way into the future!
"Destiny is a no matter of chance
It is a matter of choice
It is not a thing to be waited for
It is a thing to be achieved..."
-William Jennings Bryan
If you can dream and not make dreams your master;
If you can think and not make thoughts your aim,
If you can meet with Triumph and Disaster;
And treat those two impostors just the same,
Only then can you ever win against yourself...
shivanshs9 wrote:
Just relax and think of the ways the questioner could have gone wrong, instead of saying "my code must be the culprit here!"
Okay, thanks for advice I had to test my code so I've overwritten the variable. I've just posted code that works for me.
There's no point in standing around with your mouth open waiting for talent to fall from the sky. You make your own. No matter what you're doing, the most essential thing is not to give up.