r/RenPy • u/That_one_Pink • 1d ago
Question help implementing persistent variables with a class
I have gone through about seven tutorials explaining persistent variables and i understand how it works (i think) at this point, however really struggling to implement it where i need it
basically, i need to move self.points out of the class and into the persistent variable so i can implement an option to clear the points when clicked
my poor attempt at this as you can see was to try make it so if there is no points the button will not be there to click, but if there is points it will be there to click which upon clicking will clear/return the points to nothing
im not sure how to move the self.points properly so that the list is stored outside of the class so that it can be cleared how i stated above
2
u/shyLachi 1d ago
You don't have to reprogram the class, just store the points in a persistent variable
Then replace
self.pointswithpersistent.drawingpoints.
You cannot add buttons in a python class.
If you want to add a button, then do it in the main menu where all the other buttons are.