Page 1 of 2

Customizing the Options Screen

Posted: Thu Dec 19, 2013 3:22 am
by Harrison Barton
Hey, I'm by no means a super talented programmer and was wondering if I could get a few pointers on how to implement a specific feature.

I'd like for when the game is 'paused' for their to be an overlay that has the necessary features of the options menu but in a more easy-to-look at way.

Basically when escape is pressed, it brings up this menu over the current in-game frame instead of going to a separate options screen. The actual menu would probably be an image map of some kind.

Here's kind of a mock-up for what it might look like:
Image

Thanks for any help or advice you guys might have. =)

-Harrison

Re: Customizing the Options Screen

Posted: Wed Jan 01, 2014 2:45 pm
by Josteinn
Maybe include the transparent layer in the BG of the menu? Add it to the base/idle BG under the black part. It'll cover the whole screen, so you might have to adjust any measurements for the hotspots of the imagemap if you've already done that. ^u^

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 3:41 pm
by Crazy Li
I also wanted to know how to do this exactly. There's a problem with the suggestion below though...
Josteinn wrote:Maybe include the transparent layer in the BG of the menu? Add it to the base/idle BG under the black part. It'll cover the whole screen, so you might have to adjust any measurements for the hotspots of the imagemap if you've already done that. ^u^
While this DOES accomplish the task in game (I would recommend NOT using a fully transparent image, but rather a solid color with partial transparency to get that dimming effect), if you go to the options menu from the main menu, it still transitions away from it, showing the checkerboard "I don't have an image" thingy. What I assume the OP wants (and what I want) is for Ren'Py to NOT leave the previous screen. Giving Game Menu a transparent BG will still make it shift to that screen for the menu which will not allow you to see the title screen of the main menu below the options. Just seeing that checkerboard looks extremely amateurish.

The real solution would be to stop it from trying to go to a different screen and instead just make the menu sort of pop up over whatever screen was there before. The question is how to do this.

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 4:19 pm
by SundownKid
To make the menu appear OVER the bottom screen you must remove the "tag menu" from all the menu screens. Tagging a screen means they effectively function as the same screen and replace each other. Then add "modal True" in their place to make sure they don't interfere with the buttons below.

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 5:01 pm
by Crazy Li
SundownKid wrote:To make the menu appear OVER the bottom screen you must remove the "tag menu" from all the menu screens. Tagging a screen means they effectively function as the same screen and replace each other. Then add "modal True" in their place to make sure they don't interfere with the buttons below.
Well that half-worked...

If I open it on the Main Menu, it does indeed open over so I can see the screen below. The Modal True thing didn't seem to work though because I couldn't click any of the buttons.

When I tried open it in-game, it just errored.
I'm sorry, but an uncaught exception occurred.

While running game code:
File "renpy/common/00gamemenu.rpy", line 145, in script
File "renpy/common/00gamemenu.rpy", line 145, in python
IgnoreLayers:

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

Full traceback:
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\execution.py", line 288, in run
node.execute()
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\ast.py", line 720, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\python.py", line 1308, in py_exec_bytecode
exec bytecode in globals, locals
File "renpy/common/00gamemenu.rpy", line 145, in <module>
$ ui.interact()
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\ui.py", line 237, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\core.py", line 1853, in interact
repeat, rv = self.interact_core(preloads=preloads, **kwargs)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\core.py", line 2406, in interact_core
rv = root_widget.event(ev, x, y, 0)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\layout.py", line 749, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\layout.py", line 749, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\layout.py", line 749, in event
rv = i.event(ev, x - xo, y - yo, cst)
File "G:\other stuff\Ren'Py\renpy-6.16.5-sdk\renpy\display\screen.py", line 327, in event
raise renpy.display.layout.IgnoreLayers()
IgnoreLayers:

