Button For gallery.

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.
Message
Author
User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Button For gallery.

#1 Post by KairuKyun »

How do I make a button that appears once I clear the game.
Last edited by KairuKyun on Sat Mar 21, 2015 8:47 pm, edited 1 time in total.
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Button

#2 Post by Zetsubou »

Use persistent data to see if you've finished the game, then edit your main menu in screens.rpy to check for that variable.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#3 Post by KairuKyun »

Thank you
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#4 Post by KairuKyun »

So I am trying:

Code: Select all

    if replay == True:
        imagebutton auto "assets/images/menu/btn_choice_%s.png" action Quit() xpos 400 ypos 394 focus_mask True at quitmen
And then I tried:

Code: Select all

    if not replay:
        centered "No Gallery"
        else:
        imagebutton auto "assets/images/menu/btn_choice_%s.png" action Quit() xpos 400 ypos 394 focus_mask True at quitmen
They are both messy and aren't pointed towards the gallery yet but What's wrong?
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Button For gallery.

#5 Post by Zetsubou »

What's wrong with the above exactly? ie. What results are you getting, and what do you want it to do?
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#6 Post by KairuKyun »

I feel completely stupid, I forgot to include persistent. before replay...
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#7 Post by KairuKyun »

Nope never mind still get an error:
File "game/screens.rpy", line 294: screen expects a non-empty block.
if persistent.replay == True :
^
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Button For gallery.

#8 Post by Zetsubou »

I'd need to see more of that screen, but going by the message alone it seems like the line after the screen statement isn't indented properly.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#9 Post by KairuKyun »

I have this at the end of my game:

Code: Select all

        #This says the game is over
    $ persistent.replay = True
And this in the menu:

Code: Select all

 if persistent.replay == True :
        imagebutton auto "assets/images/menu/btn_choice_%s.png" action Quit() xpos 550 ypos 394 focus_mask True 
I fixed the indentation error but now I don't get my button when i finish the game.
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Button For gallery.

#10 Post by Zetsubou »

Can't say for sure with so little info, but going by the indentation of the comment "#This says the game is over", I'm guessing the problem is that "$ persistent.replay = True" isn't indented properly.

Code: Select all

label endOfGame:
    "The game is over!"
    $ persistent.replay = True
should do what you want, but

Code: Select all

label endOfGame:
    "The game is over!"
$ persistent.replay = True
may not.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Button For gallery.

#11 Post by Donmai »

Also, maybe your variable wasn't initialized at all. Put this at the very beginning of your script.rpy

Code: Select all

init:
    python:
        if persistent.replay is None:
            persistent.replay = False
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

User avatar
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#12 Post by KairuKyun »

Neither worked NOw I am tring to make it where when

Code: Select all

  
#This says the game is over
$ persistent.replay = True
if persistent.replay = True :
$ re = 1
then in menu

Code: Select all

if re = 1 :
        imagebutton auto "assets/images/menu/btn_choice_%s.png" action Quit() xpos 550 ypos 394 focus_mask True
BUt I get a error

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 5357: if statement expects a non-empty block.
    if persistent.replay = True :
                                 ^

Ren'Py Version: Ren'Py 6.18.3.761
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

User avatar
Zetsubou
Miko-Class Veteran
Posts: 522
Joined: Wed Mar 05, 2014 1:00 am
Completed: See my signature
Github: koroshiya
itch: zetsuboushita
Contact:

Re: Button For gallery.

#13 Post by Zetsubou »

KairuKyun wrote:Neither worked NOw I am tring to make it where when

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/script.rpy", line 5357: if statement expects a non-empty block.
    if persistent.replay = True :
                                 ^

Ren'Py Version: Ren'Py 6.18.3.761
is being caused by

Code: Select all

if persistent.replay = True :
$ re = 1
Once again, you need to indent your code after opening a block. (ie. if a line ends with ":", the next line needs to be indented)
Python is different than other languages like C and Java, where braces define a block of code. It might be worthwhile looking at some introductory Python books if you keep running into errors.
Finished games
-My games: Sickness, Wander No More, Max Massacre, Humanity Must Perish, Tomboys Need Love Too, Sable's Grimoire, My Heart Grows Fonder, Man And Elf, A Dragon's Treasure, An Adventurer's Gallantry
-Commissions: No One But You, Written In The Sky, Diamond Rose, To Libertad, Catch Canvas, Love Ribbon, Happy Campers, Wolf Tails

Working on:
Sable's Grimoire 2

https://zetsubou.games

User avatar
PyTom
Ren'Py Creator
Posts: 16096
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: Button For gallery.

#14 Post by PyTom »

There's a second problem here. You want:

Code: Select all

if persistent.replay == True:
    $ re = 1
Double equals is comparison, single equals is assignment. It's the Python (and, C, C++, Java, C#, etc) way!

Actually, you probably don't care about equality to True, but just truth, so a more pythonic way to write this would be:

Code: Select all

if persistent.replay:
    $ re = 1
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
KairuKyun
Veteran
Posts: 286
Joined: Thu Feb 12, 2015 4:10 pm
Completed: No One But You, Catch Canvas, Sickness, Written in the Sky, Wander no more, Warped Reality
Projects: Warped Reality
Organization: Unwonted Studios
IRC Nick: Kairu_kyun
Tumblr: karamuchan
Contact:

Re: Button For gallery.

#15 Post by KairuKyun »

Well even after doing this in main menu screen it still says that re is not defined. So I don't know if the re variable just isn't showing on the screens or what.
Kyle Tyner
Creator of Unwonted Studios
ktyner@unwontedstudios.co
Visit Our Website
Projects: No One But You, Sickness, Written in the Sky, Wander no more, Catch Canvas, Warped Reality

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Andredron, Google [Bot], Kia