If you're having trouble or run into any bugs with the code, post a comment here! I will try to get back to you within a few days.
Fully featured music room with improved usability and setup for Ren'Py. · By
So I just found your awesome tool today, and was going through the readme directions and got things most of the way set up with implementing the tool. It took some tries to get past some initial error messages from Ren'py, mostly due to my lack of understanding of how to set it up, but I got the music room to appear in the menu and visually.
What I didn't understand though was, when I tried to add my own songs to the list, either by replacing the path of the existing entries, or copying the existing music_room.add functions, it was like Ren'Py wasn't seeing the changes. The tracks shown in the music player list weren't changing, even when I outright deleted a few of the pre-existing example entries for the sake of testing.
The steps I followed were:
And up to this point it's more or less working as intended (excuse the clunky visuals in the screenshot, as my game is in 1280x720 resolution so I haven't gotten far enough along yet to worry about making it look and fit better visually.)
It's just when I try to modify or add any tracks under the "Music Room Declaration" section where I start running into issues (here's an example screenshot:)
The track list doesn't update to include the new tracks in any of the 3 layout modes. I even tried taking one of the existing entries and just changing its path from the silence generation to one of the test tracks paths, and it didn't really update visually or functionally in the player.
That's as far as I've gotten with trying to implement things thus far. Are there steps I am still missing or not understanding? Does it have something to do with trying to adapt it to 720p instead of 1080 (seems unlikely?) Maybe the folder setup when I copied things over originally was the incorrect way and now it's causing issues?
Edited to add: I'm using Ren'Py v 8.1.3 and I'm on Linux if that matters at all.
How are you testing if this works? I've noticed that 8.1.3 doesn't seem to refresh values declared with define on a shift+R refresh as it once did, so you may need to close the game and re-open it to see any changes. Be sure to search your project folder for music_room also to ensure you're not re-declaring the music room twice or anything!
I have been closing out the game and re-launching it each time to test. I double-checked the project folder, and there were two instances as you mentioned, so I deleted the extraneous ones, but it still isn't showing the changes to the track list.
I had them in two locations: "game" folder and "game/music_room" folder. I tried deleting each set separately, to see if keeping them in one location or the other would work, and neither seemed to update the track list, although both "worked" equally well, for what it's worth.
Okay, I more or less figured out a solution. I'm not 100% sure which of these steps solved the issue, but it was some combination of the following:
Thanks for your suggestions! They did help me figure out what I was doing wrong. If I bump into any more issues I'll post back, but I think it's looking good now!
Hello! I've tried implementing the code in my game but upon trying to access it I get this error. I'm running Renpy 8.2.
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "renpy/common/00gamemenu.rpy", line 174, in script
$ ui.interact()
File "F:\renpy-8.2.0-sdkarm\renpy\ast.py", line 823, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "F:\renpy-8.2.0-sdkarm\renpy\python.py", line 1178, in py_exec_bytecode
exec(bytecode, globals, locals)
File "renpy/common/00gamemenu.rpy", line 174, in <module>
$ ui.interact()
File "F:\renpy-8.2.0-sdkarm\renpy\ui.py", line 301, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2165, in interact
repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2683, in interact_core
root_widget.visit_all(lambda d : d.per_interact())
File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
d.visit_all(callback, seen)
File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
d.visit_all(callback, seen)
File "F:\renpy-8.2.0-sdkarm\renpy\display\displayable.py", line 431, in visit_all
d.visit_all(callback, seen)
[Previous line repeated 1 more time]
File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 480, in visit_all
callback(self)
File "F:\renpy-8.2.0-sdkarm\renpy\display\core.py", line 2683, in <lambda>
root_widget.visit_all(lambda d : d.per_interact())
File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 491, in per_interact
self.update()
File "F:\renpy-8.2.0-sdkarm\renpy\display\screen.py", line 697, in update
self.screen.function(**self.scope)
File "game/music_room/music_room.rpy", line 718, in execute
screen music_room3(mr):
File "game/music_room/music_room.rpy", line 718, in execute
screen music_room3(mr):
File "game/music_room/music_room.rpy", line 744, in execute
fixed:
File "game/music_room/music_room.rpy", line 788, in execute
frame:
File "game/music_room/music_room.rpy", line 790, in execute
has hbox
File "game/music_room/music_room.rpy", line 806, in execute
vbox:
File "game/music_room/music_room.rpy", line 840, in execute
hbox:
File "game/music_room/music_room.rpy", line 849, in execute
music_bar:
File "game/music_room/01_music_room_backend.rpy", line 39, in __init__
TypeError: super(type, obj): obj must be an instance or subtype of type
I initially wondered if this was a compatibility issue with 8.2, but as I check for compatibility, I haven't had any issues running the Extended Music Room on 8.2. Can you try adding the music room to a fresh project to see if you get the same error? If not, try using Force Recompile for your current project to make sure you don't have any old files lying around, and perhaps double check that you don't have anything else named AudioBar in your project.
Hey.
I want to make the music room available only in the main menu and specific places in the game. After the segments where the player can access the music room, I want control over what music plays as a developer again, so I try to do `stop music`, but that doesn't seem to work anymore with this script.
Hello! Feel free to adjust the size of the images directly (e.g. in Photoshop) - that said, the example screens are made specifically for 1920x1080 so you will be responsible for adjusting any styles or positions to suit your resolution if you want to use the provided screens. Otherwise, you can follow them as a template and design your own screen!