A few bar questions

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
Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

A few bar questions

#1 Post 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

User avatar
SinnyROM
Regular
Posts: 166
Joined: Mon Jul 08, 2013 12:25 am
Projects: Blue Birth
Organization: Cosmic Static Games
Contact:

Re: A few bar questions

#2 Post 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?

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: A few bar questions

#3 Post 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?

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: A few bar questions

#4 Post 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?

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: A few bar questions

#5 Post 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

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: A few bar questions

#6 Post by Ryue »

Yepp that worked tnx.
Then the only thing left is the multiline usage?

User avatar
Alex
Lemma-Class Veteran
Posts: 3098
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: A few bar questions

#7 Post by Alex »

What do you mean by multiline?

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: A few bar questions

#8 Post 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.

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: A few bar questions

#9 Post 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":

Ryue
Miko-Class Veteran
Posts: 745
Joined: Fri Nov 02, 2012 8:41 am
Projects: Red eyes in the darkness
Contact:

Re: A few bar questions

#10 Post by Ryue »

That was it thanks. I still don't believe it that I forgot the ":" .drop. tnx again!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Oceane_Kudo, Semrush [Bot]