Page 1 of 1
which different between 'play music' and '$renpy.music.play'?
Posted: Wed Aug 12, 2020 2:05 pm
by wtfman
As far as I know, ren'py has two ways to play music files. one is play music "filename.ext", another one is $renpy.music.play("filename.ext")...
I wonder which is different between these commands.
may I use anything that is convenient for me?
Re: which different between 'play music' and '$renpy.music.play'?
Posted: Wed Aug 12, 2020 3:36 pm
by hell_oh_world
They are pretty much the same, they differ on where you use them. If you're inside a renpy code block where renpy syntax exists, such as when youre inside a label you can use the play command. But when youre inside python where renpy syntax doesnt exist (only native pythonic syntax is allowed) then you use the renpy.music.play function, example would be if youre inside a python: block where multiline python codes are allowed or through $ statement where you are allowed to use single line python syntax. Maybe just remember this... Anything that makes things around renpy easier are pure renpy syntax, such as that play command wherein you wouldnt bother typing renpy.music.play like what is supposed in the python counterpart.
Code: Select all
label start:
$ renpy.music.play("some.mp3") # $ allows python single statements.
python:
play music "some3.mp3" # wont work you told renpy to read lines inside the python: block to run under python... So renpy syntax isn't allowed
renpy.music.play("some3.mp3") # wont work since you didnt tell renpy to read this line in python. Use $ or python: instead.