Styles reset after returning to main menu in game...

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
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Styles reset after returning to main menu in game...

#1 Post by tohtamish »

Some kind of problem:

I use color styles for menus-

style.menu_choice_button.background = None
style.menu_choice_chosen.color = "#ccffffff"
style.menu_choice.hover_color = "#ff0000ff"

but when I return to main menu and start new game, colors are reset to default. Even if I repeat in code

"$style.menu_choice.hover_color = "#ff0000ff"

with beginig by "$" symbol, it uses default colors and my styles don't work!
I cleared out what happens: if I return in main menu and start game, all choices in menus "are done" - they use colors like already chosen by player, but next menus (of next part of game, which are not played yet) - use defined by me colors as I wantes. Etc, I when stop game adn scroll back or return to main menu and replay - all buttons on choices are counted "as pressed" and use pressed colors.

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Styles reset after returning to main menu in game...

#2 Post by Anima »

Where did you define the styles?
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Re: Styles reset after returning to main menu in game...

#3 Post by tohtamish »

I tried in options.rpy and in script.rpy before label start.

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Styles reset after returning to main menu in game...

#4 Post by Anima »

Could you upload the relevant script files?
I have a guess what the problem is, it would be much easier to confirm with the script.
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Re: Styles reset after returning to main menu in game...

#5 Post by tohtamish »

Ok, I try some now, here options.rpy, but there is much russian words)))), I have deleted them to minimize size of text. Many english is deleted too, but somewhere I left. And I have deleted most "##" big templates, but left short sentenses.

=========================================================================================

Code: Select all

init -1 python hide:
    config.developer = True
    config.screen_width = 800
    config.screen_height = 600
    config.window_title = u"Развлечь мёртвую звездy"
    layout.button_menu()
    theme.roundrect(
        # Color scheme: Basic Blue
                                  
        ## The color of an idle widget face.
        widget = "#003c78",
        ## widget = "None",

        ## The color of a focused widget face.
        widget_hover = "#0050a0",
       ## widget_hover = "None",

        ## The color of the text in a widget.
        widget_text = "#c8ffff",

        ## The color of the text in a selected widget. (For
        ## example, the current value of a preference.)
        widget_selected = "#ffffc8",

        ## The color of a disabled widget face. 
        disabled = "#404040",

        ## The color of disabled widget text.
        disabled_text = "#c8c8c8",

        ## The color of informational labels.
        label = "#ffffff",

        ## The color of a frame containing widgets.
        frame = "#6496c8",

        ## The background of the main menu. This can be a color
        ## beginning with '#', or an image filename. The latter
        ## should take up the full height and width of the screen.
        mm_root = "ergo_proxy12.jpg",

        ## The background of the game menu. This can be a color
        ## beginning with '#', or an image filename. The latter
        ## should take up the full height and width of the screen.
        gm_root = "44.jpg",

        ## If this is True, the in-game window is rounded. If False,
        ## the in-game window is square.
        rounded_window = False,

        ## And we're done with the theme. The theme will customize
        ## various styles, so if we want to change them, we should
        ## do so below.            
        )


    style.default.size = 16

    config.has_sound = True

    config.has_music = True

    config.has_voice = True

    config.help = "README.html"

    config.enter_transition = None

    config.exit_transition = None

    config.intra_transition = None

    config.main_game_transition = None

    config.game_main_transition = None

    config.end_splash_transition = None

    config.end_game_transition = None
    
    config.after_load_transition = None
    
    config.window_show_transition = None

    config.window_hide_transition = None

python early:
    config.save_directory = "Razvlech mertvuyu zvezdu-1272534292"
    
init -1 python hide:
    
    config.default_fullscreen = False

    config.default_text_cps = 40
        
    config.window_title = u"Развлечь мёртвую звезду"

Last edited by tohtamish on Wed Mar 16, 2011 3:40 am, edited 1 time in total.

User avatar
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Re: Styles reset after returning to main menu in game...

#6 Post by tohtamish »

And here is script.rpy in the beginning of my game.

Code: Select all


init:
    
    $ p1 = Character(u'Пилот', color="#c8ffc8")
    $ k1 = Character(u'Командор', color="#c8ffc8")
    $ h1 = Character(u'Харука', color="#c8ffc8")
    $ p2 = Character(u'Пилот2', color="#c8ffc8")
    $ k2 = Character(u'Командор2', color="#c8ffc8")
    $ h2 = Character(u'Харука2', color="#c8ffc8")
    $ AI = Character(u'Лилу', color="#c8ffc8" )
    $ a = Character(u'мистер Адамс', color="#c8ffc8")
    # $ narrator = NVLCharacter(None, kind=nvl)
    
    

init python:
    
    style.menu_window.yalign = 0.9
        
    style.menu_choice.size = 16    
  
    # $ style.button_text.size = 12    

    style.default.size = 16    

    config.adv_nvl_transition = dissolve
    config.nvl_adv_transition = dissolve
    
    _preferences.set_volume ('music', 0.1)
    
    config.main_menu_music = "1vibrasphere.ogg"

    config.game_menu_music = None    

    # config.empty_window = nvl_show_core
    config.window_hide_transition = dissolve
    config.window_show_transition = dissolve 

    style.nvl_window.xpadding = 15
    style.nvl_window.ypadding = 15

    style.nvl_vbox.box_spacing = 10      

    style.nvl_window.right_margin = 20
    style.nvl_window.top_margin = 20
    style.nvl_window.bottom_margin = 20
    style.nvl_window.left_margin = 20    

    style.menu_choice_button.background = None  
    
    #style.menu_choice_chosen.color = "#ccffffff"
    style.menu_choice_chosen.color = "#ff0000ff"

    style.menu_choice.hover_color = "#ff0000ff" 


label start:
    
 
    scene bg_girl3

    nvl clear
 
    menu:        
        "Start game":
            pass 
        
    play music "3shpongle_Cosmic_Mirror.ogg"
    # stop music
        
    scene ship2
    
    stop music
    play music "shark.ogg"
    
    "Game started"

==============================================================================
That's my game. =) I couldn't invent much better for dialogues than using menus functions. That is the menus are used not for choices, but just for dialogues. When player move mouse over menu text, it must change color. Sometimes, of course, there are some selections in game.
Last edited by tohtamish on Wed Mar 16, 2011 3:41 am, edited 1 time in total.

User avatar
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Re: Styles reset after returning to main menu in game...

#7 Post by tohtamish »

(forum deleted spacing formats and doubled my posts, I edited them because can't delete)

Anima
Veteran
Posts: 448
Joined: Wed Nov 18, 2009 11:17 am
Completed: Loren
Projects: PS2
Location: Germany
Contact:

Re: Styles reset after returning to main menu in game...

#8 Post by Anima »

The forum can only preserve indentions inside

Code: Select all

[code]
[/code] blocks.

Why are you using menu's for the dialogue instead of say statements?

I think you'll have to change the prefix from hover to selected_hover for your style.
Avatar created with this deviation by Crysa
Currently working on:
  • Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III

User avatar
tohtamish
Regular
Posts: 65
Joined: Thu Apr 29, 2010 4:56 am
Contact:

Re: Styles reset after returning to main menu in game...

#9 Post by tohtamish »

I use menus to emphasis on second story line, it is some kind of two stories - main story and hero's thoughts about past, his memory, they go parallel and cross on some moments and affect on each other, so I needed strong difference between these two type of texts.

======================

Tried your solution, works fine, thanks!

Post Reply

Who is online

Users browsing this forum: Andredron, Exiscoming