Code: Select all
play sound "audio/charm.ogg" noloop volume 0.5
scene s1_enquire
with flash_purple
So, I want to move it into a subroutine, so I don't have to keep making multiple updates if I want to mess with the sound.
I make the call like this:
Code: Select all
call charm("s1_enquire")
# play sound "audio/charm.ogg" noloop
# scene s1_enquire
# with flash_purple
Code: Select all
# Display subroutine
label charm(im="black"):
play sound "audio/charm.ogg" noloop volume 0.5
scene expression ImageReference(im)
with flash_purple
return
Code: Select all
File "game/$emotes.rpy", line 61: end of line expected.
play sound "audio/charm.ogg" ->noloop volume 0.5
If i just delete the noloop and the volume 0.5, it crashes at runtime with a very different error:
Code: Select all
While running game code:
File "game/scene1.rpy", line 181, in script call
call charm("s1_enquire")
File "game/$emotes.rpy", line 64, in script
play sound "audio/charm.ogg"
Exception: Sayer 'play' is not defined.
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/scene1.rpy", line 181, in script call
call charm("s1_enquire")
File "game/$emotes.rpy", line 64, in script
play sound "audio/charm.ogg"
File "D:\renpy-7.4.9-sdk\renpy\ast.py", line 881, in execute
who = eval_who(self.who, self.who_fast)
File "D:\renpy-7.4.9-sdk\renpy\ast.py", line 774, in eval_who
raise Exception("Sayer '%s' is not defined." % who)
Exception: Sayer 'play' is not defined.
If I change it to:
Code: Select all
label charm(im="black"):
# play sound "audio/charm.ogg" loopno volume 0.5
$ renpy.sound.play("audio/charm.ogg", "sound", 0, 0, False, False, 0.5)
scene expression ImageReference(im)
with flash_purple
return