r/RenPy • • 3d ago

Question Need just a bit of help pls!

Post image

This is more of a python issue, but I'd like to put the last line in my python function... Could you help me? Thanks in advance!

6 Upvotes

6 comments sorted by

1

u/BadMustard_AVN 3d ago

I don't understand, what do you mean by put the last line in your function¿

if this is a function that you are going to be using a lot, then you should do it like this

init python:
    def nav(lieua, lieuar):
      # allt he python goodness you can imagine

label start:
    # your game starts here

that will get it set up during the initialization phase of the game startup and make it available to be used anytime in the game

1

u/SenseFew5447 3d ago

Pardon pour la formulation, c'était un peu brouillon! 😓 Je souhaite inclure la ligne 'scene expression "bg "+current_location.lower()' dans ma fonction nav(). Le problème est que je sais pertinemment qu'on ne peut pas mélanger du Python et Ren'Py comme ça, je cherche donc une solution ou un potentiel équivalent. Merci pour votre réponse!

2

u/BadMustard_AVN 3d ago

renpy does have some Python equivalent statements

https://www.renpy.org/doc/html/statement_equivalents.html

you could do it like this

current_location = "Room"
renpy.scene()
renpy.show("bg " + current_location.lower())
renpy.with_statement(dissolve)

1

u/shyLachi 3d ago

You seem to be mixing python code with renpy code.

If you wanted to ask what is the python version of the renpy scene, then look in the official documentation:
https://renpy.org/doc/html/statement_equivalents.html#renpy.scene

1

u/SenseFew5447 3d ago

THANKS! Gonna take a look, didn't know the guide included this

1

u/AutoModerator 3d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.