Page 1 of 1

conditionswitch wtf [solved]

Posted: Tue Oct 29, 2013 9:27 pm
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.

Re: conditionswitch wtf

Posted: Tue Oct 29, 2013 11:05 pm
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")

Re: conditionswitch wtf

Posted: Thu Oct 31, 2013 1:57 am
by queergames
That brought me back to the Everything Is Prot11.png Problem.

Re: conditionswitch wtf

Posted: Thu Oct 31, 2013 4:58 am
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

Re: conditionswitch wtf

Posted: Thu Oct 31, 2013 5:02 am
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

Re: conditionswitch wtf

Posted: Thu Oct 31, 2013 1:42 pm
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)

Re: conditionswitch wtf

Posted: Thu Oct 31, 2013 7:00 pm
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).

Re: conditionswitch wtf

Posted: Fri Nov 01, 2013 1:34 am
by queergames
I figured it out. Thanks, guys.