conditionswitch wtf [solved]

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
queergames
Newbie
Posts: 12
Joined: Mon Oct 28, 2013 11:37 pm
Contact:

conditionswitch wtf [solved]

#1 Post by queergames »

I hesitate to look like an idiot, but since I appear to in fact be an idiot, I have given up and I am back again. Right now I am making a game where there are four possible protagonist appearances to choose from. The player gets to decide if their character has long hair or short hair, and breasts or no breasts. Some advised me to use condition switch to get this working. However, when I tried to do it myself it just told me "SyntaxError: invalid syntax (<none>, line 1)" which means nothing at all to me, but I am guess it has something to do with the lack of "True".



However, when I tried copy-pasting the example here, and commented out the breasts or no breasts, no matter what choices I picked, it always came back as prot11.png



So yeah. I have no idea. I am foremost a writer, not a coder or even an artist, and I am doing my projects completely by myself with no friends who can help me. I am extremely frustrated by my own incompetence, and anyone who can help me create or provide me with some actual working code rather than whatever sloppy mess I've managed to create would have my eternal gratitude.

Like literally explain it to me as if I am a five-year-old learning to spell. That's how incompetent I am.
Last edited by queergames on Fri Nov 01, 2013 1:34 am, edited 1 time in total.

User avatar
saguaro
Miko-Class Veteran
Posts: 560
Joined: Sun Feb 12, 2012 9:17 am
Completed: Locked-In, Sunrise, The Censor
Organization: Lucky Special Games
itch: saguarofoo
Location: USA
Contact:

Re: conditionswitch wtf

#2 Post by saguaro »

At a glance, == is equality comparison. See old example:
http://www.renpy.org/wiki/renpy/doc/ref ... tionSwitch

Code: Select all

image prot = ConditionSwitch(
    "prot_n == 11", "prot11.png",
    "prot_n == 12", "prot12.png",
    "prot_n == 21", "prot21.png",
    "prot_n == 22", "prot22.png")

queergames
Newbie
Posts: 12
Joined: Mon Oct 28, 2013 11:37 pm
Contact:

Re: conditionswitch wtf

#3 Post by queergames »

That brought me back to the Everything Is Prot11.png Problem.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
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: conditionswitch wtf

#4 Post by xavimat »

I would do this. It seems more readable to me:

Code: Select all

image prot = ConditionSwitch(
    "short and not breasts", "prot11.png",
    "short and breasts", "prot12.png",
    "not short and not breasts", "prot21.png",
    "True", "prot22.png")

label start:
    "Now, do you want your character to have long hair or short hair?"    
    menu:
        "Long":
            $ short = False
        "Short":
            $ short = True
    "Do you want your character to have breasts or not?"    
    menu:
        "Breasts":
            $ breasts = True
        "No breasts":
            $ breasts = False
EDIT: Thanks to Elmiwisa
Last edited by xavimat on Thu Oct 31, 2013 5:22 am, edited 1 time in total.
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)

Elmiwisa
Veteran
Posts: 476
Joined: Sun Jul 21, 2013 8:08 am
Contact:

Re: conditionswitch wtf

#5 Post by Elmiwisa »

queergames wrote:I tried copy-pasting the example here
Clearly, you did not copy it verbatim. Please put up your current code (including your new ConditionSwitch code). There are just too many possible errors one can conjecture without seeing the code:
-Perhaps you put prot_11 on all lines?
-Perhaps you changed the value of the wrong variable?
-Perhaps your first condition always evaluate to True, or perhaps even True itself?
-Perhaps all your image look exactly the same?
-Perhaps you show the wrong image?
etc.

@xavimat: you don't have the long variable, that should be not short

queergames
Newbie
Posts: 12
Joined: Mon Oct 28, 2013 11:37 pm
Contact:

Re: conditionswitch wtf

#6 Post by queergames »

xavimat's method did the Everything is Prot11.
My current code IS posted.

However, here it is again (please note this is NOT the first script file as I've turned that into the chapter selection screen, thus the label)
Last edited by queergames on Fri Nov 01, 2013 1:34 am, edited 1 time in total.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
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: conditionswitch wtf

#7 Post by xavimat »

queergames wrote:xavimat's method did the Everything is Prot11.
In my computer it works fine. Surely there is another problem in your code (maybe indent, or other parts of it).
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)

queergames
Newbie
Posts: 12
Joined: Mon Oct 28, 2013 11:37 pm
Contact:

Re: conditionswitch wtf

#8 Post by queergames »

I figured it out. Thanks, guys.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Kocker