Unable to Create Custom Textbutton For Music Room

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
jacobjumper
Regular
Posts: 44
Joined: Tue Jan 07, 2014 9:45 pm
Projects: Familiarity
Organization: Airheart
Location: Houston
Contact:

Unable to Create Custom Textbutton For Music Room

#1 Post by jacobjumper »

So I have a music room that isn't the same as in the cookbook.

Code: Select all

init python:
    mr = MusicRoom(fadeout = 1.0)
    
    #Song List
    mr.add("music/Act1/00-00-01 Flair of Familiarity - Slow.ogg", always_unlocked=True)
    mr.add("music/Act1/01-01-01 Ambient3.ogg")
    mr.add("music/Act1/01-01-02 Another Pint Please - Foggy.ogg")
    mr.add("music/Act1/01-01-02 Another Pint Please - Chronic.ogg")
    mr.add("music/Act1/01-03-01 Feel Strings2.ogg")
    mr.add("music/Act1/01-03-02 Flair of Familiarity - Shipwright.ogg")
    mr.add("music/Act1/01-99-01 Clandestine Passenger - Extended Version.ogg")
    mr.add("music/Act1/01-03-03 Feel Strings4.ogg")
#Screen
screen music_room:
    tag menu 
    modal True
    add "ui/extras_submenu.jpg"

    frame:
        has vbox

        textbutton "Flair Of Familiarity" action mr.Play ("music/Act1/00-00-01 Flair of Familiarity - Slow.ogg")
        textbutton "Ambience #3" action mr.Play("music/Act1/01-01-01 Ambient3.ogg")
        textbutton "Another Pint Please - Foggy Memories" action mr.Play("music/Act1/01-01-02 Another Pint Please - Foggy.ogg")
        textbutton "Another Pint Please - Chronic Alchoholism" action mr.Play("music/Act1/01-01-02 Another Pint Please - Chronic.ogg")
        textbutton "Feel Strings #2" action mr.Play("music/Act1/01-03-01 Feel Strings2.ogg")
        textbutton "Flair of Familiarity - Shipwright Fiddle" action mr.Play("music/Act1/01-03-02 Flair of Familiarity - Shipwright.ogg")
        textbutton "Clandestine Passenger" action mr.Play("music/Act1/01-99-01 Clandestine Passenger - Extended Version.ogg")
        textbutton "Feel Strings #4" action mr.Play("music/Act1/01-03-03 Feel Strings4.ogg")
        
        null height 20
        
        textbutton "Next" action mr.Next()
        textbutton "Previous" action mr.Previous()
        
        null height 20
        
        textbutton "Return" action Hide("music_room")
    #Starts new music upon entry to the music room
    on "replace" action mr.Play()
    #Resumes main menu music
    on "replaced" action Play("music", "music/Act1/00-00-01 Flair of Familiarity - Slow.ogg")
    key "K_ESCAPE" action Hide("music_room")
    
But I want to change those tetxtbuttons so they have a custom background, so I tried

Code: Select all

init:
    style.musicroom = Style(style.button_text)
    style.musicroom.background = Frame("ui/button.png", 10,10)
giving me the error:

Code: Select all

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


File "game/gallery.rpy", line 2: expected 'word' not found.
    style.musicroom = Style(style.button_text)
         ^

File "game/gallery.rpy", line 3: expected 'word' not found.
    style.musicroom.background = Frame("ui/button.png", 10,10)
         ^

Ren'Py Version: Ren'Py 6.99.12.4.2187
[/code]

I have other styles that work just fine, so I don't know why this is giving me trouble

User avatar
jacobjumper
Regular
Posts: 44
Joined: Tue Jan 07, 2014 9:45 pm
Projects: Familiarity
Organization: Airheart
Location: Houston
Contact:

Re: Unable to Create Custom Textbutton For Music Room

#2 Post by jacobjumper »

I tried using the code

Code: Select all

style.button['Musicroom'].background = "ui/button.png"
but because it isn't a frame, I couldn't center it properly.

User avatar
jacobjumper
Regular
Posts: 44
Joined: Tue Jan 07, 2014 9:45 pm
Projects: Familiarity
Organization: Airheart
Location: Houston
Contact:

Re: Unable to Create Custom Textbutton For Music Room

#3 Post by jacobjumper »

Wrapping it all up like

Code: Select all

init:
	$ style.musicroom...
Gets me a new error when I try to load that screen, that music room isn't defined as a style.

Post Reply

Who is online

Users browsing this forum: bonnie_641, Google [Bot]