Entire scene playing twice instead of once

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
Nicckonator
Regular
Posts: 35
Joined: Tue May 08, 2018 12:07 pm
Projects: Ochiba - Falling Leaves
Deviantart: Nicckonator
Contact:

Entire scene playing twice instead of once

#1 Post by Nicckonator »

Problems get fixed and problems arise :D

for some reason this simple example of a script loops? it plays twice instead of immediately returning to the main menu after playing only once as scripted. :oops: :P

Tried it with multiple scenes and then it just plays all scenes twice lol.

Code: Select all

label start:

    #

    ## Start Script

    play music "Airguitar.mp3"

    scene bg room with fade

    show eileen happy

    e "Air Guitar is a wonderful song!"

    e "You should listen to it all day long."

    stop music

    return
GD - Game Developer, and owner of NK Productions,
the company currently making Ochiba - Falling Leaves (Visual Novel).

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

Re: Entire scene playing twice instead of once

#2 Post by Alex »

And what about the "start" button in main menu and splashscreen as well?

User avatar
Nicckonator
Regular
Posts: 35
Joined: Tue May 08, 2018 12:07 pm
Projects: Ochiba - Falling Leaves
Deviantart: Nicckonator
Contact:

Re: Entire scene playing twice instead of once

#3 Post by Nicckonator »

Those work perfectly fine but if your asking for the way i have it coded it would be the following:

Code: Select all

# The script of the game goes in this file.

# Declare characters used by this game. The color argument colorizes the
# name of the character.

define e = Character("Eileen")


# The game starts here.

label splashscreen:

    scene black

    $ renpy.movie_cutscene('KKintro.webm')

    return


label start:

    #

    ## Start Script

    play music "Airguitar.mp3"

    scene bg room with fade

    show eileen happy

    e "Air Guitar is a wonderful song!"

    e "You should listen to it all day long."

    stop music

    return
That's it that's the entire script code for now since it won't stop playing twice instead of once i havent added anything else yet.
GD - Game Developer, and owner of NK Productions,
the company currently making Ochiba - Falling Leaves (Visual Novel).

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

Re: Entire scene playing twice instead of once

#4 Post by Alex »

Yes, did you change the main menu code? Try to create the new project and copy/paste your code into it.

User avatar
Nicckonator
Regular
Posts: 35
Joined: Tue May 08, 2018 12:07 pm
Projects: Ochiba - Falling Leaves
Deviantart: Nicckonator
Contact:

Re: Entire scene playing twice instead of once

#5 Post by Nicckonator »

All i changed about the main menu is the background(.avi), music, and gui buttons of which i deleted the original and replaced it with my own imagemap+hotspots,

code would be this just in case you want to know:

Code: Select all

## Main and Game Menu Screens
################################################################################

## Navigation screen ###########################################################
##
## This screen is included in the main and game menus, and provides navigation
## to other menus, and to start the game.

screen navigation():

    imagemap:

        idle "main_menu.png"
        hover "main_menu_blue.png"
        ground "main_menu_grey.png"

        hotspot (569,934,126,65) action ShowMenu('start')
        hotspot (719,934,109,65) action ShowMenu('load')
        hotspot (855,934,172,89) action ShowMenu('preferences')
        hotspot (1050,934,171,76) action ShowMenu('about')
        hotspot (1238,934,118,73) action Quit('quit')


style navigation_button is gui_button
style navigation_button_text is gui_button_text

style navigation_button:
    size_group "navigation"
    properties gui.button_properties("navigation_button")

style navigation_button_text:
    properties gui.button_text_properties("navigation_button")

Code: Select all

