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.
label random1:
$ outcome = True
"Oh! Look at that. [turn] decides to go hunting."
"Here's your items:"
jump list_items
"[turn] takes the spear for hunting"
if outcome == True:
"[turn] comes back, but without any food."
"[turn] decides to sleep."
else:
pass
return
label list_items:
"[inventory_text]"
return
For some reason 'turn' works but not 'inventory'
Also sorry, I'm kind of new to Ren'Py so it's probably something really dumb
there are days where you cry for no reason, and today is not one of those days.
"Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference."
- Robert Frost, The Road Not Taken
$ splash_message1 = "--"
$ splash_message2 = "--"
$ splash_message3 = "Thank you for playing"
image splash_warning = ParameterizedText(style="splash_text", xalign=0.5, yalign=0.5)
label credits_splash:
scene white
with Dissolve(1.5)
scene white
show splash_warning "[splash_message1]" with Dissolve(0.5, alpha=True)
pause 2.0
show splash_warning "[splash_message2]" with Dissolve(0.5, alpha=True)
pause 2.0
show splash_warning "[splash_message3]" with Dissolve(0.5, alpha=True)
pause 2.0
hide splash_warning with Dissolve(0.5, alpha=True)
return
<Yes, I have a splashscreen for credits, I know it's not the best way to do it but at least I've coded one before so I know how to do it>
This comes up with '[splash_message1]' as well and I'm not quite sure what's happening
there are days where you cry for no reason, and today is not one of those days.
"Two roads diverged in a wood, and I—
I took the one less traveled by,
And that has made all the difference."
- Robert Frost, The Road Not Taken
If you use a “dollar line” to set a variable that doesn’t have a “default” statement, it WILL put it in the store, but only if that line is executed during game play. Basically, you can think of that as meaning “if it’s inside a label.“ And it doesn’t get set unless the player actually traverses that line.
If you put a “dollar line” at the top of your file, not associated with a label, that line really never gets executed. (There may be “init” exceptions to this, but you don’t want to be going there, in general.)
The reason the “default” statement is so important is that if someone makes a save, and you add a “dollar line” into the script at a point before where they are when the save was made, when they resume the save, that line never gets executed. They’re already past that point. So if you were relying on that line to create the variable in the store, you now have a undefined variable, and your game goes boom later on. The “default” statement ensures that the variable is always defined, whether it was there when the save was made, or added later.
So, yes, for any variable you want to be saved, always, always include a default statement.