[Solved]Trouble about if and 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
User avatar
zabuzaeldemonio
Regular
Posts: 96
Joined: Sun Jan 08, 2017 7:24 pm
Projects: Call Me
Location: Spain
Contact:

[Solved]Trouble about if and images

#1 Post by zabuzaeldemonio » Wed Feb 27, 2019 2:28 pm

Hi there, I have a little troube with the If and the Images, I let you here the code:

Code: Select all

        if english:
            image manga1 = "images/manga/page_02 copy.png"
            image manga2 = "images/manga/page_03 copy.jpg"
            image manga3 = "images/manga/page_04 copy.jpg"
            image manga4 = "images/manga/page_05 copy.jpg"
            image manga5 = "images/manga/page_06 copy.jpg"
            image manga6 = "images/manga/page_07 copy.jpg"
            image manga7 = "images/manga/page_08 copy.jpg"
            image manga8 = "images/manga/page_09 copy.jpg"
            image manga9 = "images/manga/page_10 copy.jpg"
            image manga10 = "images/manga/page_11 copy.jpg"
            image manga11 = "images/manga/page_12 copy.jpg"
            image manga12 = "images/manga/page_13 copy.jpg"
            image manga13 = "images/manga/page_14 copy.jpg"
            image manga14 = "images/manga/page_15 copy.jpg"
            image manga15 = "images/manga/page_16 copy.jpg"
            image manga16 = "images/manga/page_17 copy.jpg"
            image manga17 = "images/manga/page_18 copy.jpg"
            image manga18 = "images/manga/page_19 copy.jpg"
            image manga19 = "images/manga/page_20 copy.jpg"
            image manga20 = "images/manga/page_21 copy.jpg"
            image manga21 = "images/manga/page_22 copy.jpg"
            image manga22 = "images/manga/page_23 copy.jpg"
            image manga23 = "images/manga/page_24 copy.jpg"
            image manga24 = "images/manga/page_25 copy.jpg"
        if spain:
            image manga1 = "images/manga/spain/page_02 copy.jpg"
            image manga2 = "images/manga/spain/page_03 copy.jpg"
            image manga3 = "images/manga/spain/page_04 copy.jpg"
            image manga4 = "images/manga/spain/page_05 copy.jpg"
            image manga5 = "images/manga/spain/page_06 copy.jpg"
            image manga6 = "images/manga/spain/page_07 copy.jpg"
            image manga7 = "images/manga/spain/page_08 copy.jpg"
            image manga8 = "images/manga/spain/page_09 copy.jpg"
            image manga9 = "images/manga/spain/page_10 copy.jpg"
            image manga10 = "images/manga/spain/page_11 copy.jpg"
            image manga11 = "images/manga/spain/page_12 copy.jpg"
            image manga12 = "images/manga/spain/page_13 copy.jpg"
            image manga13 = "images/manga/spain/page_14 copy.jpg"
            image manga14 = "images/manga/spain/page_15 copy.jpg"
            image manga15 = "images/manga/spain/page_16 copy.jpg"
            image manga16 = "images/manga/spain/page_17 copy.jpg"
            image manga17 = "images/manga/spain/page_18 copy.jpg"
            image manga18 = "images/manga/spain/page_19 copy.jpg"
            image manga19 = "images/manga/spain/page_20 copy.jpg"
            image manga20 = "images/manga/spain/page_21 copy.jpg"
            image manga21 = "images/manga/spain/page_22 copy.jpg"
            image manga22 = "images/manga/spain/page_23 copy.jpg"
            image manga23 = "images/manga/spain/page_24 copy.jpg"
            image manga24 = "images/manga/spain/page_25 copy.jpg"
        if jap:
            image manga1 = "images/manga/jap/page_02 copy.jpg"
            image manga2 = "images/manga/jap/page_03 copy.jpg"
            image manga3 = "images/manga/jap/page_04 copy.jpg"
            image manga4 = "images/manga/jap/page_05 copy.jpg"
            image manga5 = "images/manga/jap/page_06 copy.jpg"
            image manga6 = "images/manga/jap/page_07 copy.jpg"
            image manga7 = "images/manga/jap/page_08 copy.jpg"
            image manga8 = "images/manga/jap/page_09 copy.jpg"
            image manga9 = "images/manga/jap/page_10 copy.jpg"
            image manga10 = "images/manga/jap/page_11 copy.jpg"
            image manga11 = "images/manga/jap/page_12 copy.jpg"
            image manga12 = "images/manga/jap/page_13 copy.jpg"
            image manga13 = "images/manga/jap/page_14 copy.jpg"
            image manga14 = "images/manga/jap/page_15 copy.jpg"
            image manga15 = "images/manga/jap/page_16 copy.jpg"
            image manga16 = "images/manga/jap/page_17 copy.jpg"
            image manga17 = "images/manga/jap/page_18 copy.jpg"
            image manga18 = "images/manga/jap/page_19 copy.jpg"
            image manga19 = "images/manga/jap/page_20 copy.jpg"
            image manga20 = "images/manga/jap/page_21 copy.jpg"
            image manga21 = "images/manga/jap/page_22 copy.jpg"
            image manga22 = "images/manga/jap/page_23 copy.jpg"
            image manga23 = "images/manga/jap/page_24 copy.jpg"
            image manga24 = "images/manga/jap/page_25 copy.jpg"
