Hi all,
On controller, I noticed to adjust the volume bars, you need to select them first, then press left or right. Since there is nothing left or right of my bars, is it possible to remove the select and just press left or right? It feels more intuitive to do it that way but I'm not sure if it's possible in Ren'Py?
Thanks
[SOLVED] Adjust volume bar with left/ right arrow key
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.
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.
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
[SOLVED] Adjust volume bar with left/ right arrow key
Last edited by Kinmoku on Tue Jun 11, 2019 11:44 am, edited 1 time in total.
Re: Adjust volume bar with left/ right arrow key
Try to set actions like
Code: Select all
key "focus_left" action SetDict (_preferences.volumes,'music', max (0.0, (_preferences.volumes['music'] - 0.1) ) )
key "focus_right" action SetDict (_preferences.volumes,'music', min (1.0, (_preferences.volumes['music'] + 0.1) ) )
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Adjust volume bar with left/ right arrow key
Thanks Alex. This works but only for the music bar (not sound). I also only want it to work when I'm hovered over the music volume bar. Even if I am somewhere else on the settings UI, pressing left/ right will still adjust the volume, which I don't want as I cannot select other buttons left and right beneath the bars.Alex wrote: ↑Fri Jun 07, 2019 9:37 am Try to set actions likeCode: Select all
key "focus_left" action SetDict (_preferences.volumes,'music', max (0.0, (_preferences.volumes['music'] - 0.1) ) ) key "focus_right" action SetDict (_preferences.volumes,'music', min (1.0, (_preferences.volumes['music'] + 0.1) ) )
How can I have it focus only on the volume bar?
Code: Select all
hbox:
style_group "pref"
spacing 50
xalign 0.5
text _("Music Volume") ypos 10
bar value Preference("music volume") ypos 12
key "focus_left" action SetDict (_preferences.volumes,'music', max (0.0, (_preferences.volumes['music'] - 0.1) ) )
key "focus_right" action SetDict (_preferences.volumes,'music', min (1.0, (_preferences.volumes['music'] + 0.1) ) )
hbox:
style_group "pref"
spacing 50
xalign 0.5
text _("Sound Volume") ypos 35
bar value Preference("sound volume") ypos 35
key "focus_left" action SetDict (_preferences.volumes,'sound', max (0.0, (_preferences.volumes['sound'] - 0.1) ) )
key "focus_right" action SetDict (_preferences.volumes,'sound', min (1.0, (_preferences.volumes['sound'] + 0.1) ) )
Re: Adjust volume bar with left/ right arrow key
I thought it was what your were looking for...
Well, then try to make a separate screen to reassign keys actions and show it while bar is hovered.
Code: Select all
screen my_keys_operate_scr(mixer):
key "focus_left" action SetDict (_preferences.volumes, mixer, max (0.0, (_preferences.volumes[mixer] - 0.1) ) )
key "focus_right" action SetDict (_preferences.volumes, mixer, min (1.0, (_preferences.volumes[mixer] + 0.1) ) )
Code: Select all
bar value Preference("music volume") hovered Show("my_keys_operate_scr", mixer='music') unhovered Hide("my_keys_operate_scr")
bar value Preference("sound volume") hovered Show("my_keys_operate_scr", mixer='sfx') unhovered Hide("my_keys_operate_scr")
bar value Preference("voice volume") hovered Show("my_keys_operate_scr", mixer='voice') unhovered Hide("my_keys_operate_scr")
- SypherZent
- Veteran
- Posts: 362
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Location: Puerto Rico
- Contact:
Re: Adjust volume bar with left/ right arrow key
You can try setting multiple actions, too.
Code: Select all
screen my_keys_operate_scr(mixer):
key "focus_left" action [
SetDict (_preferences.volumes,'music', max (0.0, (_preferences.volumes['music'] - 0.1) ) ),
SetDict (_preferences.volumes,'sound', max (0.0, (_preferences.volumes['sound'] - 0.1) ) )
]
- Kinmoku
- Miko-Class Veteran
- Posts: 591
- Joined: Mon Aug 11, 2014 9:39 am
- Completed: One Night Stand
- Projects: VIDEOVERSE
- Tumblr: gamesbykinmoku
- itch: kinmoku
- Location: Germany
- Contact:
Re: Adjust volume bar with left/ right arrow key
Thank you both for your help
I went with:
I had to adjust the y position (space them out more) because the buttons were interfering slightly. Seems to work well now, though!
I went with:
Code: Select all
hbox:
style_group "pref"
spacing 50
xalign 0.5
text _("Music Volume") ypos 10
bar value Preference("music volume") hovered Show("my_keys_operate_scr", mixer='music') unhovered Hide("my_keys_operate_scr") ypos 10
hbox:
style_group "pref"
spacing 50
xalign 0.5
text _("Sound Volume") ypos 35
bar value Preference("sound volume") hovered Show("my_keys_operate_scr", mixer='sfx') unhovered Hide("my_keys_operate_scr") ypos 40
Who is online
Users browsing this forum: No registered users