vbox correction problem

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
Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

vbox correction problem

#1 Post by Psion »

So i am trying to teach myself coding by taking others code and implementing it in my project.
I took code to count days\time and copied it in my project. It worked fine but looked much worse.
It has blue lines when i hover mouse and dark lines when i'm not. Also they in the middle of the screen and not moving even after i change xalign
Can you tell me why it so and how can i fix it? Or where can i read about it?

Code: Select all

screen dayinfo:
    zorder 4
    if dn > 24:
        $ dn = 0
    if dn > 0 and dn < 5:
        $ daytime = _("MORNING")
        $ daytimejump = 5
    elif dn > 4 and dn < 10:
        $ daytime = _("AFTERNOON")
        $ daytimejump = 10
    elif dn > 9 and dn < 16:
        $ daytime = _("EVENING")
        $ daytimejump = 16
    elif dn > 16:
        $ daytime = _("NIGHT")
    $ dn_show = dn + 7
    if dn_show > 23:
        $ dn_show = dn - 17
    vbox:
        xalign 0.01
        yalign 0.01
        hbox:
            textbutton _("DAY"):
                text_color "#eddbc3"
                text_size 40
                style style.choice_button
                text_hover_outlines [(3, "#cc0000", 0, 0)]
                text_idle_outlines [(3, "#111111", 0, 0)]
                text_font "font/foo_regular.ttf"
                action If (block_day_button, SetVariable("dn", 0), Jump("start"))
            null width 2
            text str(daynum):
                size 40
                outlines [(3, "#222222", 0, 0)]
                font "font/foo_regular.ttf"

        null height -10
        textbutton str(daytime):
            xalign 0.1

            text_size 25
            style style.choice_button
            text_hover_outlines [(3, "#cc0000", 0, 0)]
            text_idle_outlines [(3, "#111111", 0, 0)]
            text_font "font/foo_regular.ttf"
            action If (block_day_button,None,(If(dn < 16, SetVariable("dn", daytimejump), Jump(start)), None))
        null height -10
        textbutton "[dn_show]:00":
            xalign 0.1

            text_size 25
            style style.choice_button
            text_hover_outlines [(3, "#cc0000", 0, 0)]
            text_idle_outlines [(3, "#111111", 0, 0)]
            text_font "font/foo_regular.ttf"
            action If (block_day_button,None,(If (dn<20, SetVariable("dn", dn + 1), Jump(start)), None))
Attachments
how it is looked in my project
how it is looked in my project
how it is looked in original game
how it is looked in original game
2021-06-08 08_02_05-My cute roommate 1.6.1ex.png (12.28 KiB) Viewed 955 times

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: vbox correction problem

#2 Post by zmook »

The lines `style style.choice_button` are your problem. That tell's renpy to use the choice_button style for those textbuttons, and choice_button is defined by default in gui.rpy to be centered on the screen with a long horizontal background bar. It's the default style used by choices from the menu statement.

The game you took this code from had redefined the style, somewhere.
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

Re: vbox correction problem

#3 Post by Psion »

I suspected it has something to do with style stuff...
So i found this code:

Code: Select all

define gui.choice_button_width = None
define gui.choice_button_height = None
define gui.choice_button_tile = False
define gui.choice_button_borders = Borders(0, 0, 0, 0)
define gui.choice_button_text_font = "font/Oswald-SemiBold.ttf"
define gui.choice_button_text_size = 50
define gui.choice_button_text_xalign = 0.5
define gui.choice_button_text_idle_color = "#ffffff"
define gui.choice_button_text_hover_color = "#ffffff"
define gui.choice_button_text_idle_outlines = [(4, "#111111", 0, 0)]
define gui.choice_button_text_hover_outlines = [(4, "#d94c3a", 0, 0)]
adding it fixed most of problems. Now i know where to dig, thank you very much. :)
There still some borders and blue collour though :\
Attachments
2021-06-10 21_36_49-lets code 2.png
2021-06-10 21_36_49-lets code 2.png (40.7 KiB) Viewed 855 times

Post Reply

Who is online

Users browsing this forum: Google [Bot]