Page 1 of 1

Navigation Problem

Posted: Sun Aug 10, 2014 11:47 am
by Kazhuto
I'm sorry for being stubborn. Feel free to move this topic or delete it. I just couldn't attract more intention in others forum. :) Seems like the "use navigation" didn't work well. I tried to used it but nothing display. ??????? ..I cant find more useful way to solve this other than keeps copying the codes :? . Here's my code

Code: Select all

# This file is in the public domain. Feel free to modify it as a basis
# for your own screens.

##############################################################################
# Say
#
# Screen that's used to display adv-mode dialogue.
# http://www.renpy.org/doc/html/screen_special.html#say
screen say:

    # Defaults for side_image and two_window
    default side_image = None
    default two_window = False

    # Decide if we want to use the one-window or two-window variant.
    if not two_window:

        # The one window variant.
        window:
            id "window"

            has vbox:
                style "say_vbox"

            if who:
                text who id "who"

            text what id "what"

    else:

        # The two window variant.
        vbox:
            style "say_two_window_vbox"

            if who:
                window:
                    style "say_who_window"

                    text who:
                        id "who"

            window:
                id "window"

                has vbox:
                    style "say_vbox"

                text what id "what"

    # If there's a side image, display it above the text.
    if side_image:
        add side_image
    else:
        add SideImage() xalign 0.0 yalign 1.0

    # Use the quick menu.
    use quick_menu


##############################################################################
# Choice
#
# Screen that's used to display in-game menus.
# http://www.renpy.org/doc/html/screen_special.html#choice

screen choice:

    window:
        style "menu_window"
        xalign 0.5
        yalign 0.5

        vbox:
            style "menu"
            spacing 2

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"

init -2:
    $ config.narrator_menu = True

    style menu_window is default

    style menu_choice is button_text:
        clear

    style menu_choice_button is button:
        xminimum int(config.screen_width * 0.75)
        xmaximum int(config.screen_width * 0.75)


##############################################################################
# Input
#
# Screen that's used to display renpy.input()
# http://www.renpy.org/doc/html/screen_special.html#input

screen input:

    window style "input_window":
        has vbox

        text prompt style "input_prompt"
        input id "input" style "input_text"

    use quick_menu

##############################################################################
# Nvl
#
# Screen used for nvl-mode dialogue and menus.
# http://www.renpy.org/doc/html/screen_special.html#nvl

screen nvl:

    window:
        style "nvl_window"

        has vbox:
            style "nvl_vbox"

        # Display dialogue.
        for who, what, who_id, what_id, window_id in dialogue:
            window:
                id window_id

                has hbox:
                    spacing 10

                if who is not None:
                    text who id who_id

                text what id what_id

        # Display a menu, if given.
        if items:

            vbox:
                id "menu"

                for caption, action, chosen in items:

                    if action:

                        button:
                            style "nvl_menu_choice_button"
                            action action

                            text caption style "nvl_menu_choice"

                    else:

                        text caption style "nvl_dialogue"

    add SideImage() xalign 0.0 yalign 1.0

    use quick_menu

##############################################################################
# Main Menu
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    tag menu
    add "gui/main_menu.png"
    imagebutton auto "gui/let_%s.png" xpos 400 ypos 200 focus_mask True action ShowMenu("lobby") at main_eff1
    imagebutton auto "gui/b4_%s.png" xpos 200 ypos 500 focus_mask True action ShowMenu("load") at main_eff2
    imagebutton auto "gui/b2_%s.png" xpos 400 ypos 500 focus_mask True action ShowMenu("preferences") at main_eff3
    imagebutton auto "gui/b3_%s.png" xpos 600 ypos 500 focus_mask True action ShowMenu ("help") at main_eff4
    imagebutton auto "gui/b1_%s.png" xpos 800 ypos 500 focus_mask True action Quit(confirm=False) at main_eff5

# main_menu effect
init -2:
    transform main_eff1:
        zoom 0.5
        easein 0.4 zoom 1.0
        
    transform main_eff2:
        zoom 0.5
        easein 0.8 zoom 1.0
        easeout 0.8
        
    transform main_eff3:
        zoom 0.5
        easein 1.2 zoom 1.0
        
    transform main_eff4:
        zoom 0.5
        easein 1.6 zoom 1.0
        
    transform main_eff5:
        zoom 0.5
        easein 2.0 zoom 1.0
