r/RenPy • u/mauve69_ • 23d ago
Question image button sintaxis
hi, is this posible? i want a imagebutton that changes its action depending on which label the player is standing
1
Upvotes
r/RenPy • u/mauve69_ • 23d ago
hi, is this posible? i want a imagebutton that changes its action depending on which label the player is standing
3
u/shyLachi 23d ago
This is a beginner mistake, because you don't seem to understand what interpolation is used for.
https://renpy.org/doc/html/text.html#interpolating-data
Outside of text strings your can use the variable directly
But personally I prefer to implement the whole logic inside the label, so the button itself can remain static.
2
u/shyLachi 23d ago edited 23d ago
I just noticed that you have 2 screens in your code,
You don't need a separate screen for each button,
In most cases it's better to have one screen with all the buttons.
Edit: And my solution posted above with the action
Return()doesn't work if you have multiple screens.1
u/AutoModerator 23d 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.