Changing confirm prompt messages?

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
pumpkin spike
Regular
Posts: 76
Joined: Fri Mar 09, 2018 6:13 pm
Projects: A Bureau of Monsters
itch: pumpkin-spike
Location: A Pumpkin Patch
Contact:

Changing confirm prompt messages?

#1 Post by pumpkin spike »

Hi, I'm having trouble changing the default confirm prompt messages? I used the syntax from here: https://www.renpy.org/doc/html/screen_s ... ml#confirm

and tried adding the following to both the GUI and script files:

Code: Select all

define gui.LOADING = "Loading will lose unsaved progress. Is this OK?"
define gui.MAIN_MENU = "Returning to the Main Menu will lose unsaved progress. Is this OK?"
I only need these two messages changed, by the way, cause they're too big in the font + size I want to use for my confirm screen. I didn't touch the other messages.

When I restart the game, they still use the default messages.

I've also tried using 'default' instead of 'define' to no avail. What am I doing wrong?
Image
WIP AllxAll game with turn based fighting (Demo 2.0 out!)

Image
WIP Yaoi game Demo 1.0 out! (haitus)

User avatar
XxrenxX
Veteran
Posts: 267
Joined: Tue Oct 02, 2012 2:40 am
Projects: Chasing
Deviantart: bara-ettie
Location: Canada
Contact:

Re: Changing confirm prompt messages?

#2 Post by XxrenxX »

Not sure what your'd doing wrong. My prompts are mostly text and text buttons so maybe this will help?

Code: Select all

    if message == layout.OVERWRITE_SAVE:
        text "{b}Overwrite Data?{/b}" #title (delete if not needed)
        text "Previous data will be lost." #subtext
        textbutton "Yes" action yes_action
        textbutton "No" action no_action
I think you would just add it into already existing code. Since it's an if statement it should override the previous if you are using the command indicated such as saving or loading. I use this code for all my messages as they all have different text so I haven't tested it with the original yes/no prompt code.

If you want to edit the text (idk how to edit textbutton without effecting all) you can create a style for them.

Code: Select all

    if message == layout.MAIN_MENU:
        text "{b}Return to Title?{/b}" xpos 450 ypos 218 style "ynp_title"

init python:
     style.ynp_title = Style(style.default)
     style.ynp_title.color = "#000"
     style.ynp_title.size = 33

pumpkin spike
Regular
Posts: 76
Joined: Fri Mar 09, 2018 6:13 pm
Projects: A Bureau of Monsters
itch: pumpkin-spike
Location: A Pumpkin Patch
Contact:

Re: Changing confirm prompt messages?

#3 Post by pumpkin spike »

Sadly, that didn't work for me... I ended up brute forcing it with conditionals ;w;"

Code: Select all

label _(message):
    if (message == "Loading will lose unsaved progress.\nAre you sure you want to do this?") or (message == "Are you sure you want to return to the main menu?\nThis will lose unsaved progress."): 
        style "confirm_prompta" 
    else: 
        style "confirm_prompt"
I just copy-pasted the confirm_prompt style and relabeled it as confirm_prompta, but I changed the size for the font.
I did try setting the message within that if to what I want, but I was getting errors.

If someone has a more elegant solution, please let me know, I'd love to try it ;w;
Image
WIP AllxAll game with turn based fighting (Demo 2.0 out!)

Image
WIP Yaoi game Demo 1.0 out! (haitus)

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]