# end of effect

screen lobby:

    add "gui/main_menu.png"
    imagebutton auto "gui/notes_%s.png" xpos 100 ypos 223 focus_mask True action ShowMenu("notes") 
    imagebutton auto "gui/quiz_%s.png" xpos 700 ypos 223 focus_mask True action Start()
    


##############################################################################
# Navigation
#
# Screen that's included in other screens to display the game menu
# navigation and background.
# http://www.renpy.org/doc/html/screen_special.html#navigation
screen navigation:

    # The background of the game menu.
    window:
        style "gm_root"

    # The various buttons.
    frame:
        style_group "gm_nav"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Return") action Return()
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Save Game") action ShowMenu("save")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Main Menu") action MainMenu()
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit()

init -2:

    # Make all game menu navigation buttons the same size.
    style gm_nav_button:
        size_group "gm_nav"


    
##############################################################################
# Save, Load
#
# Screens that allow the user to save and load the game.
# http://www.renpy.org/doc/html/screen_special.html#save
# http://www.renpy.org/doc/html/screen_special.html#load

# Since saving and loading are so similar, we combine them into
# a single screen, file_picker. We then use the file_picker screen
# from simple load and save screens.

screen file_picker:
    frame:
        style "file_picker_frame"

        has vbox

        # The buttons at the top allow the user to pick a
        # page of files.
        hbox:
            style_group "file_picker_nav"

            textbutton _("Previous"):
                action FilePagePrevious()

            textbutton _("Auto"):
                action FilePage("auto")

            textbutton _("Quick"):
                action FilePage("quick")

            for i in range(1, 9):
                textbutton str(i):
                    action FilePage(i)

            textbutton _("Next"):
                action FilePageNext()

        $ columns = 2
        $ rows = 5

        # Display a grid of file slots.
        grid columns rows:
            transpose True
            xfill True
            style_group "file_picker"

            # Display ten file slots, numbered 1 - 10.
            for i in range(1, columns * rows + 1):

                # Each file slot is a button.
                button:
                    action FileAction(i)
                    xfill True

                    has hbox

                    # Add the screenshot.
                    add FileScreenshot(i)

                    $ file_name = FileSlotName(i, columns * rows)
                    $ file_time = FileTime(i, empty=_("Empty Slot."))
                    $ save_name = FileSaveName(i)

                    text "[file_name]. [file_time!t]\n[save_name!t]"

                    key "save_delete" action FileDelete(i)


screen save:

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

    use navigation
    use file_picker
    
init -2 python: #we initialize x and y, so the load_save_slot screen below works at startup
    x=0
    y=0
screen load_save_slot:
    $ file_text = "% s\n  %s" % (FileTime(number, empty="Empty Slot."), FileSaveName(number))
    $x1=x+321
    $y1=y+10
    add FileScreenshot(number) xpos x1 ypos y1
    $x2=x+10
    $y2=y+11
    text file_text xpos x2 ypos y2 size 20
    
screen load:

    tag menu
    add "gui/load_%s.png" 
    # Navigation
    imagebutton auto "gui/let_%s.png" xpos 400 ypos 200 focus_mask True action ShowMenu("lobby") at main_eff1
    imagebutton auto "gui/b4_%s.png" xpos 200 ypos 500 focus_mask True action ShowMenu("load") at main_eff2
    imagebutton auto "gui/b2_%s.png" xpos 400 ypos 500 focus_mask True action ShowMenu("preferences") at main_eff3
    imagebutton auto "gui/b3_%s.png" xpos 600 ypos 500 focus_mask True action ShowMenu ("help") at main_eff4
    imagebutton auto "gui/b1_%s.png" xpos 800 ypos 500 focus_mask True action Quit(confirm=False) at main_eff5
    
    # Configuration
    imagebutton auto "gui/slot_%s.png" xpos 46 ypos 104 focus_mask True action FilePage(1)
    imagebutton auto "gui/slot2_%s.png" xpos 46 ypos 228 focus_mask True action FilePage(2)
    imagebutton auto "gui/slot3_%s.png" xpos 46 ypos 353 focus_mask True action FilePage(3)
    

    # This repeats the block below 3 times (counts from 0 to 2), for the 3 save slots. We could also copy/paste the block below 3 times, but we are too lazy to do that.
    imagebutton auto "gui/fileslot_%s.png" xpos 195 ypos 104 focus_mask True action FileAction(i)
    imagebutton auto "gui/fileslot_%s.png" xpos 195 ypos 128 focus_mask True action FileAction(i)
    imagebutton auto "gui/fileslot_%s.png" xpos 195 ypos 200 focus_mask True action FileAction(i)
    use load_save_slot(number=i, x=195, y=y) # This calls the load_save_slot screen defined above. We pass variable i as the slot number and x, y coordinates.


