Changing variables on a screen

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.
Post Reply
Message
Author
danteworks
Newbie
Posts: 10
Joined: Mon Dec 31, 2018 4:35 pm
Contact:

Changing variables on a screen

#1 Post by danteworks »

Hello. How can I use an image button to edit a variable that I've got? For example, I want to add 10 to the variable. I only know how to use setvariable to set a value to the variable, but not add or substract.

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Changing variables on a screen

#2 Post by Remix »

Inside SetVariable, use the variable as a base to evaluate the new value...

SetVariable( "variable_name", variable_name + 1 )
Frameworks & Scriptlets:

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]