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.
-
Fealow
- Newbie
- Posts: 9
- Joined: Sat Sep 16, 2017 8:56 am
-
Contact:
#1
Post
by Fealow » Sat Sep 16, 2017 9:05 am
So I have this code here:
Code: Select all
if not renpy.music.get_playing(channel='music') == "out_and_about.ogg":
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action [Play("music", loop=1.777, "out_and_about.ogg"), Jump("lbl_townmap_setup")
else:
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action Jump("lbl_townmap_setup")
the problem is that the "loop=1.777" part is not working, seems like its being ignored.
The idea is that this track will play when the player hits the map button and continues to play without stopping if the player transistions to another location that uses the same music file or if they hit the map button again. All of the code that does that is working fine, but in this particular part of the code the loop statement is just not doing anything.
Any thoughts?
Thanks
-
Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
-
Contact:
#2
Post
by Divona » Sat Sep 16, 2017 11:09 am
Look like
"loop" is taking Boolean instead of value.
Code: Select all
loop
If this is True, the tracks will loop while they are the last thing in the queue.
Instead, do this:
Code: Select all
if not renpy.music.get_playing(channel='music') == "out_and_about.ogg":
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action [Play("music", "<loop=1.777>out_and_about.ogg"), Jump("lbl_townmap_setup")
else:
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action Jump("lbl_townmap_setup")
Completed:

-
Fealow
- Newbie
- Posts: 9
- Joined: Sat Sep 16, 2017 8:56 am
-
Contact:
#3
Post
by Fealow » Sat Sep 16, 2017 3:15 pm
Divona wrote: ↑Sat Sep 16, 2017 11:09 am
Look like
"loop" is taking Boolean instead of value.
Code: Select all
loop
If this is True, the tracks will loop while they are the last thing in the queue.
Instead, do this:
Code: Select all
if not renpy.music.get_playing(channel='music') == "out_and_about.ogg":
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action [Play("music", "<loop=1.777>out_and_about.ogg"), Jump("lbl_townmap_setup")
else:
imagebutton auto "gui mainmap%s" xpos 0 ypos 0 focus_mask True action Jump("lbl_townmap_setup")
Ah I see! Thank you for the suggestion and supplying a possible fix. I'll give it a try when I can and will post back at a later date.
-
Fealow
- Newbie
- Posts: 9
- Joined: Sat Sep 16, 2017 8:56 am
-
Contact:
#4
Post
by Fealow » Sun Sep 17, 2017 4:54 am
This seems to have done the job i think. thanks.
Edit: miss communication between myself and the coder.
Last edited by
Fealow on Sun Sep 17, 2017 8:53 am, edited 2 times in total.
-
Fealow
- Newbie
- Posts: 9
- Joined: Sat Sep 16, 2017 8:56 am
-
Contact:
#5
Post
by Fealow » Sun Sep 17, 2017 8:49 am
Caused a crash
Last edited by
Fealow on Sun Sep 17, 2017 9:22 am, edited 2 times in total.
-
Divona
- Miko-Class Veteran
- Posts: 678
- Joined: Sun Jun 05, 2016 8:29 pm
- Completed: The Falconers: Moonlight
- Organization: Bionic Penguin
- itch: bionicpenguin
-
Contact:
#6
Post
by Divona » Sun Sep 17, 2017 9:06 am
It works perfectly fine on a new project. Do check that it's not somewhere else that causing the problem. You could drop the traceback and a code here and I'll see what went wrong.
Completed:

-
Fealow
- Newbie
- Posts: 9
- Joined: Sat Sep 16, 2017 8:56 am
-
Contact:
#7
Post
by Fealow » Sun Sep 17, 2017 9:22 am
SOLVED
there was a stray = in the code that caused problems and we needed to put the loop in the if statement as well.
Thanks for your assistance!
Users browsing this forum: Google [Bot], Majestic-12 [Bot]