Increment a variable at each build

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
User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Increment a variable at each build

#1 Post by korova »

I have no idea if what i wish is possible or not, so i'm asking the renpy specialists of this forum.

I'd like that each time I make a build of my game (using the "building packets" feature of the renpy launcher), I can increment a variable in my game (persistent variable)

So, is there any instruction or line of code that I can put in my script, that can detect that a build is done ?

(In case you want to know why, I'd like to keep track of how many builds I make, and I often lose track when doing it manually...)

Thanks for your attention.

User avatar
PyTom
Ren'Py Creator
Posts: 16093
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Increment a variable at each build

#2 Post by PyTom »

There isn't really a good way to do this. (And it wouldn't be a persistent variable.) If you really wanted to, you could edit launcher/distribute.rpy and have it increment - for example - a .txt file before building. But that's going to be a pain, since the file will change a lot.

Your best bet would be something like a git post-commit hook that updates a version.txt file each time you commit your code.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

User avatar
korova
Veteran
Posts: 217
Joined: Sat Jun 27, 2009 5:15 pm
Completed: Ivy, Chocolate, Time, Clair Obscur
Projects: Writing exercises, The House [Nano18]
Tumblr: korova08
itch: korova
Location: Normandie, France
Contact:

Re: Increment a variable at each build

#3 Post by korova »

OK, thanks for the answer.

I guess I'll have to keep track another way, and be more focused about it... :roll: :wink:

Post Reply

Who is online

Users browsing this forum: Google [Bot], LittleRainySeasons