MusicRoom problems - actions in add are never called

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
papillon
Arbiter of the Internets
Posts: 4107
Joined: Tue Aug 26, 2003 4:37 am
Completed: lots; see website!
Projects: something mysterious involving yuri, usually
Organization: Hanako Games
Tumblr: hanakogames
Contact:

MusicRoom problems - actions in add are never called

#1 Post by papillon »

Trying to set up a music player so that it will display the trackname and composer of each piece as it plays.

However, the actions in the add function are never called at all:

From the documentation:
add(filename, always_unlocked=False, action=None)
Adds the music file filename to this music room. The music room will play unlocked files in the order that they are added to the room.

always_unlocked
If true, the music file will be always unlocked. This allows the file to show up in the music room before it has been played in the game.
action
This is a action or the list of actions. these are called when this file is played.

For example, These actions is used to change a screen or background, description by the playing file.
This is supposed to call the associated action when the file is player. It doesn't work. I've also put in joke actions which ought to immediately crash, just to show that the actions aren't being called at all.

The files are added to the music room and the music tracks play, but the actions are never called.

Code: Select all

  for (track,trackname,composer) in musicList:
    #mr.add(track, always_unlocked=True, action=[SetVariable("jukebox_trackname", trackname), SetVariable("jukebox_composer", composer)])
    mr.add(track, always_unlocked=True, action="BOOM")
(the first, now commented-out, being what I actually wanted it to do. The second being just a quick proof that the actions don't work, since that's not a valid action and ought to throw an error.)

Post Reply

Who is online

Users browsing this forum: Google [Bot]