GUI Coding- Skips Main Menu, No Exception Error Given

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
quiltedcorgi
Newbie
Posts: 20
Joined: Fri Sep 18, 2015 11:51 am
Projects: Sheltered
Organization: Dwarf Dog Media
Location: Midwest USA
Contact:

GUI Coding- Skips Main Menu, No Exception Error Given

#1 Post by quiltedcorgi »

I am having all sorts of problems getting my GUI to work. I was using the Imagebutton GUI Sample as a basis for my codes. As this is my first time doing anything in Ren'Py/Python, I just can't tell what all I'm doing wrong, and I'm not able to find people making similar/the same problems when I use the search function on this forum. It was suggested by PyTom to post my code somewhere so more experienced eyes can take a look and decipher what's happening.

Right now, my biggest issues seem to be it's jumping straight to game play. Main menu does not show up at all.

As far as the game is concerned, these things are not an error, so it does not show an exception report. I'm not sure what line is causing this. I originally posted this will ALL the code because I assumed the errors would be somewhere I wouldn't expect, but I realized having 200+ lines of code to look at would be daunting and probably not helpful to anyone who might be able to help me. I reduced what was here to what's (probably) relevant. If this is not enough, please let me know. Because it's going straight to gameplay, I assume this means the indicator of where everything should "START" is wrong, but how/where do I tell the computer that? I have the main menu marked appropriately (I think).

Code: Select all

##Sheltered GUI
##Created using Imagebutton GUI Sample as a basis
#########################################
# Note: comments like #begin foo and #end foo at the start of lines are used to display code examples. See example.rpy for more details.

## Main Menu 
## Screen that's used to display the main menu, when Ren'Py first starts

screen main_menu:
    tag menu # This ensures that any other menu screen is replaced.
    add "gui/main_menu_ground.png" # Add a background image for the main menu.
    $ x=0 # To make things easier, we define a variable y and use it to set positions for our imagebuttons
    
    imagebutton auto "gui/start_%s.png" xpos x ypos 23 focus_mask True action Start() selected_hover [ Play ("sfx/bite_crunch.wav")]  
    imagebutton auto "gui/start_%s.png" xpos x ypos 23 focus_mask True action Start() selected_idle [ Play ("sfx/bite_crunch.wav")]  
    
    # We increase y position for the next menu item. y has a value of 185(114+81=185) now. We could also use: xpos 773 ypos 185
    
    imagebutton auto "gui/load_%s.png" xpos x ypos 198 focus_mask True  action ShowMenu('load') selected_hover [ Play ("sfx/bite_crunch.wav")]
    imagebutton auto "gui/options_%s.png" xpos x ypos 529 focus_mask True action ShowMenu('preferences') selected_hover [ Play ("sfx/bite_crunch.wav")]
    imagebutton auto "gui/extras_%s.png" xpos x ypos 360 focus_mask True action Start('extras') selected_hover [ Play ("sfx/bite_crunch.wav")]
    imagebutton auto "gui/mm_quit_%s.png" xpos 832 ypos 575 focus_mask True action Quit(confirm=False) 

## NAVIGATION 
## This screen is responsible for the game menu/navigation. It's included in other screens to display the game menu navigation.
## http://www.renpy.org/doc/html/screen_special.html#navigation

label navigation:

screen navigation:
    imagebutton auto "gui/save_%s.png" xpos x ypos 0 focus_mask True  action ShowMenu('save') hovered [ Play ("test_one", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/load_%s.png" xpos x ypos 154 focus_mask True  action ShowMenu('load') hovered [ Play ("test_two", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/extras_%s.png" xpos x ypos 306 focus_mask True action Start('extras') selected_hover [ Play ("test_three", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/extras_%s.png" xpos x ypos 306 focus_mask True action Start('extras') selected_idle [ Play ("test_three", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/options_%s.png" xpos x ypos 460 focus_mask True action ShowMenu('options') hovered [ Play ("test_one", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/return_%s.png" xpos x ypos 609 focus_mask True action Start('return') selected_hover [ Play ("test_two", "sfx/bite_crunch.wav")]
    imagebutton auto "gui/return_%s.png" xpos x ypos 609 focus_mask True action Start('return') selected_idle [ Play ("test_two", "sfx/bite_crunch.wav")]
I can also post photos of how I'd like the gui to look/act, but I'm not sure that's helpful.
I can also post code of the options.rpy or script.rpy if needed.

User avatar
orz
Regular
Posts: 126
Joined: Tue Apr 21, 2015 10:19 pm
Contact:

Re: GUI Coding- Skips Main Menu, No Exception Error Given

#2 Post by orz »

Try changing "screen main_menu:" to "screen main_menu():"

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Semrush [Bot]