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.
-
Mitch
- Newbie
- Posts: 13
- Joined: Sun Mar 08, 2015 6:10 pm
- Tumblr: alexander-of-caledon
- Location: Scotland
-
Contact:
#1
Post
by Mitch » Sat Jul 18, 2015 8:49 am
Hiya folks,
I was wondering if anyone knows of a way to allow the player to go into their Preferences and click a button to change the default font used in the game to another font in the game folder? I'm looking into Screen Actions, and I tried making a frame like the one following, based on similar menus:
Code: Select all
frame:
style_group "pref"
has vbox
label _("Change Font")
textbutton _("Change Font") action SetVariable(style.default.font, "PERBI___.ttf")
But I got the following error message (the attribute/file mentioned is the default font I've specified in options.rpy, which exists in the game folder, is named correctly, and works fine if the above line of code is removed).
Does anyone know how to make the above button work, or, failing that, have another way of allowing the player to choose to use a different font via the Preferences screen?
-
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:
#2
Post
by SundownKid » Sat Jul 18, 2015 9:21 am
-
Mitch
- Newbie
- Posts: 13
- Joined: Sun Mar 08, 2015 6:10 pm
- Tumblr: alexander-of-caledon
- Location: Scotland
-
Contact:
#3
Post
by Mitch » Sat Jul 18, 2015 3:50 pm
Thank you! The only thing is that when you add the code, the default font doesn't change everything all at once, just the font in the texbutton, then the font of any other textbutton you happen to hover over. If you click it a couple times, the fonts on the labels change over too, but it's very clunky. Do you (or anyone else) know if there's a way around that, or why it might be happening that way for me?
Code: Select all
frame:
style_group "pref"
has vbox
label _("Change Font")
textbutton _("Regular") action StylePreference("font", "Regular")
textbutton _("Bold") action StylePreference("font", "Bold")
...
init -2 python:
renpy.register_style_preference("font", "Bold", style.default, "font", "PERBI___.ttf")
renpy.register_style_preference("font", "Regular", style.default, "font", "PERI____.ttf")
Users browsing this forum: Bing [Bot]