Non-keyword arg after keyword arg? [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
manga_otaku
Veteran
Posts: 413
Joined: Fri May 20, 2011 1:27 pm
Completed: [KN] Saving Project: Blind? (Part One)
Contact:

Non-keyword arg after keyword arg? [Solved]

#1 Post by manga_otaku » Wed Dec 28, 2011 3:34 pm

I'm using a condition switch in order to change the expression of the MC in her side image, but this error keeps persistently appearing. I have checked it over and over again and compared it to other projects, but I cannot find the root of the error. It works when I have one expression, but when I add extra expressions on it comes up with the error.

This is what I have:

Code: Select all

$ m = Character("Me", color = "#CC99CC", window_left_padding = 210, show_side_image = ConditionSwitch(
        "mc == 'cry'", im.Scale("char/mc/cry.gif", 250, 294), xalign=0.001, yalign=0.99,
        "mc == 'sad'", im.Scale("char/mc/sad.gif", 250, 294), xalign=0.001, yalign=0.99,
        "mc == 'norm'", im.Scale("char/mc/norm.gif", 250, 294), xalign=0.001, yalign=0.99,
        ))
And this is the parse 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 4: non-keyword arg after keyword arg

Ren'Py Version: Ren'Py 6.13.0.1603
Is there something simple which I have left out? Added in?
Thanks :)
Last edited by manga_otaku on Thu Dec 29, 2011 7:08 pm, edited 1 time in total.
Projects:
WIP|[KN] Day Of Reckoning|
Completed|[KN] Saving Project Blind: Part One|[KN] Saving Project Blind: Part Two|[KN] Saving Project Blind: Final Part|
Is available to help with proof-reading (Grammar freak...) Maybe voice-acting in the near future x]

User avatar
ScottySeng
Regular
Posts: 162
Joined: Tue Oct 04, 2011 9:57 am
Completed: May-Chan
Projects: Fairy Tale, What do you see
Skype: scottyseng
Location: Carrollton, TX
Contact:

Re: Non-keyword arg after keyword arg?

#2 Post by ScottySeng » Wed Dec 28, 2011 4:04 pm

I think you need to delete the comma after the last yalign=0.99
I may be wrong, but that's what it looks like to me.

User avatar
manga_otaku
Veteran
Posts: 413
Joined: Fri May 20, 2011 1:27 pm
Completed: [KN] Saving Project: Blind? (Part One)
Contact:

Re: Non-keyword arg after keyword arg?

#3 Post by manga_otaku » Wed Dec 28, 2011 4:33 pm

I tried it but unfortunately that doesn't seem to be the problem D;
Thanks for the help anyway :)
Projects:
WIP|[KN] Day Of Reckoning|
Completed|[KN] Saving Project Blind: Part One|[KN] Saving Project Blind: Part Two|[KN] Saving Project Blind: Final Part|
Is available to help with proof-reading (Grammar freak...) Maybe voice-acting in the near future x]

User avatar
KimiYoriBaka
Miko-Class Veteran
Posts: 636
Joined: Thu May 14, 2009 8:15 pm
Projects: Castle of Arhannia
Contact:

Re: Non-keyword arg after keyword arg?

#4 Post by KimiYoriBaka » Wed Dec 28, 2011 5:41 pm

the keyword args are the ones where you have the name of the variable with an equal sign. Generally, keyword args are supposed to be the last things mentioned, because they don't have a specific order for them.

I'm pretty sure xalign and yalign are only supposed to be defined for the entire displayable, and thus are only needed once. Try getting rid of the first two pairs.

User avatar
DrakeNavarone
Veteran
Posts: 338
Joined: Mon Mar 06, 2006 2:27 am
Completed: see sig below
Projects: always; never not
Organization: Team BG
Location: PA, USA
Contact:

Re: Non-keyword arg after keyword arg?

#5 Post by DrakeNavarone » Wed Dec 28, 2011 5:47 pm

Looks like someone beat me to it while I was typing this up, but to expand upon KimiYoriBaka's reply with examples:

The ConditionSwitch function expects pairs of one condition (a) and one image (b) to be passed to it. The arguments should go something like this:

ConditionSwitch( a, b, a, b, a, b, keyword args )

but the code you provided is closer to:

ConditionSwitch( a, b, keyword args, a, b, keyword args, a, b, keyword args )

Give the following code a shot... It should get you closer to what you need to do, but I can't guarantee it'll work since I didn't test it myself:

Code: Select all

$ m = Character("Me", color = "#CC99CC", window_left_padding = 210, show_side_image = ConditionSwitch(
        "mc == 'cry'", im.Scale("char/mc/cry.gif", 250, 294),
        "mc == 'sad'", im.Scale("char/mc/sad.gif", 250, 294),
        "mc == 'norm'", im.Scale("char/mc/norm.gif", 250, 294), xalign=0.001, yalign=0.99,
        ))
Hopefully by removing those extra xalign/yalign attributes (which are conveniently the same value), this will work as intended.
http://www.twitter.com/drakeynv
The Compendium of Drake:
Starlit Sky ~ Songs of Araiah ~ Mirai Imouto ~ Temple Glen ~ Fuyu no Tabi

User avatar
manga_otaku
Veteran
Posts: 413
Joined: Fri May 20, 2011 1:27 pm
Completed: [KN] Saving Project: Blind? (Part One)
Contact:

Re: Non-keyword arg after keyword arg?

#6 Post by manga_otaku » Thu Dec 29, 2011 7:08 pm

Ahah! Thank you! That seemed to do the trick ^_^
Projects:
WIP|[KN] Day Of Reckoning|
Completed|[KN] Saving Project Blind: Part One|[KN] Saving Project Blind: Part Two|[KN] Saving Project Blind: Final Part|
Is available to help with proof-reading (Grammar freak...) Maybe voice-acting in the near future x]

Post Reply

Who is online

Users browsing this forum: OverClock, Xerofit51