Having trouble making a "Skip Speed" slider bar

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
User avatar
Creazd
Newbie
Posts: 4
Joined: Fri Jan 27, 2017 9:38 pm
Location: USA
Contact:

Having trouble making a "Skip Speed" slider bar

#1 Post by Creazd »

I've been working on a custom Preferences screen and am attempting to make a slider bar for skip speed. At first I didn't think it was possible, however after looking at the documentation I've tracked down the variable related to adjusting skip speed. I believe my current problem is my lack of knowledge regarding slider bars. Any help would be greatly appreciated! :)

Variable to adjust skip speed:

Code: Select all

config.skip_delay: (0-100)
My terrible attempt at making a slider:

Code: Select all

bar value StaticValue("config.skip_delay", 100):
        xalign 0.1 yalign 0.50 
        xmaximum 400 
        ymaximum 15

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Having trouble making a "Skip Speed" slider bar

#2 Post by nyaatrap »

There is some difficulty to change config.skip_delay. Because even you changed it in the game menu, Ren'py nullifies this change after you closed the game menu.
So you need a trick to achieve this thing. Here is a code how I achieved it.

Code: Select all

screen:
                label _("Skip Speed")
                bar value FieldValue(persistent, "skip_delay", range=100, offset=5, style="slider") bar_invert True

init python:
    def recursive_update():
        config.skip_delay = persistent.skip_delay

    config.interact_callbacks.append(recursive_update)

Post Reply

Who is online

Users browsing this forum: No registered users