Windows-Vista-6.0.6002-SP2
Ren'Py 6.16.5.525
EDIT: For further elaboration, taking out the tag Menu and replacing it with modal True (or even if I don't add in that last bit... doesn't really seem to make a difference) causes the "Return" and "Preferences" buttons to no longer work while in the Preferences menu. Click those just register as hitting the Sound Test button instead (which is nowhere near them, mind you). "Load Game" will bring up the Load screen correctly and "Quit" will exit the game with prompt as it should. It's just the first two buttons that don't work (meaning, it's impossible to leave the menus). And of course the error message above when trying to access any menu in-game.

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 9:40 pm
by OokamiKasumi
In my Story Generator, I made a bookmark type Navigation screen. Is this something like what you're trying to do?

During game:
-- On Hover, the Bookmark extends a bit and the text changes to: "Save this story?"
StoryGen_07.jpg
Preferences & Save/Load screens:

Navigation Closed:
StoryGen_10.jpg
Navigation Open:
StoryGen_09.jpg

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 9:51 pm
by Crazy Li
OokamiKasumi wrote:In my Story Generator, I made a bookmark type Navigation screen. Is this something like what you're trying to do?
Doesn't look like it? But it's hard to tell from those screenshots.

If this is what it looks like in-game:
1.jpg
before
Then this will be what happens when you go to a menu:
2.jpg
after
This was accomplished by setting gm_root to an image file that was 50% transparent.

By removing the menu tag from the Main Menu, it also will overlay on the title screen. This does cause some bugs though. For one, if I click the X in the upper-right corner to exit, it will give an error message every time. Using the built-in Quit button works fine though.

There's also some weird issues concerning the overlap of the Main Menu and the Navigation Menu. If I could disable Navigation when calling a menu before the game actually starts, this would at least solve that problem (in my opinion, Navigation is kinda pointless at the start).

I'd also accept if there was another way to accomplish this without having to trick the game in this manner... like creating Menus that are legitimately things that pop up over what you had and don't take up the full screen. But that might be more work than the slight tweaking I need to go from where I am now to something that works.

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 10:36 pm
by OokamiKasumi
Crazy Li wrote:...This was accomplished by setting gm_root to an image file that was 50% transparent.

By removing the menu tag from the Main Menu, it also will overlay on the title screen. This does cause some bugs though. For one, if I click the X in the upper-right corner to exit, it will give an error message every time. Using the built-in Quit button works fine though. There's also some weird issues concerning the overlap of the Main Menu and the Navigation Menu.
That's because without the Tag Menu on the Main Menu screen, the program becomes confused over what menu should take top precedence.
If I could disable Navigation when calling a menu before the game actually starts, this would at least solve that problem (in my opinion, Navigation is kinda pointless at the start).
Navigation isn't pointless at the start. You can use it to go to the Save screen to Continue a game, instead of starting a new game, or an About page, or a Gallery, or a Bonus page, or a Music page. You can add a whole host of links to Navigation to look at before you enter the game itself. As an example, I prefer to go to Preferences and lower the volume of the music before I start a game.

Sure you can link all those to the main menu, but if I want to see more than one page, it's annoying to have to keep going back to the Main Menu instead of just using Navigation to go straight from one page to the next.
I'd also accept if there was another way to accomplish this without having to trick the game in this manner... like creating Menus that are legitimately things that pop up over what you had and don't take up the full screen. But that might be more work than the slight tweaking I need to go from where I am now to something that works.
This is why I showed you the bookmark. It doesn't cover the whole page, only a tiny portion of it, and it is a whole separate screen specifically for jumping straight to the Save page.

Re: Customizing the Options Screen

Posted: Fri Jan 03, 2014 10:58 pm
by Crazy Li
OokamiKasumi wrote:That's because without the Tag Menu on the Main Menu screen, the program becomes confused over what menu should take top precedence.
Figures. But I didn't know what else to do. SundownKid told me to take tag menu off of ALL of my menus which completely broke everything. Just removing it from the Main allowed it to mostly work. What's the proper way to do things?
Navigation isn't pointless at the start. You can use it to go to the Save screen to Continue a game, instead of starting a new game, or an About page, or a Gallery, or a Bonus page, or a Music page. You can add a whole host of links to Navigation to look at before you enter the game itself. As an example, I prefer to go to Preferences and lower the volume of the music before I start a game.

Sure you can link all those to the main menu, but if I want to see more than one page, it's annoying to have to keep going back to the Main Menu instead of just using Navigation to go straight from one page to the next.
Um... why would you need to Save -> Continue if Load Game is available from the Main Menu? That seems a bit silly. If you want to continue, just Load. You don't need the Navigation menu to achieve this. As far as Preferences, that too is on the Main menu by default.

The way my game currently functions, the main menu options are useable even when a different menu is open over top of it. Granted, this is probably because the game is broken right now, but I'm just going with the way the thing works at the moment. If there's a better way to do things, I can just do that and the Nav menu doesn't need to be disabled there. This is just for Main not being a real menu.
This is why I showed you the bookmark. It doesn't cover the whole page, only a tiny portion of it, and it is a whole separate screen specifically for jumping straight to the Save page.
It was just a little unclear. I didn't know if it left whatever screen it was on to open up a new screen or not. I couldn't tell from your screenshots what it was really doing. For all I knew, the rest of the image was the BG for the game menu.

All I want is for the menu to not obscure things below it. The menu items themselves pop up, but no background is laid behind it or anything. And I want it so this functions on the Main Menu as well, so I can still see the mm_root image in the background if I go to "Load Game" or "Preferences" from the Main Menu. Does that make sense?

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 12:06 am
by SundownKid
The answer to your problem is to put a Return button on all your hovering screens to Hide that specific screen. Therefore you cannot open more than one screen on top of the other before closing that screen.

You can also just remove tag menu from the "say" screen and main menu, which will make the other menus replace each other but pop over those screens specifically.

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 12:10 am
by Crazy Li
SundownKid wrote:The answer to your problem is to put a Return button on all your hovering screens to Hide that specific screen. Therefore you cannot open more than one screen on top of the other before closing that screen.
But... the Navigation Menu has a Return button by default. This button doesn't work when there's no menu tag for the previous screen, though.

Basically if I'm at the Main Menu and that's not tag menu, I click Preferences. Preferences pops up fine, but if I click Return, it does nothing. I don't think the game knows what to return to.

I think the actual answer to my problem is to enable the Main Menu button before the start of the game. I notice that by default, it's disabled unless you're actually in the game. If I could enable this, the player could click that button to return to the Main Menu at least since Return is broken.

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 12:27 am
by OokamiKasumi
Crazy Li wrote:
OokamiKasumi wrote:That's because without the Tag Menu on the Main Menu screen, the program becomes confused over what menu should take top precedence.
Figures. But I didn't know what else to do. SundownKid told me to take tag menu off of ALL of my menus which completely broke everything.
This is why I am very careful about Testing my advice and giving Clear instructions before handing it out.
Just removing it from the Main allowed it to mostly work. What's the proper way to do things?
The proper way to do it is put the 'tag menu' back. PyTom put it there so the menus wouldn't interfere with each other.
Um... why would you need to Save -> Continue if Load Game is available from the Main Menu? That seems a bit silly. If you want to continue, just Load. You don't need the Navigation menu to achieve this.
You need the navigation menu to RETURN from there, or any other page you happen to be visiting. Also, it's a pain in the butt to jump back to the Main Menu every time I want to go somewhere else, such as from Preferences to Load. In addition, going to the main menu automatically knocks you out of the game. It's built in to the code.
The way my game currently functions, the main menu options are usable even when a different menu is open over top of it. Granted, this is probably because the game is broken right now, but I'm just going with the way the thing works at the moment. If there's a better way to do things, I can just do that and the Nav menu doesn't need to be disabled there. This is just for Main not being a real menu.
The main menu is only a Start menu. The actual menu for getting around is the Navigation menu.
This is why I showed you the bookmark. It doesn't cover the whole page, only a tiny portion of it, and it is a whole separate screen specifically for jumping straight to the Save page.
It was just a little unclear. I didn't know if it left whatever screen it was on to open up a new screen or not. I couldn't tell from your screenshots what it was really doing. For all I knew, the rest of the image was the BG for the game menu.
LOL! If you had gone to the game's page --by clicking the link I provided-- you would have seen the game menu for yourself. (It looks Nothing like that.) You could have also downloaded the game --at the link I provided-- and looked at what it did. There is a PG13 version of it available.
All I want is for the menu to not obscure things below it. The menu items themselves pop up, but no background is laid behind it or anything. And I want it so this functions on the Main Menu as well, so I can still see the mm_root image in the background if I go to "Load Game" or "Preferences" from the Main Menu. Does that make sense?
Ah... I see the problem.
-- Using a transparent background works fine when you're in-game...

During game:
ss01.jpg
Preferences during game:
ss02.jpg
But if you go there straight from the main menu--

Main Menu:
ss00.jpg
--you get this:
ss03.jpg
If you just want the main menu background Image and NOT the menu, you can use a flag and an 'if' statement to make the background transparent During the game, and when Not during the game, use the main menu background Image.

Code: Select all

init:      
    image bg_main = "bg/bg_main.jpg"
    $ clear = False
Then after Start:

Code: Select all

label start:
    $ clear = True
Then in your screens.rpy use an 'if not' statement to decide when to make the background transparent:

Code: Select all

################################ 
screen save:
    tag menu
    if not clear:
            window:
                style "mm_root"
    use navigation
    use file_picker

screen load:
    tag menu
    if not clear:
            window:
                style "mm_root"
    use navigation
    use file_picker

Code: Select all

screen preferences:
    tag menu
    if not clear:
            window:
                style "mm_root"
    use navigation
This way, when you go to Preferences, Save or Load from the main menu, you get this:
ss04.jpg
During the game, however, you get this:
ss02.jpg
Is this what you want?

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 12:37 am
by SundownKid
Crazy Li wrote:
SundownKid wrote:The answer to your problem is to put a Return button on all your hovering screens to Hide that specific screen. Therefore you cannot open more than one screen on top of the other before closing that screen.
But... the Navigation Menu has a Return button by default. This button doesn't work when there's no menu tag for the previous screen, though.

Basically if I'm at the Main Menu and that's not tag menu, I click Preferences. Preferences pops up fine, but if I click Return, it does nothing. I don't think the game knows what to return to.

I think the actual answer to my problem is to enable the Main Menu button before the start of the game. I notice that by default, it's disabled unless you're actually in the game. If I could enable this, the player could click that button to return to the Main Menu at least since Return is broken.
You would have to rewrite the action for the return button to hide the screen rather than use Return().

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 1:14 am
by Crazy Li
OokamiKasumi wrote:...
Nope, that didn't work. I tried putting in the code you said as you said, but this doesn't hide the background in game for me. Is it maybe where I put the $ clear = False statement? You never really said what file to put it in or where.
SundownKid wrote:You would have to rewrite the action for the return button to hide the screen rather than use Return().
And how would I do that?

Re: Customizing the Options Screen

Posted: Sat Jan 04, 2014 1:17 am
by SundownKid
Well... first tag every screen you want to hide as something, whether it be menu or whatever else you want to tag them as. Just make sure the ones on top are tagged differently than the ones on the bottom.

Then rejigger the button so it's something like this:

Code: Select all

textbutton "Return" action Hide("menuscreen")
With "menuscreen" being what the screens you want to hide are tagged as.