ConditionSwitch takes an Even Number of Arguments (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
User avatar
ArizaLuca
Regular
Posts: 108
Joined: Tue Feb 20, 2018 12:59 pm
Completed: Through the Screen
Tumblr: aa-games
Deviantart: ArizaLuca
itch: arizaluca
Contact:

ConditionSwitch takes an Even Number of Arguments (SOLVED)

#1 Post by ArizaLuca » Fri Sep 21, 2018 8:46 pm

The ConditionSwitch arguments are:

Code: Select all

image mirin_socialanxiety:
    LiveComposite(
        (480, 720), 
        (0, 0), "mirin_base_socialanxiety.png",
        (0, 0), ConditionSwitch(
            "m_eyes == 'closed c'", "mirin_eye_closed_color.png",
            "m_eyes == 'closed g'", "mirin_eye_closed_gray.png",
            "m_eyes == 'halfshut c'", "romeo eyes halfshut c",
            "m_eyes == 'halfshut g'", "mi eyes halfshut g",
            "m_eyes == 'halfshut c dull'", "mi eyes halfshut dull c"
            "m_eyes == 'halfshut g dull'", "mi eyes halfshut dull g",
            "m_eyes == 'wide c'", "mi eyes wide c",
            "m_eyes == 'wide g'", "mi eyes wide g",
            "m_eyes == 'wide c dull'", "mi eyes wide dull c",
            "m_eyes == 'wide g dull'", "mi eyes wide dull g",
            "m_eyes == 'screwedup c'", "mi_eye_screwedup_color",
            "m_eyes == 'screwedup g'", "mi_eye_screwedup_gray.png",
            "m_eyes == 'dull'", "mi eyes normal dull c",
            "m_eyes == 'gray'", "mi eyes normal g",
            "m_eyes == 'gray dull'", "mi eyes normal dull g",
            "True", "mi eyes normal c",
            ),
        (0,0), ConditionSwitch(
            "m_mouth == 'smile'", "mirin_mouth_smile.png",
            "m_mouth == 'open'", "mirin_mouth_open.png",
            "m_mouth == 'teeth'", "mirin_mouth_teeth.png",
            "m_mouth == 'toothysmile'", "mirin_mouth_toothysmile.png",
            "True", "mirin_mouth_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_eyebrow == 'sad'", "mirin_eyebrow_sad.png",
            "m_eyebrow == 'thoughtful'", "mirin_eyebrow_thoughtful.png",
            "True", "mirin_eyebrow_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_tears == 'tears'", "mirin_tears.png",
            "True", "none.png",
             ),
    ) 
        
image mirin_selfesteem:
    LiveComposite(
        (480, 720), 
        (0, 0), "mirin_base_selfesteem.png",
        (0,0), ConditionSwitch(
            "m_mouth == 'smile'", "mirin_mouth_smile.png",
            "m_mouth == 'open'", "mirin_mouth_open.png",
            "m_mouth == 'teeth'", "mirin_mouth_teeth.png",
            "m_mouth == 'toothysmile'", "mirin_mouth_toothysmile.png",
            "True", "mirin_mouth_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_eyebrow == 'sad'", "mirin_eyebrow_sad.png",
            "m_eyebrow == 'thoughtful'", "mirin_eyebrow_thoughtful.png",
            "True", "mirin_eyebrow_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_tears == 'tears'", "mirin_tears.png",
            "True", "none.png",
             ),
    ) 
    
image mirin_stress:
    LiveComposite(
        (480, 720), 
        (0, 0), "mirin_base_stress.png",
        (0, 0), ConditionSwitch(
            "m_eyes == 'closed c'", "mirin_eye_closed_color.png",
            "m_eyes == 'closed g'", "mirin_eye_closed_gray.png",
            "m_eyes == 'halfshut c'", "romeo eyes halfshut c",
            "m_eyes == 'halfshut g'", "mi eyes halfshut g",
            "m_eyes == 'halfshut c dull'", "mi eyes halfshut dull c"
            "m_eyes == 'halfshut g dull'", "mi eyes halfshut dull g",
            "m_eyes == 'wide c'", "mi eyes wide c",
            "m_eyes == 'wide g'", "mi eyes wide g",
            "m_eyes == 'wide c dull'", "mi eyes wide dull c",
            "m_eyes == 'wide g dull'", "mi eyes wide dull g",
            "m_eyes == 'screwedup c'", "mi_eye_screwedup_color",
            "m_eyes == 'screwedup g'", "mi_eye_screwedup_gray.png",
            "m_eyes == 'dull'", "mi eyes normal dull c",
            "m_eyes == 'gray'", "mi eyes normal g",
            "m_eyes == 'gray dull'", "mi eyes normal dull g",
            "True", "mi eyes normal c",
            ),
        (0,0), ConditionSwitch(
            "m_eyebrow == 'sad'", "mirin_eyebrow_sad.png",
            "m_eyebrow == 'thoughtful'", "mirin_eyebrow_thoughtful.png",
            "True", "mirin_eyebrow_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_tears == 'tears'", "mirin_tears.png",
            "True", "none.png",
             ),
    ) 
    
image mirin_normal:
    LiveComposite(
        (480, 720), 
        (0, 0), "mirin_base.png",
        (0, 0), ConditionSwitch(
            "m_eyes == 'closed c'", "mirin_eye_closed_color.png",
            "m_eyes == 'closed g'", "mirin_eye_closed_gray.png",
            "m_eyes == 'halfshut c'", "romeo eyes halfshut c",
            "m_eyes == 'halfshut g'", "mi eyes halfshut g",
            "m_eyes == 'halfshut c dull'", "mi eyes halfshut dull c"
            "m_eyes == 'halfshut g dull'", "mi eyes halfshut dull g",
            "m_eyes == 'wide c'", "mi eyes wide c",
            "m_eyes == 'wide g'", "mi eyes wide g",
            "m_eyes == 'wide c dull'", "mi eyes wide dull c",
            "m_eyes == 'wide g dull'", "mi eyes wide dull g",
            "m_eyes == 'screwedup c'", "mi_eye_screwedup_color",
            "m_eyes == 'screwedup g'", "mi_eye_screwedup_gray.png",
            "m_eyes == 'dull'", "mi eyes normal dull c",
            "m_eyes == 'gray'", "mi eyes normal g",
            "m_eyes == 'gray dull'", "mi eyes normal dull g",
            "True", "mi eyes normal c",
            ),
        (0,0), ConditionSwitch(
            "m_mouth == 'smile'", "mirin_mouth_smile.png",
            "m_mouth == 'open'", "mirin_mouth_open.png",
            "m_mouth == 'teeth'", "mirin_mouth_teeth.png",
            "m_mouth == 'toothysmile'", "mirin_mouth_toothysmile.png",
            "True", "mirin_mouth_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_eyebrow == 'sad'", "mirin_eyebrow_sad.png",
            "m_eyebrow == 'thoughtful'", "mirin_eyebrow_thoughtful.png",
            "True", "mirin_eyebrow_normal.png",
            ),
        (0,0), ConditionSwitch(
            "m_tears == 'tears'", "mirin_tears.png",
            "True", "none.png",
             ),
    ) 
    
image side portrait = ConditionSwitch(
    "mode == 'sa'", "mirin_socialanxiety",
    "mode == 'se'", "mirin_selfesteem",
    "mode == 's'", "mirin_stress",
    "True", "mirin_normal",
    )
(Above images are defined.)

The traceback code is:

Code: Select all

I'm sorry, but an uncaught exception occurred.

Compiling ATL code at game/images.rpy:271
  File "game/script.rpy", line 51, in script
    "..."
Exception: ConditionSwitch takes an even number of arguments

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/bootstrap.py", line 306, in bootstrap
    renpy.main.main()
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/main.py", line 513, in main
    run(restart)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/main.py", line 139, in run
    renpy.execution.run_context(True)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/execution.py", line 879, in run_context
    context.run()
  File "game/script.rpy", line 51, in script
    "..."
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ast.py", line 652, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/exports.py", line 1199, in say
    who(what, *args, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 1016, in __call__
    self.do_display(who, what, cb_args=self.cb_args, **display_args)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 817, in do_display
    **display_args)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/character.py", line 566, in display_say
    rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2649, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 3132, in interact_core
    self.draw_screen(root_widget, fullscreen_video, (not fullscreen_video) or video_frame_drawn)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 2055, in draw_screen
    renpy.config.screen_height,
  File "render.pyx", line 485, in renpy.display.render.render_screen
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/screen.py", line 669, in render
    child = renpy.display.render.render(self.child, w, h, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 717, in render
    surf = render(child, width, height, cst, cat)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "accelerator.pyx", line 108, in renpy.display.accelerator.transform_render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/image.py", line 495, in render
    return wrap_render(self.target, width, height, st, at)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/image.py", line 306, in wrap_render
    rend = render(child, w, h, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 331, in render
    surf = render(self.child, width, height, st, at)
  File "render.pyx", line 145, in renpy.display.render.render
  File "render.pyx", line 233, in renpy.display.render.render
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 1258, in render
    self.update(st, at)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 1247, in update
    child.visit_all(lambda c : c.per_interact())
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 511, in visit_all
    d.visit_all(callback)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/core.py", line 508, in visit_all
    for d in self.visit():
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/atl.py", line 574, in visit
    block = self.compile()
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/atl.py", line 481, in compile
    block = self.atl.compile(self.context)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/atl.py", line 676, in compile
    statements = [ i.compile(ctx) for i in self.statements ]
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/atl.py", line 889, in compile
    child = ctx.eval(expr)
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/atl.py", line 246, in eval
    return eval(expr, renpy.store.__dict__, self.context)  # @UndefinedVariable
  File "<string>", line 20, in <module>
  File "/Users/arizaluca/Desktop/renpy-6.99.13-sdk/renpy/display/layout.py", line 1366, in ConditionSwitch
    raise Exception('ConditionSwitch takes an even number of arguments')
Exception: ConditionSwitch takes an even number of arguments

Darwin-17.7.0-x86_64-i386-64bit
Ren'Py 7.0.0.196
Phobias 1.0
Fri Sep 21 20:43:57 2018
What is the problem?

EDIT: Oh, I found it. I forgot a comma in an area. Sorry!!

Post Reply

Who is online

Users browsing this forum: CalixtheGreat