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 would like to write a series of buttons that must be pressed in a certain order, but the second and subsequent buttons do not always accept the variable changed when the first button is clicked, although the clicks are processed. How could this be fixed or implemented in a different form?
PinkePuchs wrote: ↑Sun Apr 21, 2024 10:58 am
I would like to write a series of buttons that must be pressed in a certain order, but the second and subsequent buttons do not always accept the variable changed when the first button is clicked, although the clicks are processed. How could this be fixed or implemented in a different form?
There are a couple of issues with your code in general.
1. You are using "define" for creating variables, which is wrong. It is used for constants. You have to use "default" instead! The "variables" you created might change during runtime, but Renpy won't save any changes and it also can have unforseen consequences. Maybe this fixes your problems?
2. Your labels don't jump anywhere when the "end" is reached. That means the following labels will be executed (or other code that's in between and not part of the init process).
By the way, the function IncrementVariable() by default increments by 1, so you do not have to include it inside the function argument
PinkePuchs wrote: ↑Sun Apr 21, 2024 10:58 am
I would like to write a series of buttons that must be pressed in a certain order, but the second and subsequent buttons do not always accept the variable changed when the first button is clicked, although the clicks are processed. How could this be fixed or implemented in a different form?
There are a couple of issues with your code in general.
1. You are using "define" for creating variables, which is wrong. It is used for constants. You have to use "default" instead! The "variables" you created might change during runtime, but Renpy won't save any changes and it also can have unforseen consequences. Maybe this fixes your problems?
2. Your labels don't jump anywhere when the "end" is reached. That means the following labels will be executed (or other code that's in between and not part of the init process).
By the way, the function IncrementVariable() by default increments by 1, so you do not have to include it inside the function argument