Can bar be used to adjust through a list?

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
underbliss
Regular
Posts: 96
Joined: Sat Dec 13, 2014 3:38 pm
Projects: Ebon Light
Tumblr: underbliss
Deviantart: Ahnna
Contact:

Can bar be used to adjust through a list?

#1 Post by underbliss » Fri Jul 31, 2015 12:04 pm

Ooookay, I'm not sure if this is .. backwards or something, so please bear with me!

For context, I have a character customization screen that I'm attempting to design and would like to use bars(right now I'm using buttons) for the various options. (Hair color, hair style, eye color, clothing, etc).

Is there any way to have a bar that can modify these values with a list? Something like..

Code: Select all

hcolors = [
        "red", "brown", "lightbrown", "darkblonde", "blonde", "black",
        ]
..or do I have to sort out how to translate this into integers if I want to make it work?
Last edited by underbliss on Fri Jul 31, 2015 8:29 pm, edited 1 time in total.

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Can bar be used to adjust through a list?

#2 Post by philat » Fri Jul 31, 2015 12:35 pm

I haven't tried it, but I would imagine you could just link the integers to the index numbers of the list.

User avatar
mobychan
Veteran
Posts: 275
Joined: Fri Apr 24, 2015 6:31 am
Projects: The Chosen - Sakura Pink & Gentian Blue
Organization: Foresoft
Location: Germany
Contact:

Re: Can bar be used to adjust through a list?

#3 Post by mobychan » Fri Jul 31, 2015 1:25 pm

You can add a range I guess that would help?

http://www.renpy.org/doc/html/screens.html#bar

User avatar
underbliss
Regular
Posts: 96
Joined: Sat Dec 13, 2014 3:38 pm
Projects: Ebon Light
Tumblr: underbliss
Deviantart: Ahnna
Contact:

Re: Can bar be used to adjust through a list?

#4 Post by underbliss » Sun Aug 02, 2015 2:56 am

Hi! Thank you for the responses!

I tried using range and using the list's index number but nothing I was attempting met any success...

Stuff like making the bar range = hcolor[5] just popped back errors saying it needed an int

It was holding stuff up so I worked out a button design in the end, but if anyone has any ideas, clarification or further infomration I'm still really curious about how you'd do this!

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: Can bar be used to adjust through a list?

#5 Post by xela » Sun Aug 02, 2015 3:47 am

Code: Select all

screen testing(l):
    vbox:
        xalign 0.5
        text "[index]"
        $ val = l[index]
        text "[val]"
        bar:
            xsize 300
            value VariableValue("index", len(l) - 1)
    
        
label start:
    $ hcolors = ["red", "brown", "lightbrown", "darkblonde", "blonde", "black"]
    $ index = 0
    call screen testing(hcolors)
Like what we're doing? Support us at:
Image

User avatar
underbliss
Regular
Posts: 96
Joined: Sat Dec 13, 2014 3:38 pm
Projects: Ebon Light
Tumblr: underbliss
Deviantart: Ahnna
Contact:

Re: Can bar be used to adjust through a list?

#6 Post by underbliss » Sun Aug 02, 2015 4:09 am

ahhhhhmyyy Thank you! you're awesome!
I'm even ~sort of~ excited about the next time I need to design a screen, now ;p

Post Reply

Who is online

Users browsing this forum: Google [Bot]