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 notfound:
player "There is nothing"
call screen hotspots_example
label found:
player "Yea I found something"
$inventory.append("item")
$found = True
call screen hotspots_example
I stuck with this problem tried to do Function(renpy.say(player,"text)), Function(text("something")) etc...
screen search(message):
text "You found "+message+"." xalign 0.5 yalign 0.5
if message == 'nothing':
button /blahblahbuttonstuff/ action Hide('search') # I can't do buttons without looking them up ;)
else:
button /blahblahbuttonstuff/ action [Hide('search'), Jump('foundit')]
label foundit:
$inventory.append("item")
$found = True
# do stuff
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
I saw three methods of connection variables with text and I'm curious which is the best or maybe which I have to use in a specific case.
Example of what I mean:
You're better off using a label as your originally intended instead of a screen if you want it to look like a dialogue box.
In terms of the variables, there's no one best way - it depends on your situation really.
The first one I didn't even know exists (not very experienced with python) looks really useful, but I think you'll have issues using list / dict indexes with it.
The third one overcomes the issue because you can do "text" + var["index"] without problems.
The second one ("text [var]") is Renpy specific, which has a very cool effect. It interpolates the variable at the point of displaying on screen, which means you can actually put variables into a string like that when the values aren't set yet - so long as they're set when Renpy renders them. An example is during image declarations.
However, the flip side is, if you put a string together like that expecting to output said value, then change the variable before / whilst displaying it, Renpy will update it to the latest value. It's a problem in very specific situations and someone had encountered it in their code on this forum before - so just bear that in mind.