global name for all music? (SOLVED)

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
unseenhawk778
Newbie
Posts: 4
Joined: Sat Apr 28, 2018 6:04 pm
Completed: Battle Of Senpai
Projects: False Friends
Organization: DAS Productions
Tumblr: unseenhawk778
itch: https://unseenhawk77
Contact:

global name for all music? (SOLVED)

#1 Post by unseenhawk778 »

Wanted to add music to the game I am making but I am no longer allowed to. This code does come up

Code: Select all

File "renpy/common/000statements.rpy", line 56, in parse_play_music
    file = Ayano()
NameError: global name 'Ayano' is not defined
It does this with any and all audio files I add to ANY of my games now. I removed the audio file "Ayano" a while ago but I still get a traceback. Take out the audio file. Game works fine.

I was told to give the name "Meaning" and when I tried that I got lead back to the same place.

Help much appreciated.



Here is full traceback message

Code: Select all

Full traceback:
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\bootstrap.py", line 306, in bootstrap
    renpy.main.main()
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\main.py", line 357, in main
    renpy.game.script.load_script()  # sets renpy.game.script.
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\script.py", line 266, in load_script
    self.load_appropriate_file(".rpyc", ".rpy", dir, fn, initcode)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\script.py", line 730, in load_appropriate_file
    data, stmts = self.load_file(dir, fn + source)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\script.py", line 553, in load_file
    stmts = renpy.parser.parse(fullfn)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2611, in parse
    rv = parse_block(l)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2573, in parse_block
    stmt = parse_statement(l)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2557, in parse_statement
    return pf(l, loc)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2117, in label_statement
    block = parse_block(l.subblock_lexer(init))
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2573, in parse_block
    stmt = parse_statement(l)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\parser.py", line 2557, in parse_statement
    return pf(l, loc)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\statements.py", line 121, in parse_user_statement
    rv = renpy.ast.UserStatement(loc, l.text, l.subblock)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\ast.py", line 1773, in __init__
    self.name = self.call("label")
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\ast.py", line 1813, in call
    parsed = renpy.statements.parse(self, self.line, self.block)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\statements.py", line 164, in parse
    return pf(l)
  File "C:\Users\NAME\Downloads\renpy-6.99.14.3-sdk\renpy\statements.py", line 146, in parse_data
    return (name, registry[name]["parse"](l))
  File "renpy/common/000statements.rpy", line 56, in parse_play_music
    file = Ayano()
NameError: global name 'Ayano' is not defined

Last edited by unseenhawk778 on Wed May 02, 2018 3:02 pm, edited 1 time in total.

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: global name for all music?

#2 Post by mikolajspy »

Have you tried:

Code: Select all

define audio.ayano = "music/aynao.wav" #or whatever filepath and format you have
and then, in the script:

Code: Select all

play music ayano
It should work. If you have definitions of music in separate file, just add

Code: Select all

init offset = -10
at the top of the file, so the engine registers those definitions before anything else.

unseenhawk778
Newbie
Posts: 4
Joined: Sat Apr 28, 2018 6:04 pm
Completed: Battle Of Senpai
Projects: False Friends
Organization: DAS Productions
Tumblr: unseenhawk778
itch: https://unseenhawk77
Contact:

Re: global name for all music?

#3 Post by unseenhawk778 »

mikolajspy wrote: Sun Apr 29, 2018 6:55 am Have you tried:

Code: Select all

define audio.ayano = "music/aynao.wav" #or whatever filepath and format you have
and then, in the script:

Code: Select all

play music ayano
It should work. If you have definitions of music in separate file, just add

Code: Select all

init offset = -10
at the top of the file, so the engine registers those definitions before anything else.
It didn't work. I still get the error

Code: Select all

NameError: global name 'Ayano' is not defined
My last resort (Sense I have all my projects backed up anyway) is to uninstall renpy and atom and reinstall.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: global name for all music?

#4 Post by Ocelot »

I think it is a correct course of action. It seems that one of standard RenPy files got corrupted somehow. In reality this line should be

Code: Select all

file = l.simple_expression()
Did you do some global find and replace earlier?
< < insert Rick Cook quote here > >

unseenhawk778
Newbie
Posts: 4
Joined: Sat Apr 28, 2018 6:04 pm
Completed: Battle Of Senpai
Projects: False Friends
Organization: DAS Productions
Tumblr: unseenhawk778
itch: https://unseenhawk77
Contact:

Re: global name for all music?

#5 Post by unseenhawk778 »

Ocelot wrote: Tue May 01, 2018 5:11 am I think it is a correct course of action. It seems that one of standard RenPy files got corrupted somehow. In reality this line should be

Code: Select all

file = l.simple_expression()
Did you do some global find and replace earlier?
You bet I did

jlaakso
Newbie
Posts: 4
Joined: Wed Jul 17, 2019 4:30 pm
Contact:

Re: global name for all music?

#6 Post by jlaakso »

mikolajspy wrote: Sun Apr 29, 2018 6:55 am Have you tried:

Code: Select all

define audio.ayano = "music/aynao.wav" #or whatever filepath and format you have
and then, in the script:

Code: Select all

play music ayano
I was having the problem where trying to play music from any folder just wouldn't work, throwing an IOerror exception. The path and filename were 100% correct. What finally solved this was using the define, as above. Thanks a lot!

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: global name for all music?

#7 Post by Imperf3kt »

I realise this reply is probably too late, but I think the issue the OP was having was case-sensitivity
unseenhawk778 wrote: Sun Apr 29, 2018 12:36 pm It didn't work. I still get the error

Code: Select all

NameError: global name 'Ayano' is not defined
OP is writing

Code: Select all

    play music Ayano
    
"Ayano" should be "ayano"
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

Post Reply

Who is online

Users browsing this forum: elcharlo