[Solved] How do I add a custom value range on bar value Preference("font scale") ?

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
henvu50
Veteran
Posts: 322
Joined: Wed Aug 22, 2018 1:22 am
Contact:

[Solved] How do I add a custom value range on bar value Preference("font scale") ?

#1 Post by henvu50 » Sun Aug 29, 2021 12:16 am

How do I add a custom range on bar value Preference("font scale")?

This is how the font size is normally changed from 00accessibility.rpy

Code: Select all

        bar value Preference("font size")
        textbutton _("Reset"):
             action Preference("font size", 1.0)
I'm trying to make a bar that changes the font size, but I want the bar value range to be between .8 and 1.1

Here is my code so far, but the function never fires. Maybe there is a better way to do it?

Code: Select all

```
screen test():
    #bar value FieldValue(_preferences, 'font size', .3, offset=.8): #doesn't work
    #bar value FieldValue(_preferences, 'font_size', .3, offset=.8): #doesn't work
    #bar value FieldValue(Preference, 'font size', .3, offset=.8): #doesn't work
    #bar value FieldValue(Preference, 'font_size', .3, offset=.8): #doesn't work
    bar value FieldValue(persistent, 'text_size_overall', .3, offset=.8):
       changed fts  

init python:
    
    # this function never fires when the slider is dragged.
    def fts(value):
        renpy.run(Preference('font size', value))
```
Last edited by henvu50 on Sat Sep 04, 2021 10:57 pm, edited 1 time in total.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: How do I add a custom value range on bar value Preference("font scale") ?

#2 Post by hell_oh_world » Sun Aug 29, 2021 4:19 am

https://www.renpy.org/doc/html/screen_a ... FieldValue
action
If not None, an action to call when the field has changed.
There's an action parameter to it.

Post Reply

Who is online

Users browsing this forum: span4ev