Here's the coding for the music player:
screens:
Code: Select all
#On Screen Music Player
#
#This is where the on screen mp3 player thing is that shows the titles of the tracks
screen playing_music:
$ playing = renpy.music.get_playing(6)
if playing is not None:
$ playing = musictitles[playing]
text playing[0] xpos 0.1 ypos 0.1 color playing[1] size playing[2] #font playing[3]
else:
text "No Music Playing" xpos 0.1 ypos 0.1Code: Select all
$ musictitles = {"music/jechantes.mp3":("Je Chantes","#00FF00",20)}
$ musictitles = {"music/fat girl.mp3":("Fat Girl","#00FF00",20)}
python:
def ambient(songlist, interval):
playlist = ["music/pause.wav"]
for song in songlist:
playlist.append(song)
j = renpy.random.randint(2, interval)
for i in range(0, j):
playlist.append("music/pause.wav")
return renpy.music.play(playlist, channel=6)
label start:
scene bgcar
with fade
$ ambient(("music/jechantes.mp3","music/fat girl.mp3"), 4)
$ renpy.pause(.25)
show screen playing_music
"I recently lost my job."Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 77, in script
File "game/screens.rpy", line 506, in python
KeyError: 'music/pause.wav'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\execution.py", line 288, in run
node.execute()
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\ast.py", line 453, in execute
renpy.exports.say(who, what, interact=self.interact)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\exports.py", line 757, in say
who(what, interact=interact)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\character.py", line 795, in __call__
self.do_display(who, what, cb_args=self.cb_args, **display_args)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\character.py", line 671, in do_display
**display_args)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\character.py", line 474, in display_say
rv = renpy.ui.interact(mouse='say', type=type, roll_forward=roll_forward)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\ui.py", line 237, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 1853, in interact
repeat, rv = self.interact_core(preloads=preloads, **kwargs)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 2092, in interact_core
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 250, in visit_all
d.visit_all(callback)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 250, in visit_all
d.visit_all(callback)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 250, in visit_all
d.visit_all(callback)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 252, in visit_all
callback(self)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\core.py", line 2092, in <lambda>
root_widget.visit_all(lambda i : i.per_interact())
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\screen.py", line 166, in per_interact
self.update()
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\display\screen.py", line 266, in update
self.screen.function(**self.scope)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\screenlang.py", line 1217, in __call__
renpy.python.py_exec_bytecode(self.code.bytecode, locals=scope)
File "C:\Users\Anon\Downloads\renpy-6.14.1-sdk\renpy-6.14.1-sdk\renpy\python.py", line 1297, in py_exec_bytecode
exec bytecode in globals, locals
File "game/screens.rpy", line 506, in <module>
$ playing = musictitles[playing]
KeyError: 'music/pause.wav'
Windows-post2008Server-6.2.9200
Ren'Py 6.15.4.320Any help would be greatly appreciated.