Imagebutton screen not showing up

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
sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Imagebutton screen not showing up

#1 Post by sarbezleeb »

I'm trying to have a weather icon appear in the top left hand corner of the screen. It changes throughout the game depending on a variable that determines the time of day. Here's the screen for it:

Code: Select all

##############################################################################
# Weather Icon
#
# Screen that's used to display the weather icon

screen weather_icon():

    showif day1 == True:
        imagebutton auto "Design/Calendar1_%s.png" xpos 30 ypos 30 focus_mask True
            
init -2:

    # Make all the journal icon buttons be the same size.
    style ji_button:
        size_group "ji"

    style ji_button_text:
        size 65
        font "DeterminationSansWeb.ttf"
and in the script, this is when the variable becomes true:

Code: Select all

    $ day1 = "True"
The icon doesn't appear when the variable becomes true in the script, so I'm not sure what the issue is. Any help would be much appreciated.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Imagebutton screen not showing up

#2 Post by indoneko »

Do you actually have a line that shows the screen, or did you just change the day1's value without calling/shows the screen first?

and you should write showif day1 == True: as showif day1:
My avatar is courtesy of Mellanthe

sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Re: Imagebutton screen not showing up

#3 Post by sarbezleeb »

That's exactly it! Thank you :)

sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Re: Imagebutton screen not showing up

#4 Post by sarbezleeb »

Actually I just tested it with the show_screen command, and it still didn't show.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Imagebutton screen not showing up

#5 Post by indoneko »

Still didn't work?
Perhaps you can attach your script here so that others can check it for you.
My avatar is courtesy of Mellanthe

sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Re: Imagebutton screen not showing up

#6 Post by sarbezleeb »

Okdk, screens and script files. Use control F to find the relevant sections i suppose. Thanks again for your help :)
Attachments
script.rpy
(205.77 KiB) Downloaded 83 times
screens.rpy
(28.82 KiB) Downloaded 89 times

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Imagebutton screen not showing up

#7 Post by indoneko »

On line 430, you made a typo :
$ day1 = "True"
it should be :
$ day1 = True

And be aware that player can jump to town from the beginning while the day1 value is still False.
I haven't actually tested your code, so if you get another error, just post it again (or send me your full project via PM if you want me to actually play-test it).
My avatar is courtesy of Mellanthe

sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Re: Imagebutton screen not showing up

#8 Post by sarbezleeb »

Curious, I fixed the typo and it still doesn't show. I know the day1 value is actually changed to True, because I tested a line of code where a phrase was printed if it was true. For some reason though, the screen is still not showing. I'll PM you the game so you can have a playtest through it yourself, because I'm not sure what to do.

P.S., that menu at the start is for playtesting purposes only to jump ahead to certain sections without skipping through all the dialogue.

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: Imagebutton screen not showing up

#9 Post by indoneko »

Here's the edited script.rpy + screens.rpy

You might want to backup your original script before copying these files into your game directory.
And before you launch the game, make sure you delete all persistent first, and do force recompile (or delete your old rpyc if the weather screen still doesn't show up).

I haven't really tested every possible combination of choices, but the new script managed to show the weather icon every time I played the game. For information, I use Renpy 6.99.12.4 on windows XP.
Attachments
screens.rpy
edited screens.rpy
(28.82 KiB) Downloaded 77 times
script.rpy
edited script.rpy
(207.42 KiB) Downloaded 88 times
My avatar is courtesy of Mellanthe

sarbezleeb
Regular
Posts: 50
Joined: Sun Nov 13, 2016 5:42 am
Tumblr: tunasandwichofdestiny
Skype: sarbezleeb
Soundcloud: charclo
Contact:

Re: Imagebutton screen not showing up

#10 Post by sarbezleeb »

All working perfectly! Thanks again for all your help :)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]