添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
豪气的薯片  ·  [SOLVED] Krita 5.2.2 ...·  2 月前    · 
火星上的海豚  ·  apache.commons.csv ...·  3 月前    · 
英勇无比的跑步鞋  ·  Spring Boot ...·  1 年前    · 

Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.

Visit our new games list and discord server . NaNoRenO ends when April begins . Activation problem? Email PyTom .
Hey, everyone,
I've looked everywhere online, but I haven't seen anyone with this specific issue. What's odd is that in the beginning of the game, the music plays just fine, but around line 700, it won't play. The music is copied to the game and audio folder, which had worked for all of the songs. Does the traceback hint at where the problem is? I'm not familiar enough with Ren'Py to know exactly what's going wrong. (Would it help for me to include code? I didn't want to spam with my entire VN, but the problem is so bizarre that I'm not sure what would help.)
Thank you very much!

Code: Select all

I'm sorry, but an uncaught exception occurred.
While running game code:
  File "game/script.rpy", line 721, in script
    play music tokyo.ogg
  File "renpy/common/000statements.rpy", line 120, in execute_play_music
    renpy.music.play(_audio_eval(p["file"]),
  File "renpy/common/000statements.rpy", line 32, in _audio_eval
    return eval(expr, locals=store.audio.__dict__)
  File "game/script.rpy", line 721, in <module>
    play music tokyo.ogg
AttributeError: 'unicode' object has no attribute 'ogg'
-- Full Traceback ------------------------------------------------------------
Full traceback:
  File "game/script.rpy", line 721, in script
    play music tokyo.ogg
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\ast.py", line 1949, in execute
    self.call("execute")
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\ast.py", line 1937, in call
    return renpy.statements.call(method, parsed, *args, **kwargs)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\statements.py", line 277, in call
    return method(parsed, *args, **kwargs)
  File "renpy/common/000statements.rpy", line 120, in execute_play_music
    renpy.music.play(_audio_eval(p["file"]),
  File "renpy/common/000statements.rpy", line 32, in _audio_eval
    return eval(expr, locals=store.audio.__dict__)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\python.py", line 2059, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\14076\Downloads\renpy-7.3.5-sdk\renpy\python.py", line 2052, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/script.rpy", line 721, in <module>
    play music tokyo.ogg
AttributeError: 'unicode' object has no attribute 'ogg'
Windows-8-6.2.9200
Ren'Py 7.3.5.606
The Legend of Jessie Cube 1.0
Wed Jan 20 15:58:58 2021
			
You forgot to wrap your file name in quotation.
Add " to the start and end of the filename.

Code: Select all

play music "tokyo.ogg"
							
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Current project: GGD Mentor
Twitter
Imperf3kt wrote: Wed Jan 20, 2021 5:21 pm You forgot to wrap your file name in quotation.
Add " to the start and end of the filename.

Code: Select all

play music "tokyo.ogg"
How embarrassing. Thank you so much! You really helped me out.
Adding on to Imperf3kt's answer:
When a sound file is in the game/audio/ directory, and doesn't contain spaces or other special characters, it winds up getting defined in the audio namespace. The play and queue statements try the audio namespace before the default one. So you can just write:

Code: Select all

play music tokyo
in this case. (But it wouldn't work if the name as "tokyo drift.ogg", because of the space.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom