how to stop renpy from going to a label to define images?

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
de_nederlander
Newbie
Posts: 21
Joined: Thu Aug 04, 2016 8:26 am
Contact:

how to stop renpy from going to a label to define images?

#1 Post by de_nederlander »

I have a game where you can choose to have pictures of girls or boys, so I used the following code to define the images:

Code: Select all

label TV:
    $ man = False
    $ vrouw = True
    hide vrouw
    hide man
    $ show_quick_menu2 = False
    image A ='1A.jpg'
    image B ='1B.jpg'
    image C ='1C.jpg'
    image D ='1D.jpg'
    image E ='1E.jpg'
    image F ='1F.jpg'
    image G ='1G.jpg'
    image H ='1H.jpg'
    image I ='1I.jpg'
    image J ='1J.jpg'
    image K ='1K.jpg'
    image L ='1L.jpg'
    image M='1M.jpg'
    image N ='1N.jpg'
    image O ='1O.jpg'
    image P ='1P.jpg'
    image Q ='1Q.jpg'
    image R ='1R.jpg'
    image S ='1S.jpg'
    image T ='1T.jpg'
    image U ='1U.jpg'
    image V ='1V.jpg'
    image W ='1W.jpg'
    image X ='1X.jpg'
    image Y ='1Y.jpg'
    image Z ='1Z.jpg'
    jump willekeureen
    

label TM:
    $ man = True
    $ vrouw = False
    hide vrouw
    hide man
    $ show_quick_menu2 = False
    image A ='2A.jpg'
    image B ='2B.jpg'
    image C ='2C.jpg'
    image D ='2D.jpg'
    image E ='2E.jpg'
    image F ='2F.jpg'
    image G ='2G.jpg'
    image H ='2H.jpg'
    image I ='2I.jpg'
    image J ='2J.jpg'
    image K ='2K.jpg'
    image L ='2L.jpg'
    image M='2M.jpg'
    image N ='2N.jpg'
    image O ='2O.jpg'
    image P ='2P.jpg'
    image Q ='2Q.jpg'
    image R ='2R.jpg'
    image S ='2S.jpg'
    image T ='2T.jpg'
    image U ='2U.jpg'
    image V ='2V.jpg'
    image W ='2W.jpg'
    image X ='2X.jpg'
    image Y ='2Y.jpg'
    image Z ='2Z.jpg'
    jump willekeureen
but when I launch the game it will automatically define the images using the second label TM, even though I went with the choice that should give me label TV.

how can I make this work, or is it not possible?

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: how to stop renpy from going to a label to define images

#2 Post by PyTom »

The problem is that the image statements run at init time, before the labels are called. You probably want to use a CondtionSwitch here:

Code: Select all

image A = ConditionSwitch("vrouw", "1A.jpg", "True", "2A.jpg")
etc.
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

de_nederlander
Newbie
Posts: 21
Joined: Thu Aug 04, 2016 8:26 am
Contact:

Re: how to stop renpy from going to a label to define images

#3 Post by de_nederlander »

PyTom wrote:The problem is that the image statements run at init time, before the labels are called. You probably want to use a CondtionSwitch here:

Code: Select all

image A = ConditionSwitch("vrouw", "1A.jpg", "True", "2A.jpg")
etc.
Now I used conditionswitch I get the following error: Exception: Switch could not choose a displayable.

edit:

I think I helped it already, my conditionswitched cointed too many brackets.
thanks Tom :)
Last edited by de_nederlander on Thu Aug 04, 2016 3:57 pm, edited 1 time in total.

User avatar
gas
Miko-Class Veteran
Posts: 842
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: how to stop renpy from going to a label to define images

#4 Post by gas »

This happen if your conditions are bad coded. At least ONE condition must be true.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

de_nederlander
Newbie
Posts: 21
Joined: Thu Aug 04, 2016 8:26 am
Contact:

Re: how to stop renpy from going to a label to define images

#5 Post by de_nederlander »

gas wrote:This happen if your conditions are bad coded. At least ONE condition must be true.
too many brackets :P

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot], Majestic-12 [Bot]