Ren'Py Web Updater checking versions

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
Yc3k
Newbie
Posts: 24
Joined: Tue Feb 27, 2018 8:27 pm
Contact:

Ren'Py Web Updater checking versions

#1 Post by Yc3k » Tue Feb 27, 2018 8:45 pm

Hello,

I am planing on implementing a Ren'Py Web Updater into my game. I have tested it and it works flawlessly but I have a question.

Is there a way for Ren'Py to only to check if the new version or update is available without updating the game itself, but instead to return some sort of True or False result that I could use to alert the player that there's a newer version available without having to manually check and update?

I have seen there is a function updater.UpdateVersion but I don't fully understand the difference between "updater.UpdateVersion" and "updater.update" function since it looks like both will update the game if newer version is available.

Any help would be appreciated.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1458
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Ren'Py Web Updater checking versions

#2 Post by xavimat » Wed Feb 28, 2018 9:38 am

updater.UpdateVersion is a function, it should do what you want.
updater.update is a function and updater.Update is an action. Both update the game.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Yc3k
Newbie
Posts: 24
Joined: Tue Feb 27, 2018 8:27 pm
Contact:

Re: Ren'Py Web Updater checking versions

#3 Post by Yc3k » Wed Feb 28, 2018 3:55 pm

Thanks for the reply but I still don't understand how can I use this function to get what I want. My coding abilities are rather limited.

I've tried to find some sort of a cookbook or a tutorial on how to make this work but with no luck. Thank you anyway, I'll try to find a different solution.

User avatar
PyTom
Ren'Py Creator
Posts: 15893
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: Ren'Py Web Updater checking versions

#4 Post by PyTom » Thu Mar 01, 2018 1:28 am

updater.UpdateVersion is meant to be used inside screens. There's a lot of magic in that function, but basically what it does is to return the new version on the server, if na new version exists. It takes care of refreshing the screen if it finds that a new version exists. There is a lot of magic going on behind the scenes to make this reasonably simple to use.

So you could do, in a screen:

Code: Select all

    $ UPDATE_URL = https://www.mydomain.com/path/to/update.json"

    $ new_version = updater.UpdateVersion(UPDATE_URL)

    if new_version:
        textbutton "Update to [new_version]" action update.Updater(UPDATE_URL)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Yc3k
Newbie
Posts: 24
Joined: Tue Feb 27, 2018 8:27 pm
Contact:

Re: Ren'Py Web Updater checking versions

#5 Post by Yc3k » Thu Mar 01, 2018 1:48 pm

Omg, thank you Tom.

This is exactly what I was looking for. You've helped me immensely.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], span4ev