Page 1 of 1

A few bar questions

Posted: Thu Jul 30, 2015 7:47 am
by Ryue
I'm tring to use a bar in a defined screen:

Code: Select all

screen myscreen((initiativeList):
    hbox:
        spacing 5
             for initiativePosition in initiativeList:
                 frame: 
                     vbox:
                          fixed:
                             add "myimage"
                          bar value initiativePosition.CombatStats['Health']['Current'] range initiativePosition.CombatStats['Health']['Total'] xmaximum 64 thumb None left_bar GreenImage right_bar RedImage
The images are defined here:

Code: Select all

init -11:
    image RedImage = "#FF0000"
    image GreenImage = "#00FF00"
Now I got a few quetisons here:
1.) how can I make the bar as multiline?
2.) I'm getting an error saying name GreenImage is not edfined when I try to run the above code

Re: A few bar questions

Posted: Thu Jul 30, 2015 1:35 pm
by SinnyROM
Try making GreenImage a variable instead of an image; usually the property looks for a string or path.

Code: Select all

init -11:
    $ GreenImage = "#00ff00"
I don't understand what you mean by multiline though. Could you clarify please?

Re: A few bar questions

Posted: Thu Jul 30, 2015 2:06 pm
by Ryue
As example for multiline (non working though):

Code: Select all

bar 
    value initiativePosition.CombatStats['Health']['Current'] 
    range .....
For the variable instead of image tnx that works. Althnough I'm a bit confused there. Why? In the manual it says displayable but a string is not a displayable an image would be. Do you have any idea why?

Re: A few bar questions

Posted: Thu Jul 30, 2015 3:07 pm
by Ryue
One thing though now.
With the Variable working I tried it out:
Image
As both the range and the current are the same value why is red shown at all? Or can it be hidden somehow?

Re: A few bar questions

Posted: Thu Jul 30, 2015 3:48 pm
by Alex

Code: Select all

left_bar GreenImage
in this case GreenImage is a variable - put it in quotes to tell Ren'Py that it is a displayable.

As for red part of bar - try to set the left and the right gutters values to 0.
http://www.renpy.org/doc/html/style_pro ... properties

Re: A few bar questions

Posted: Thu Jul 30, 2015 4:46 pm
by Ryue
Yepp that worked tnx.
Then the only thing left is the multiline usage?

Re: A few bar questions

Posted: Thu Jul 30, 2015 5:45 pm
by Alex
What do you mean by multiline?

Re: A few bar questions

Posted: Fri Jul 31, 2015 2:19 am
by Ryue
Something in this way (does not work though as it is wrong grammatic for the compiler).

Code: Select all

bar 
    value initiativePosition.CombatStats['Health']['Current'] 
    range initiativePosition.CombatStats['Health']['Total'] 
    xmaximum 64 
    thumb None 
    left_bar "GreenImage" 
    right_bar 2RedImage"
So to say not writing it all in one overlong line.

Re: A few bar questions

Posted: Fri Jul 31, 2015 3:22 am
by mobychan
Just put a : behind bar:

Code: Select all

bar:
    value initiativePosition.CombatStats['Health']['Current'] 
    range initiativePosition.CombatStats['Health']['Total'] 
    xmaximum 64 
    thumb None 
    left_bar "GreenImage" 
    right_bar 2RedImage"
i think it works with every screen component?
But some need an additional value before the :, for example:

Code: Select all

hotspot (x, y, width, height):
text "my text":

Re: A few bar questions

Posted: Fri Jul 31, 2015 3:50 am
by Ryue
That was it thanks. I still don't believe it that I forgot the ":" .drop. tnx again!