Displaying image with a loop for in a scrolling window

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.
Message
Author
User avatar
sculpteur
Veteran
Posts: 221
Joined: Fri Nov 17, 2017 6:40 pm
Completed: Apocalypse Lovers
Projects: Apocalypse Lovers
Organization: Awake_Production
Location: France
Discord: https://discord.gg/apocalypse-lovers
Contact:

Re: Displaying image with a loop for in a scrolling window

#16 Post by sculpteur » Sun Apr 29, 2018 3:29 pm

Thanks to your link I also manage to modifiy this line :

action [Play ("sound", "0 - sound_hoveritem.mp3"), Show("test_%s"% (k))]

And now it's working and the code is jumping on my other screen without difficulties :

Code: Select all

screen test_MY_ACHIEV_1:
    add "gui/jess_carac_window.png" xpos 620 ypos 250
screen test_MY_ACHIEV_2:
    add "gui/jess_carac_window.png" xpos 620 ypos 250

Now I am trying to solve the condition probleme because this is really strange, whatever I do, all the achievement are still in display. Even if I don't add them in the persistent dict persistent.achievement .

So for now I have no idea where my mistake come from.
If you want to take a look don't hesitate :

Code: Select all

############ IN PROGRESS ##################
$ achievement_description = {}
$ achievement_description = {"MY_ACHIEV_1": "My_achiev-description_1", "MY_ACHIEV_2": "My_achiev-description_2"}
$ achievement_description["MY_ACHIEV_3"] = "My_achiev-description_4"
$ achievement_description["MY_ACHIEV_4"] = "My_achiev-description_4"
$ achievement_description["MY_ACHIEV_5"] = "My_achiev-description_5"
$ achievement_image = {}
$ achievement_image["MY_ACHIEV_5"] = "gui/AwardLock.png"
$ achievement_image["MY_ACHIEV_4"] = "gui/AwardLock - Save.png"
$ achievement_image["MY_ACHIEV_3"] = "gui/AwardLock.png"
$ achievement_image["MY_ACHIEV_2"] = "gui/AwardLock - Save.png"
$ achievement_image["MY_ACHIEV_1"] = "gui/AwardLock.png"

define persistent.achievement = {}
$ persistent.achievement["MY_ACHIEV_1"] = True
#############################################

screen innerTestScreen(viewId):
    side "c r":
        viewport id viewId:
            has vbox
            text "   "
            add "gui/Award_Title.png"
            for k, v in achievement_image.items():
                if k in persistent.achievement:
                    text "   "
                    text "Achievement Name : [k]":
                        font "GoodDog.otf"
                        color "#66cc00"
                    imagebutton:
                        idle "%s" % (v)
                        hover "%s" % (v)
                        action [Play ("sound", "0 - sound_hoveritem.mp3"), Show("test_%s"% (k))]
        vbar:
            value YScrollValue(viewId)
Image

“He asked me to calm down, close my eyes and be quiet. He explained to me that if I was afraid, the shadow that ran barefoot in the street would feel it. I got scared seeing Jumanji on TV, so let me tell you, we didn't stay hidden for long and had to start running again.”
Jessica's Diary.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Displaying image with a loop for in a scrolling window

#17 Post by kivik » Sun Apr 29, 2018 4:36 pm

Have you done a Delete Persistent on the Ren'py launcher first? The idea of persistent is that once they're set, they stay at that variable whenever you launch the game. So this line means your achievement will always be set:

Code: Select all

$ persistent.achievement["MY_ACHIEV_1"] = True
You need to remove that line and do a Delete Persistent before testing it again.

User avatar
sculpteur
Veteran
Posts: 221
Joined: Fri Nov 17, 2017 6:40 pm
Completed: Apocalypse Lovers
Projects: Apocalypse Lovers
Organization: Awake_Production
Location: France
Discord: https://discord.gg/apocalypse-lovers
Contact:

Re: Displaying image with a loop for in a scrolling window

#18 Post by sculpteur » Sun Apr 29, 2018 4:54 pm

It was this. Thanks again.
I tryied using $ persistent._clear() and it work. And after I realise I had read too fast your message and I understood you were talking about the renpy luncher. I didn't saw the button lol.

Anyway thank you, everything is in order and now I also understand what is the purpose of a "persistent." !
Image

“He asked me to calm down, close my eyes and be quiet. He explained to me that if I was afraid, the shadow that ran barefoot in the street would feel it. I got scared seeing Jumanji on TV, so let me tell you, we didn't stay hidden for long and had to start running again.”
Jessica's Diary.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Displaying image with a loop for in a scrolling window

#19 Post by kivik » Sun Apr 29, 2018 6:18 pm

Be careful with the persistent._clear(), make sure you've removed it before you release the game, or it'll keep clearing people's achievements!!

Post Reply

Who is online

Users browsing this forum: Google [Bot]