[SOLVED] Unskippable and Skippable video

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
User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

[SOLVED] Unskippable and Skippable video

#1 Post by Pierrou » Mon Sep 07, 2015 7:28 pm

Hello :)

I have some trouble with unskippable and skippable video.

I don't know what i can do :s

I wanted to read a movie, but if the movie has never been played it will be unskippable, else it will be skippable.

I tried so many thing but nothing works :s
I tried to add $ renpy.pause(30, hard=True) but the video will be unskippable every time...

Also, i have a media gallery with the musics and videos locked. If the player see them in game, they'll be unlocked. But when i try to play the video, she is unskippable... I don't know why, it's a little bit weird.

Code: Select all

screen medias:
    tag menu
    add "image/ui/media/sound_back.png"
    
#musiques de fond
    #colonne 1
    imagebutton auto "image/ui/media/sound_001_%s.png" xpos 108 ypos 104 focus_mask None action Play("music", "sound/sa01.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_002_%s.png" xpos 108 ypos 138 focus_mask None action Play("music", "sound/sa02.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_003_%s.png" xpos 108 ypos 172 focus_mask None action Play("music", "sound/sa03.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_004_%s.png" xpos 108 ypos 206 focus_mask None action Play("music", "sound/sa04.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_005_%s.png" xpos 108 ypos 240 focus_mask None action Play("music", "sound/sa05.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_006_%s.png" xpos 108 ypos 274 focus_mask None action Play("music", "sound/sa06.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_007_%s.png" xpos 108 ypos 308 focus_mask None action Play("music", "sound/sa07.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_008_%s.png" xpos 108 ypos 342 focus_mask None action Play("music", "sound/sa08.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_009_%s.png" xpos 108 ypos 376 focus_mask None action Play("music", "sound/sa09.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_010_%s.png" xpos 108 ypos 410 focus_mask None action Play("music", "sound/sb01.ogg", selected=True)
    #colonne 2
    imagebutton auto "image/ui/media/sound_011_%s.png" xpos 240 ypos 104 focus_mask None action Play("music", "sound/sb02.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_012_%s.png" xpos 240 ypos 138 focus_mask None action Play("music", "sound/sb03.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_013_%s.png" xpos 240 ypos 172 focus_mask None action Play("music", "sound/sb04.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_014_%s.png" xpos 240 ypos 206 focus_mask None action Play("music", "sound/sc01.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_015_%s.png" xpos 240 ypos 240 focus_mask None action Play("music", "sound/sc02.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_016_%s.png" xpos 240 ypos 274 focus_mask None action Play("music", "sound/sc03.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_017_%s.png" xpos 240 ypos 308 focus_mask None action Play("music", "sound/sc04.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_018_%s.png" xpos 240 ypos 342 focus_mask None action Play("music", "sound/sc05.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_019_%s.png" xpos 240 ypos 376 focus_mask None action Play("music", "sound/sc06.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_020_%s.png" xpos 240 ypos 410 focus_mask None action Play("music", "sound/sc07.ogg", selected=True)
#musiques
    imagebutton auto "image/ui/media/sound_021_%s.png" xpos 380 ypos 104 focus_mask None action Play("music", "sound/op_grind.ogg", selected=True)
    imagebutton auto "image/ui/media/sound_022_%s.png" xpos 380 ypos 138 focus_mask None action Play("music", "sound/ed_good.ogg", selected=True)
#vidéos
    imagebutton auto "image/ui/media/sound_025_%s.png" xpos 380 ypos 376 focus_mask None action [Stop("music"), Play("movie", "video/op.mpg")]
    imagebutton auto "image/ui/media/sound_026_%s.png" xpos 380 ypos 410 focus_mask None action [Stop("music"), Play("movie", "video/demo.mpg")]
    
#bouton Exit
    imagebutton auto "image/ui/media/exit_%s.png" xpos 482 ypos 536 focus_mask None action [Play("music", "sound/mainmenu.ogg"), ShowMenu('extra')]
This is the code for my medias gallery, i think i'll use something like $ persistent to making it unlockable. Now it's already unlocked ^^°

Can you help me please ? Thank you :D
Last edited by Pierrou on Sat Sep 19, 2015 6:44 pm, edited 1 time in total.
Sorry for my english, it's not my native language. :s

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Unskippable and Skippable video

#2 Post by Pierrou » Wed Sep 09, 2015 1:02 am

Any help ? :'(
Sorry for my english, it's not my native language. :s

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Unskippable and Skippable video

#3 Post by Alex » Fri Sep 11, 2015 6:33 pm

Well, in game along with the video you could show the screen that will disable "dismiss" action if player didn't saw the video yet (and don't forget to hide this screen after movie will end). Try

Code: Select all

screen unskip(t, condition):
    timer t action Hide("unskip")
    if not condition:
        key "dismiss" action [[]]

label start:
    "click"
    show screen unskip(t=30, condition=persistent.vid_1)
    $ renpy.movie_cutscene("My_video_30_sec_long.mpg")
    $ persistent.vid_1 = True
    "... and once again..."
    jump start
http://www.renpy.org/doc/html/keymap.html#keymap
http://www.renpy.org/doc/html/movie.html

As for gallery, try to show your movies with Replay action.
http://www.renpy.org/doc/html/rooms.html#replay

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Unskippable and Skippable video

#4 Post by Pierrou » Sat Sep 19, 2015 1:29 am

Thank you for this answer !

But the problem is that we're not in game. It's in the menu "extras". So i don't understand how to use this code with this screen.
Sorry for my english, it's not my native language. :s

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Unskippable and Skippable video

#5 Post by Alex » Sat Sep 19, 2015 4:15 am

Try to make it via Replay action.

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Unskippable and Skippable video

#6 Post by Pierrou » Sat Sep 19, 2015 5:56 am

We already use the Replay for some scenes. The problem that if Renpy find $ renpy.end_replay() it will stop the replay just after the movie and not for the end of the scene ;)

We tried to do this :

Code: Select all

screen medias:
    tag menu
    imagebutton auto "image/ui/media/sound_025_%s.png" xpos 380 ypos 376 focus_mask None action [Stop("music"), Start("play_demo")]
    imagebutton auto "image/ui/media/sound_026_%s.png" xpos 380 ypos 410 focus_mask None action [Stop("music"), Start("play_op")]


label play_demo:
    $ renpy.movie_cutscene("video/demo.mpg")
    return

label play_op:¶
    $ renpy.movie_cutscene("video/op.mpg")¶
    return
The movie is skippable (YEAH!) but it returns to the main menu :x How to return to the menu "medias" ?

I tried :

Code: Select all

label play_demo:
    $ renpy.movie_cutscene("video/demo.mpg")
    call screen medias
it works fine but if I want to load another movie (or play again the same) i've an error...
I'm sorry, but an uncaught exception occurred.

While running game code:
File "renpy/common/000statements.rpy", line 457, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "renpy/common/00action_menu.rpy", line 128, in __call__
renpy.jump_out_of_context(self.label)
JumpOutException: play_demo

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/bootstrap.py", line 281, in bootstrap
renpy.main.main()
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/main.py", line 466, in main
run(restart)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/main.py", line 142, in run
renpy.execution.run_context(True)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/execution.py", line 700, in run_context
context.run()
File "/home/nelker/script/medias.rpyc", line 40, in script
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/ast.py", line 1661, in execute
self.call("execute")
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/ast.py", line 1679, in call
renpy.statements.call(method, parsed, *args, **kwargs)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/statements.py", line 144, in call
return method(parsed, *args, **kwargs)
File "renpy/common/000statements.rpy", line 457, in execute_call_screen
store._return = renpy.call_screen(name, *args, **kwargs)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/exports.py", line 2349, in call_screen
rv = renpy.ui.interact(mouse="screen", type="screen", roll_forward=roll_forward)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/ui.py", line 277, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/core.py", line 2285, in interact
repeat, rv = self.interact_core(preloads=preloads, **kwargs)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/core.py", line 2921, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/screen.py", line 638, in event
rv = self.child.event(ev, x, y, st)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/layout.py", line 877, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/behavior.py", line 815, in event
return handle_click(self.clicked)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/behavior.py", line 758, in handle_click
rv = run(action)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/behavior.py", line 313, in run
new_rv = run(i, *args, **kwargs)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/display/behavior.py", line 320, in run
return var(*args, **kwargs)
File "renpy/common/00action_menu.rpy", line 128, in __call__
renpy.jump_out_of_context(self.label)
File "/home/nelker/.local/.gaymu/renpy-6.99.5-sdk/renpy/exports.py", line 1438, in jump_out_of_context
raise renpy.game.JumpOutException(label)
JumpOutException: play_demo

Linux-3.19.8-100.fc20.x86_64-x86_64-with-fedora-20-Heisenbug
Ren'Py 6.99.5.602
Togainu no Chi 1.0
What can i do ? :s
Sorry for my english, it's not my native language. :s

User avatar
Pierrou
Regular
Posts: 53
Joined: Fri Dec 05, 2014 8:25 pm
Projects: Togainu no Chi, DMMD, Omerta, ...
Skype: pierrouney
Location: France
Contact:

Re: Unskippable and Skippable video

#7 Post by Pierrou » Sat Sep 19, 2015 6:07 am

SOLVED ! by using Jump(<label>) instead of Start(<label>)

Code: Select all

screen medias:
    tag menu
    imagebutton auto "image/ui/media/sound_025_%s.png" xpos 380 ypos 376 focus_mask None action [Stop("music"), Jump("play_demo")]
    imagebutton auto "image/ui/media/sound_026_%s.png" xpos 380 ypos 410 focus_mask None action [Stop("music"), Jump("play_op")]


label play_demo:
    $ renpy.movie_cutscene("video/demo.mpg")
    return

label play_op:
    $ renpy.movie_cutscene("video/op.mpg")
    return
Thank you for your help ;) Now i'll add some if statement to unlock the button.
Sorry for my english, it's not my native language. :s

Post Reply

Who is online

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