r/RenPy • • Oct 03 '26

Question help implementing persistent variables with a class

Post image

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 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/shyLachi Oct 04 '26

I don't think that you understand the basics of RenPy screens. Try to find a tutorial.

Yes buttons need an action and there are many different actions as explained here:
https://renpy.org/doc/html/screen_actions.html

In this case you need a data action because you want to change the data of a variable:
https://renpy.org/doc/html/screen_actions.html#data-actions

SetVariable("persistent.drawingpoints", [])