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'll try to be specific with this. There are no errors. I want to give the player the choice to spend time alone, or at the library. If the player chooses library, the game checks the current rank of the library, and picks the scene based on the rank. After the scene, I want to return to script.rpy but after the choice. (Morning, choose library, scene plays, return to script.rpy but in afternoon instead of morning.) I am open to suggestions.
label start:
$ librank = 0
#This sets librank's value to 0.
label morning:
scene cafeteria
"Where shall I go today?"
menu:
"How shall I spend my morning."
#choose one of the two choices.
#Alone has no problems
"Alone":
scene myroom
"I spent time organizing my notes."
#What I want Library to do is to jump to the library label in sociallinks.rpy
"Library":
jump library
label afternoon:
"Now what?"
#I repeat the previous step so that I can test if the social link ranks stack.
menu:
"How shall I spend my afternoon."
"Alone":
scene myroom
"I spent time organizing my notes."
"Library":
jump library
label evening:
"now what?"
menu:
"How shall I spend my evening."
"Alone":
scene myroom
"I spent time organizing my notes."
"Library":
jump library
label done:
"We're done!"
return
#Social Links
#When the player chooses library, it jumps to the library label. Then it should check the librank. if it's 1 then it should jump to the librank1 label. 2 then it jumps to librank 2. If 0 then it should jump down to the librank0 label.
label library:
if librank == 1:
jump librank1
elif librank == 2:
jump librank2
else:
jump librank0
#After jumping down to one of the labels below, the scene associated with the right label should play then assign librank a new value. Then I would like it to return to script.rpy and play the scene after the chosen choice.
label librank0:
"Yay rank 1"
$ librank = 1
#Currently all three ranks play one after another. What I want is to see one scene then return to after the previous choice. Let's say in the morning label you pick library. After the ensuing scene, it goes back to script.rpy but at the afternoon label instead of morning.
label librank1:
"Rank 2"
$ librank = 2
label librank2:
"Rank 3"
$ librank = 3
First, indentation is all over the place. To avoid future complication that may happen, make sure you indent the code properly. Python is rather fuzzy with that.
#This sets librank's value to 0.
default librank = 0
label start:
jump morning
label morning:
scene cafeteria
"Where shall I go today?"
menu:
"How shall I spend my morning."
#choose one of the two choices.
#Alone has no problems
"Alone":
scene myroom
"I spent time organizing my notes."
#What I want Library to do is to jump to the library label in sociallinks.rpy
"Library":
call library
label afternoon:
"Now what?"
#I repeat the previous step so that I can test if the social link ranks stack.
menu:
"How shall I spend my afternoon."
"Alone":
scene myroom
"I spent time organizing my notes."
"Library":
call library
label evening:
"Now what?"
menu:
"How shall I spend my evening."
"Alone":
scene myroom
"I spent time organizing my notes."
"Library":
call library
label done:
"We're done!"
return
# Social Links
# When the player chooses library, it jumps to the library label. Then it should check the librank.
# if it's 1 then it should jump to the librank1 label. 2 then it jumps to librank 2.
# If 0 then it should jump down to the librank0 label.
label library:
if librank == 1:
jump librank1
elif librank == 2:
jump librank2
else:
jump librank0
# After jumping down to one of the labels below, the scene associated with the right label should play then assign librank a new value.
# Then I would like it to return to script.rpy and play the scene after the chosen choice.
label librank0:
"Yay rank 1"
$ librank = 1
return
# Currently all three ranks play one after another. What I want is to see one scene then return to after the previous choice.
# Let's say in the morning label you pick library. After the ensuing scene, it goes back to script.rpy but at the afternoon label
# instead of morning.
label librank1:
"Rank 2"
$ librank = 2
# Back to wherever the call was made.
return
label librank2:
"Rank 3"
$ librank = 3
# Back to wherever the call was made.
return
Last edited by Divona on Mon Jun 19, 2017 11:48 pm, edited 1 time in total.
Whenever you type a : indent everything after that to let Ren'py know it is relevant to that part of the layout.
Only un-indent once you reach items that are no longer 'children' of the layout part.