Choice menu refusing to customize?

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
LiveTurkey
Regular
Posts: 106
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Choice menu refusing to customize?

#1 Post by LiveTurkey » Fri Jan 27, 2017 1:18 am

I am trying to customize my choice menu. I know this is a heavily asked question so I searched through the forums. There were mostly two solutions given.

One, in the screens file

Code: Select all

screen choice(items):
    window: 
        style "menu_window"        
        xalign 0.5
        yalign 0.5
init -2:
    $ config.narrator_menu = True
    
    ## ----- Button Background ------------------------------------- 
    style menu_choice_button is button:
        background Frame("boxes/boxg.png",0,0)
        hover_background  Frame("boxes/boxh.png",0,0)
    
    # Sets Max Widths
        xminimum int(config.screen_width * 0.45)
        xmaximum int(config.screen_width * 0.45)

    #Sets minimum height -- recommend exact height of your button image    
        yminimum 60
        ypadding 5
        xpadding 5
This just strangely moves my textbox (the one on the bottom) to the middle of the screen.

Two, in the options file

Code: Select all

style.menu_choice_button.background = Frame("boxes/boxg.png",25,15)
style.menu_choice_button.hover_background = Frame("boxes/boxh.png",25,15)
style.menu_choice_button.yminimum = 40
style.menu_choice_button.xminimum = 375


That just returns with

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


File "game/options.rpy", line 206: expected 'word' not found.
    style.menu_choice_button.background = Frame("boxes/boxg.png",25,15)
         ^

File "game/options.rpy", line 207: expected 'word' not found.
    style.menu_choice_button.hover_background = Frame("boxes/boxh.png",25,15)
         ^

File "game/options.rpy", line 208: expected 'word' not found.
    style.menu_choice_button.yminimum = 40
         ^

File "game/options.rpy", line 209: expected 'word' not found.
    style.menu_choice_button.xminimum = 375
         ^

Ren'Py Version: Ren'Py 6.99.12.1.2012
Does anyone know where I'm going wrong?

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Choice menu refusing to customize?

#2 Post by IrinaLazareva » Fri Jan 27, 2017 4:34 am

Code: Select all

init -1 python hide:      #<<<
    style.menu_choice_button.background = Frame("boxes/boxg.png",25,15)
    style.menu_choice_button.hover_background = Frame("boxes/boxh.png",25,15)
    style.menu_choice_button.yminimum = 40
    style.menu_choice_button.xminimum = 375

User avatar
LiveTurkey
Regular
Posts: 106
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Choice menu refusing to customize?

#3 Post by LiveTurkey » Fri Jan 27, 2017 12:16 pm

That still didn't work. Now just nothing appears. This is strange.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Choice menu refusing to customize?

#4 Post by Divona » Fri Jan 27, 2017 1:57 pm

LiveTurkey wrote:That still didn't work. Now just nothing appears. This is strange.
Have you set "style_prefix" in "screen choice" to be "menu_choice"?

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      xalign 0.5
      yalign 0.5

      vbox:
        for i in items:
          textbutton i.caption action i.action

define config.narrator_menu = True

style menu_choice_vbox is vbox
style menu_choice_button is button
style menu_choice_button_text is button_text

style menu_choice_button:
    background Frame("boxes/boxg.png", 0, 0)
    hover_background Frame("boxes/boxh.png", 0, 0)

    xminimum int(config.screen_width * 0.45)
    xmaximum int(config.screen_width * 0.45)

    yminimum 60
    ypadding 5
    xpadding 5
Completed:
Image

User avatar
LiveTurkey
Regular
Posts: 106
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Choice menu refusing to customize?

#5 Post by LiveTurkey » Fri Jan 27, 2017 4:14 pm

Divona wrote:
LiveTurkey wrote:That still didn't work. Now just nothing appears. This is strange.
Have you set "style_prefix" in "screen choice" to be "menu_choice"?

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      xalign 0.5
      yalign 0.5

      vbox:
        for i in items:
          textbutton i.caption action i.action

define config.narrator_menu = True

style menu_choice_vbox is vbox
style menu_choice_button is button
style menu_choice_button_text is button_text

style menu_choice_button:
    background Frame("boxes/boxg.png", 0, 0)
    hover_background Frame("boxes/boxh.png", 0, 0)

    xminimum int(config.screen_width * 0.45)
    xmaximum int(config.screen_width * 0.45)

    yminimum 60
    ypadding 5
    xpadding 5
This almost works. Now I have the menus shown but my textbox is also shown for some reason. I'll include an image.

https://i.imgur.com/z7kXoUI.png

Also how do I control all the various aspects like font, spacing, postion, color of letters, etc. I know this is all possible I just don't know the variable names and such. Thanks again

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Choice menu refusing to customize?

#6 Post by gas » Fri Jan 27, 2017 4:45 pm