##############################################################################
# Preferences
#
# Screen that allows the user to change the preferences.
# http://www.renpy.org/doc/html/screen_special.html#prefereces

screen preferences:

    tag menu
    add "gui/config_bg.png"
    # Navigation
    imagebutton auto "gui/config_%s.png" xpos 1000 ypos 123 focus_mask True action ShowMenu("preferences") at nav_eff2
    imagebutton auto "gui/load_%s.png" xpos 123 ypos 223 focus_mask True action ShowMenu("load") at nav_eff
    imagebutton auto "gui/help_%s.png" xpos 123 ypos 323 focus_mask True action Help() at nav_eff
    imagebutton auto "gui/quit_%s.png" xpos 123 ypos 423 focus_mask True action Quit(confirm=True) at nav_eff
    imagebutton auto "gui/return_%s.png" xpos 100 ypos 610 focus_mask True action Return() at nav_eff2
    
    # Configuration

init -2:
    transform nav_eff:
        on idle:
            easein 0.5 xpos 1000
        on hover:
            easein 0.3 xpos 1000
            easein 0.3 xpos 990

    transform nav_eff2:
        on idle:
            easein 0.5 xpos 100
        on hover:
            easein 0.3 xpos 100
            easein 0.3 xpos 990


##############################################################################
# Yes/No Prompt
#
# Screen that asks the user a yes or no question.
# http://www.renpy.org/doc/html/screen_special.html#yesno-prompt

screen yesno_prompt:

    modal True

    window:
        style "gm_root"

    frame:
        style_group "yesno"

        xfill True
        xmargin .05
        ypos .1
        yanchor 0
        ypadding .05

        has vbox:
            xalign .5
            yalign .5
            spacing 30

        label _(message):
            xalign 0.5

        hbox:
            xalign 0.5
            spacing 100

            textbutton _("Yes") action yes_action
            textbutton _("No") action no_action

    # Right-click and escape answer "no".
    key "game_menu" action no_action

init -2:
    style yesno_button:
        size_group "yesno"

    style yesno_label_text:
        text_align 0.5
        layout "subtitle"


##############################################################################
# Quick Menu
#
# A screen that's included by the default say screen, and adds quick access to
# several useful functions.
screen quick_menu:

    # Add an in-game quick menu.
    hbox:
        style_group "quick"

        xalign 1.0
        yalign 1.0

        textbutton _("Back") action Rollback()
        textbutton _("Save") action ShowMenu('save')
        textbutton _("Q.Save") action QuickSave()
        textbutton _("Q.Load") action QuickLoad()
        textbutton _("Skip") action Skip()
        textbutton _("F.Skip") action Skip(fast=True, confirm=True)
        textbutton _("Auto") action Preference("auto-forward", "toggle")
        textbutton _("Prefs") action ShowMenu('preferences')

init -2:
    style quick_button:
        is default
        background None
        xpadding 5

    style quick_button_text:
        is default
        size 12
        idle_color "#8888"
        hover_color "#ccc"
        selected_idle_color "#cc08"
        selected_hover_color "#cc0"
        insensitive_color "#4448"


Re: Navigation Problem

Posted: Mon Aug 11, 2014 8:57 am
by fluxus
I take it that what you are asking about has something to do with the screen 'navigation' listed in the code above.
However, it is not very obvious if this is the case, since you copied the whole of screens.rpy into your post, and I think this will have confused a lot of folks - at least it confused me.

Also, you're not writing what the problem actually is?

Re: Navigation Problem

Posted: Mon Aug 11, 2014 12:37 pm
by Kazhuto
The problem is I can't use that freakin "use navigation" and actually nevermind, I found the solution on my own. I mean another solution other than copying. :) sorry for bothering