Textbutton which plays a video, working not as intended.

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
4ft0n
Newbie
Posts: 2
Joined: Tue Jun 14, 2022 3:12 pm
Contact:

Textbutton which plays a video, working not as intended.

#1 Post by 4ft0n » Tue Jun 14, 2022 4:03 pm

Hello! I am working on a DDLC Mod and I wanted to add an "Endings" menu which contains many different endings in the mod. When clicked on these endings it plays a video related to the ending you clicked. I've done that but the problem is when the video ends, instead of it returning to the Endings menu, it goes to the beginning of the game. Here is the code:

Code: Select all

screen endings():
	  
    tag menu

    use game_menu(_("Endings"), scroll="viewport"):
  
     vbox:
         xoffset 50
        
     hbox:
         box_wrap False
         vbox:
             style_prefix "navigation"
             if persistent.dn == True:
                  textbutton ("Ending 1: Ouchie") action Function(renpy.invoke_in_new_context, renpy.movie_cutscene,filename="mod_assets/Videos/TBC.ogv")

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

Re: Textbutton which plays a video, working not as intended.

#2 Post by Imperf3kt » Tue Jun 14, 2022 8:55 pm

Call a label. Inside the label, play the video, then return.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

4ft0n
Newbie
Posts: 2
Joined: Tue Jun 14, 2022 3:12 pm
Contact:

Re: Textbutton which plays a video, working not as intended.

#3 Post by 4ft0n » Wed Jun 15, 2022 7:42 am

Imperf3kt wrote:
Tue Jun 14, 2022 8:55 pm
Call a label. Inside the label, play the video, then return.
Thanks a lot, it worked, but instead of writing return after the play movie command. I used the call screen command to get to the endings screen. That seemed to have fixed the problem

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

Re: Textbutton which plays a video, working not as intended.

#4 Post by Imperf3kt » Fri Jun 17, 2022 2:25 am

The issue there is you have increased the stack depth without popping the stack which may have unintended consequences.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor
Free Android GUI - Updated occasionally
Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], minyan