In the code you can see 3 If , that if are the language, at the begining of the game you can select your language

Code: Select all

screen idiomas:
        imagebutton auto "images/spain_%s.png" xalign .25 yalign .70 action MainMenu, [SetVariable("spain", True),SetVariable("jap", False),SetVariable("english", False)]
        imagebutton auto "images/japan_%s.png" xalign .50 yalign .70 action MainMenu, [SetVariable("spain", False),SetVariable("jap", True),SetVariable("english", False)]
        imagebutton auto "images/english_%s.png" xalign .75 yalign .70 action MainMenu, [SetVariable("spain", False),SetVariable("jap", False),SetVariable("english", True)]
The trouble here is that you can select english or spain, that you always ll see the japanese language, if someone know how to solve this, please tell me, Thanks.
Last edited by zabuzaeldemonio on Wed Feb 27, 2019 8:53 pm, edited 1 time in total.
My personal Project:
Image

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: Trouble about if and images

#2 Post by mitoky » Wed Feb 27, 2019 2:36 pm

Did you set defaults?

Code: Select all

default english = True
default jap = False
default spain = False

User avatar
Remix
Eileen-Class Veteran
Posts: 1377
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: Trouble about if and images

#3 Post by Remix » Wed Feb 27, 2019 3:14 pm

You could use interpolation rather than if: clauses

Code: Select all

default image_language_folder = "" # empty for None/English

image manga1 = "images/manga/[image_language_folder]page_02 copy.jpg"
image manga2 = "images/manga/[image_language_folder]page_03 copy.jpg"

imagebutton auto "images/spain_%s.png" xalign .25 yalign .70 action [ SetVariable("image_language_folder", "spain/"), Language("spanish") ]
Mad Scientist Todo List:
  • Finish Improved Event Handler
  • Implement DragonBones animation as a Creator Defined Container
  • Develop Cartoon Speech Bubble dialogue
  • Finish Bitmask collision and rebound vector system
  • Develop time based building mechanic
  • Others
  • *Find a superb artist and actually write a game*

User avatar
zabuzaeldemonio
Regular
Posts: 96
Joined: Sun Jan 08, 2017 7:24 pm
Projects: Call Me
Location: Spain
Contact:

Re: Trouble about if and images

#4 Post by zabuzaeldemonio » Wed Feb 27, 2019 8:53 pm

Thanks Remix,
your solution worked perfectly!
My personal Project:
Image

Post Reply

Who is online

Users browsing this forum: No registered users