LiveTurkey wrote:
Divona wrote:
LiveTurkey wrote:That still didn't work. Now just nothing appears. This is strange.
Have you set "style_prefix" in "screen choice" to be "menu_choice"?

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      xalign 0.5
      yalign 0.5

      vbox:
        for i in items:
          textbutton i.caption action i.action

define config.narrator_menu = True

style menu_choice_vbox is vbox
style menu_choice_button is button
style menu_choice_button_text is button_text

style menu_choice_button:
    background Frame("boxes/boxg.png", 0, 0)
    hover_background Frame("boxes/boxh.png", 0, 0)

    xminimum int(config.screen_width * 0.45)
    xmaximum int(config.screen_width * 0.45)

    yminimum 60
    ypadding 5
    xpadding 5
This almost works. Now I have the menus shown but my textbox is also shown for some reason. I'll include an image.

https://i.imgur.com/z7kXoUI.png

Also how do I control all the various aspects like font, spacing, postion, color of letters, etc. I know this is all possible I just don't know the variable names and such. Thanks again
You have to define background None for the window in the choice screen.
Styles works like CSS, and inherit properties from default parents (in that given case, you have set a window background in old legacy options.rpy, right XD?)
To know stuff, hover an element, press shit+I, then the element style link. It show you defined properties.
Anyway, Documentation "Customizing renpy" tell you every names and such.
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
LiveTurkey
Regular
Posts: 106
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Choice menu refusing to customize?

#7 Post by LiveTurkey » Fri Jan 27, 2017 5:00 pm

gas wrote:
You have to define background None for the window in the choice screen.
Styles works like CSS, and inherit properties from default parents (in that given case, you have set a window background in old legacy options.rpy, right XD?)
To know stuff, hover an element, press shit+I, then the element style link. It show you defined properties.
Anyway, Documentation "Customizing renpy" tell you every names and such.
I made it look almost right. Here is the updated version

https://i.imgur.com/Y73iJYV.jpg

Here is the code

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      
      xalign .5
      yalign .7

      vbox:
        style "menu"
        spacing 20
        for i in items:
          textbutton i.caption action i.action

define config.narrator_menu = True

style menu_choice_vbox is vbox
style menu_choice_button is button
style menu_choice_button_text is button_text

style menu_choice_button:
    background Frame("boxes/boxg.png", 0, 0)
    hover_background Frame("boxes/boxh.png", 0, 0)

    xminimum 800
    xmaximum 1600

    yminimum 5
    ypadding 150
    xpadding 150
    
style menu_choice_button_text:
    font  "gui/fonts/KGPrimaryPenmanshipAlt.ttf"
    size  45
    color  "#ffcc66"
    hover_color  "#ffffff"

    xalign 0.5
    yalign 0.5

    outlines  [(1, "#330000", 0, 0)]        
    hover_outlines  [(1, "#660066", 0, 0)]

    drop_shadow  [(2, 2)] 
    drop_shadow_color "#663300"
Now you are saying to get rid of the textbox I have to set the background to none in the window? How do I do that?

Also, I cant figure out how to move everything to the right. I'm able to move it up and down by changing the yalign but changing the xalign does nothing. I tried integers, floats, small numbers, big numbers, negatives, almost everything.

Is it possible to make it center aligned instead of left aligned and just shift-right?

Thanks again.

User avatar
gas
Miko-Class Veteran
Posts: 838
Joined: Mon Jan 26, 2009 7:21 pm
Contact:

Re: Choice menu refusing to customize?

#8 Post by gas » Fri Jan 27, 2017 5:22 pm

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      background None   ###  <----  add this
      xalign .5
      yalign .7
And, to center buttons...

Code: Select all

    vbox:
        style "menu"
        xfill True ## <--- add this
        spacing 20
        for i in items:
          textbutton i.caption action i.action xalign 0.5 ### <--- add this
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.

10 ? "RENPY"
20 GOTO 10

RUN

User avatar
LiveTurkey
Regular
Posts: 106
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Choice menu refusing to customize?

#9 Post by LiveTurkey » Fri Jan 27, 2017 5:30 pm

gas wrote:

Code: Select all

screen choice(items):

    style_prefix "menu_choice"

    window:
      style "menu_window"
      background None   ###  <----  add this
      xalign .5
      yalign .7
And, to center buttons...

Code: Select all

    vbox:
        style "menu"
        xfill True ## <--- add this
        spacing 20
        for i in items:
          textbutton i.caption action i.action xalign 0.5 ### <--- add this
Thank You!

kistnerelizabeth
Regular
Posts: 74
Joined: Wed Feb 10, 2016 1:20 am

Re: Choice menu refusing to customize?

#10 Post by kistnerelizabeth » Tue Apr 18, 2017 5:01 am

Thank you for this post! I kept experimenting for hours and you guys fixed my error for me. Thanks. :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]