[Solved]Yes/No Prompt Customization

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
mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

[Solved]Yes/No Prompt Customization

#1 Post by mjshi »

Two questions about the yes/no prompt's customization--

1) Is it possible to add a gutter/buffer for the _message?
I'm getting something like-
Screenshot_1.png
which, frankly, doesn't look nice.

2) Is it possible to add a black background to the "Are you sure that you want to quit?" screen, but only when the screen doesn't appear on top of any other screens/layer over them?
Honestly, looking at a checkerboard of grey squares--
Screenshot_3.png
isn't very interesting either.

Thanks in advance!
Last edited by mjshi on Sat Jan 10, 2015 1:28 pm, edited 1 time in total.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Yes/No Prompt Customization

#2 Post by SundownKid »

First - yes, you will have to make the text have an xmaximum.

Second - that is not necessary. There is a way to make the yes/no prompt not have to erase the menu, as long as you remove "tag menu" (meaning it goes on top of the menu instead of replacing it) and add "modal True" (meaning you cannot press underlying buttons while it's active) it should work.

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Yes/No Prompt Customization

#3 Post by mjshi »

First- thank you!

Second- Yes, this is the code I have, but whenever you click the windows x button it still replaces the currently occurring things--

Code: Select all

screen yesno_prompt(message, yes_action, no_action):

  modal True
  
  imagemap:
    xalign 0.5
    yalign 0.45
    auto "yesno_%s.png"
      
    hotspot (98, 145, 58, 36) action yes_action
    hotspot (277, 143, 51, 32) action no_action
    
  label _(message):
    text_style "yesno_label_text"
    xalign 0.5
    yalign 0.45
    # I'll add an xmaximum after dealing with the second problem.

init -2 python:    
  style.yesno_button.size_group = "yesno"
  style.yesno_label_text.text_align = 0.5
  style.yesno_label_text.color = "#000"
and I'll attach the images--
yesno_hover.png
yesno_ground.png
Cases where the yes/no replaces whatever is below it--
- pressing the x button on the main menu
- pressing the x button ingame
- pressing the x button in any of the navigation's menus (save, load, prefs)

Cases where the yes/no doesn't replace whatever is below it--
- overwriting a save
- loading a save
- returning to the main menu
- clicking the quit button in game navigation-
- clicking the quit button in the main menu (when confirm is not set to false)

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Yes/No Prompt Customization

#4 Post by xela »

Code: Select all

init python:
    config.quit_action = Quit()
Fixes the second issue.
Like what we're doing? Support us at:
Image

mjshi
Regular
Posts: 179
Joined: Wed Mar 13, 2013 9:55 pm
Completed: MazeSite01, Ponderings of Time
Contact:

Re: Yes/No Prompt Customization

#5 Post by mjshi »

I have no idea what you just did, but thank you xD

--Marked as solved.

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Yes/No Prompt Customization

#6 Post by nyaatrap »

xela wrote:

Code: Select all

init python:
    config.quit_action = Quit()
Fixes the second issue.
I wonder why this isn't ren'py default behavior. Is there any side-effect, or just for compatibility reason?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: [Solved]Yes/No Prompt Customization

#7 Post by xela »

Only PyTom can tell... due to compatibility reasons, quitting logic is an intertwined mess of labels, functions and wrappers or at least it's what it looks like to me. I joined the Ren'Py world after SL was introduced so I have no idea how ui interface behaved in these cases in the past.

I do not however believe that there can be a sideeffect to this when used in modern Ren'Py as it still saves the game if setup to do so and quits the game. It's not like we require this class to do anything else :D
Like what we're doing? Support us at:
Image

User avatar
Donmai
Eileen-Class Veteran
Posts: 1962
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: [Solved]Yes/No Prompt Customization

#8 Post by Donmai »

mjshi wrote:Honestly, looking at a checkerboard of grey squares--
I see many people disliking the 'grey squares', for some reason. Maybe because few of them seem to notice that the checkerboard background is only visible while

Code: Select all

config.developer = True
If you make it False, then the checkerboard is gone and the background will be a solid color when you run the game.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Post Reply

Who is online

Users browsing this forum: No registered users