## Main Menu screen ############################################################
##
## Used to display the main menu when Ren'Py starts.
##
## https://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu():

    ## This ensures that any other menu screen is replaced.
    tag menu


    add Movie(size=(1920, 1080))
    on "show" action Play("movie", "movies/mainbg.avi", loop=True)
    on "hide" action Stop("movie")
    on "replace" action Play("movie", "movies/mainbg.avi", loop=True)
    on "replaced" action Stop("movie")

    style_prefix "main_menu"

    ## This empty frame darkens the main menu.
    frame:
        pass

    ## The use statement includes another screen inside this one. The actual
    ## contents of the main menu are in the navigation screen.
    use navigation

    if gui.show_name:

        vbox:
            text "[config.name!t]":
                style "main_menu_title"

            text "[config.version]":
                style "main_menu_version"


style main_menu_frame is empty
style main_menu_vbox is vbox
style main_menu_text is gui_text
style main_menu_title is main_menu_text
style main_menu_version is main_menu_text

style main_menu_frame:
    xsize 420
    yfill True

    background "gui/overlay/main_menu.png"

style main_menu_vbox:
    xalign 1.0
    xoffset -30
    xmaximum 1200
    yalign 1.0
    yoffset -30

style main_menu_text:
    properties gui.text_properties("main_menu", accent=True)

style main_menu_title:
    properties gui.text_properties("title")

style main_menu_version:
    properties gui.text_properties("version")
pretty standard and it worked perfectly until i started editing the .script file by writing that simple scene^ before i did that it only played once and i havent touched the main menu coding since before i ever even edited the .script, worked fine up till then.

New project with same code = same results sadly.
GD - Game Developer, and owner of NK Productions,
the company currently making Ochiba - Falling Leaves (Visual Novel).

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

Re: Entire scene playing twice instead of once

#6 Post by Alex »

Code: Select all

hotspot (569,934,126,65) action ShowMenu('start')
This action is definitely wrong - check the original screens.rpy code (there's Start action to start the game - https://www.renpy.org/doc/html/screen_a ... html#Start)

User avatar
Nicckonator
Regular
Posts: 35
Joined: Tue May 08, 2018 12:07 pm
Projects: Ochiba - Falling Leaves
Deviantart: Nicckonator
Contact:

Re: Entire scene playing twice instead of once

#7 Post by Nicckonator »

I had to code that in because im using a .avi movie as my main menu background with custom gui buttons + designated hotspots, everything was working fine along with that line of code^ right up until i edited the script file, if i revert the script file to default script everything works again, so i don't know what the problem is since all i did was remove the unnessecary # explanation lines.
GD - Game Developer, and owner of NK Productions,
the company currently making Ochiba - Falling Leaves (Visual Novel).

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Entire scene playing twice instead of once

#8 Post by kivik »

I think Alex is saying you need to use:

Code: Select all

hotspot (569,934,126,65) action Start()
I'm not familiar with the menu screen's actions, but from your description it sounds like ShowMenu('start') called the game to show your start label, then start the game (which triggers the start label). Whilst Start() will just jump to your start label.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Entire scene playing twice instead of once

#9 Post by Ocelot »

Why it is so hard to do that? Is 'start' a screen? THen you have a huge problem: you have same name for screen and label. It is bad.

If not, you are showing label as a screen, which makes no sense. In addition, what is hard in replacing ShowMenu('start') with Start()?
< < insert Rick Cook quote here > >

User avatar
Nicckonator
Regular
Posts: 35
Joined: Tue May 08, 2018 12:07 pm
Projects: Ochiba - Falling Leaves
Deviantart: Nicckonator
Contact:

Re: Entire scene playing twice instead of once

#10 Post by Nicckonator »

kivik wrote: Sat May 12, 2018 5:31 am I think Alex is saying you need to use:

Code: Select all

hotspot (569,934,126,65) action Start()
I'm not familiar with the menu screen's actions, but from your description it sounds like ShowMenu('start') called the game to show your start label, then start the game (which triggers the start label). Whilst Start() will just jump to your start label.
Perfect, thankyou :D can't believe i miswrote that xD
GD - Game Developer, and owner of NK Productions,
the company currently making Ochiba - Falling Leaves (Visual Novel).

Post Reply

Who is online

Users browsing this forum: barsunduk, Google [Bot]