Adding text strings between quick menu buttons?

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
017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Adding text strings between quick menu buttons?

#1 Post by 017Bluefield »

I'm trying to create a "separated by pipe symbols" effect for the quick menu buttons. Obviously, the code below doesn't work, but it should give you an idea of what I'm going for: pipe symbols that aren't part of the textbuttons.

Code: Select all

textbutton _("back") action Rollback()
" | "
textbutton _("history") action ShowMenu('history')
back | history ...

mikolajspy
Regular
Posts: 169
Joined: Sun Jun 04, 2017 12:05 pm
Completed: Too many, check signature
Deviantart: mikolajspy
Location: Wrocław, Poland
Contact:

Re: Adding text strings between quick menu buttons?

#2 Post by mikolajspy »

I didn't test it, but I think something like this should work:

Code: Select all

hbox:
    textbutton _("back") action Rollback()
    text " | "
    textbutton _("history") action ShowMenu('history')
    # and so on

017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: Adding text strings between quick menu buttons?

#3 Post by 017Bluefield »

Code: Select all

text _(" | ")
Well, that works, but so does the variation without the _().

Now, how do you make it match the formatting of the buttons? I had to add a {size=-4}{/size} around the pipe to get it off of the bottom edge of the screen.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Adding text strings between quick menu buttons?

#4 Post by kivik »

That'll be because textbuttons have things like padding even if they're invisible. You can put your pipe inside a textbutton:

Code: Select all

hbox:
    textbutton _("back") action Rollback()
    textbutton " | " action Null
    textbutton _("history") action ShowMenu('history')
    # and so on
You may need to add more styling to it so it doesn't have hover effects.

The _() is so that you can translate the text for different languages.

017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: Adding text strings between quick menu buttons?

#5 Post by 017Bluefield »

Tried the action Null thing, but it just returned an error?

017Bluefield
Regular
Posts: 93
Joined: Mon Dec 30, 2013 1:55 am
Projects: Project Bluefield - Origins
Organization: Autumn Rain
Deviantart: playerzero17
itch: autumn-rain
Contact:

Re: Adding text strings between quick menu buttons?

#6 Post by 017Bluefield »

Just realized that the error came from the action Null being on the same line as a textbutton, not a text.
kivik wrote: Fri Jun 15, 2018 2:37 am

Code: Select all

hbox:
    textbutton _("back") action Rollback()
    textbutton " | " action Null
    textbutton _("history") action ShowMenu('history')
    # and so on

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]