Page 1 of 1
How do you change bar increment/decrement value when using keyboard?
Posted: Thu Oct 20, 2022 5:49 pm
by henvu50
In a new renpy project. Go to preferences and music volume. Then press enter and slide the music volume slider left and right. It will increment and decrement by a value of 0.1 .. How can you change this value to 0.05, instead of 0.1?
Code: Select all
if config.has_music:
label _("Music Volume")
hbox:
bar value Preference("music volume")
kb_increment 0.05 #hypothetical how would you do this?
kb_decrement 0.05 #hypothetical how would you do this?
Re: How do you change bar increment/decrement value when using keyboard?
Posted: Thu Oct 20, 2022 10:19 pm
by Tess
This is what I came up with:
Code: Select all
#At the beginning of the screens file
init python:
def set_music_volume(vol):
preferences.set_volume("music",vol)
#In the preferences screen
if config.has_music:
label _("Music Volume")
default music_volume = 1.0
hbox:
bar adjustment ui.adjustment(value=music_volume,range=1.0,adjustable=True,step=0.05,changed=set_music_volume)
I don't think it's possible to hand MixerValue("music") or Preference("music volume") directly to the ui.adjustment object, it kept complaining about wanting an int or float rather than a MixerValue object.
Re: How do you change bar increment/decrement value when using keyboard?
Posted: Thu Oct 20, 2022 11:30 pm
by henvu50
Tess wrote: ↑Thu Oct 20, 2022 10:19 pm
This is what I came up with:
Code: Select all
#At the beginning of the screens file
init python:
def set_music_volume(vol):
preferences.set_volume("music",vol)
#In the preferences screen
if config.has_music:
label _("Music Volume")
default music_volume = 1.0
hbox:
bar adjustment ui.adjustment(value=music_volume,range=1.0,adjustable=True,step=0.05,changed=set_music_volume)
I don't think it's possible to hand MixerValue("music") or Preference("music volume") directly to the ui.adjustment object, it kept complaining about wanting an int or float rather than a MixerValue object.
Thanks for trying. Maybe we have to edit the main Renpy PY files to change the step value.