love bar final queries... (SOLVED)

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.
Message
Author
saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

love bar final queries... (SOLVED)

#1 Post by saskuto »

Alright so I have the code for the love bars I needed for my characters.

Here, if you are needing it.

Code: Select all

# You can place the script of your game in this file.

init python:
   
    max_love=150
    current_love_sakura=5
    current_love_arisu=50
    current_love_hana=5
    current_love_daisuke=5
    current_love_naoki=5
    current_love_satoshi=5
    show_arisu=False
    show_sakura=False
    show_hana=False
    show_daisuke=False
    show_naoki=False
    show_satoshi=False
   
    def stats_overlay():                   
        if show_sakura:
            ui.frame()
            ui.vbox()
            ui.text("Sakura")
            ui.bar(max_love,current_love_sakura, xmaximum=150)
            ui.close()
            
        if show_arisu:
            ui.frame()
            ui.vbox()
            ui.text("Arisu")
            ui.bar(max_love,current_love_arisu, xmaximum=150)
            ui.close()
            
        if show_hana:
            ui.frame()
            ui.vbox()
            ui.text("Hana")
            ui.bar(max_love,current_love_hana, xmaximum=150)
            ui.close()    
                    
        if show_daisuke:
            ui.frame()
            ui.vbox()
            ui.text("Daisuke")
            ui.bar(max_love,current_love_daisuke, xmaximum=150)
            ui.close()
            
        if show_naoki:
            ui.frame()
            ui.vbox()
            ui.text("Naoki")
            ui.bar(max_love,current_love_naoki, xmaximum=150)
            ui.close()    
            
        if show_satoshi:
            ui.frame()
            ui.vbox()
            ui.text("Satoshi")
            ui.bar(max_love,current_love_satoshi, xmaximum=150)
            ui.close()    
            
    config.overlay_functions.append(stats_overlay)
   
init:
    # Declare images below this line, using the image statement.
    # eg. image eileen happy = "eileen_happy.png"

    # Declare characters used by this game.
    $ e = Character('Eileen', color="#c8ffc8")


# The game starts here.
label start:
   
    $ show_hana=True
    "Game start"
    $ current_love_hana+=50
    e "You've created a new game."
    $ show_hana=False
    
    e "You've created a new Ren'Py game."

    $ show_arisu=True
    "Game start"
    $ current_love_arisu-=50
    e "Once you add a story, pictures, and music, you can release it to the world!"
    $ show_arisu=False
    
    
However!
There are two things.

1 - I don't know how to customise the relationship bar, I can easily enough design it how I like but then how do I get it to replace the theme roundrect bar???

and

2 - How can I get the relationship bar to go up without needing text after each
$ show_arisu=True
&
$ current_love_arisu-=50
because if I remove the text after each of these statements the bar dissappears.

Any help would be much appreciated. :D
Last edited by saskuto on Sat Feb 27, 2010 9:01 am, edited 1 time in total.

User avatar
azureXtwilight
Megane Procrastinator
Posts: 4118
Joined: Fri Mar 28, 2008 4:54 am
Completed: Fantasia series (ROT and ROTA), Doppleganger: Dawn of The Inverted Soul, a2 (a due), Time Labyrinth
Projects: At Regime's End
Organization: Memento-Mori VNs, Team Sleepyhead
Location: Yogyakarta, Indonesia.
Contact:

Re: love bar final queries...

#2 Post by azureXtwilight »

Em, I have a question too.
How do we make the bar appear automatically when the particular chaseable character speak, at the box? (Similar with heart color at harvest moon game)
Image

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4085
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: love bar final queries...

#3 Post by jack_norton »

Got a PM requesting for help on this thread, I don't have much time really (five projects running now) however can help you a bit:
I don't know how to customise the relationship bar
you define a new style:

Code: Select all

    #custom bar
    style.my_bar = Style(style.default)
    style.my_bar.left_bar = Frame("gfx/bar_full.png", 20, 20)
    style.my_bar.right_bar = Frame("gfx/bar_empty.png", 20, 20)
    style.my_bar.xmaximum = 128 # bar width
    style.my_bar.ymaximum = 30 # bar height
remember to change parameters and put the right gfx files above

Your question 2 and azureXtwilight is more complex and really depends how you've structured your game, I use overlays that check for a variable and display those. To be honest I wouldn't know how to change the display based on which character is speaking automatically either myself :oops:
follow me on Image Image Image
computer games

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: love bar final queries...

#4 Post by JQuartz »

saskuto wrote:2 - How can I get the relationship bar to go up without needing text after each
You can use renpy.pause or renpy.restart_interaction like so:

Code: Select all

label start:
   
    $ show_hana=True
    $ current_love_hana+=50
    $ renpy.pause()
    $ show_hana=True
    $ current_love_hana+=50
    $ renpy.restart_interaction()
azureXtwilight wrote:How do we make the bar appear automatically when the particular chaseable character speak, at the box? (Similar with heart color at harvest moon game)
You can try using callback in the Character like so:

Code: Select all

init python:
    def heart_meter(event, **kwargs):
        ui.bar(max_love,current_love_daisuke, xmaximum=150, xpos=10, ypos=450)
   

    d = Character('Daisuke', color="#c8ffc8", callback=heart_meter)
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

Re: love bar final queries...

#5 Post by saskuto »

jack_norton wrote:
I don't know how to customise the relationship bar
you define a new style:

Code: Select all

    #custom bar
    style.my_bar = Style(style.default)
    style.my_bar.left_bar = Frame("gfx/bar_full.png", 20, 20)
    style.my_bar.right_bar = Frame("gfx/bar_empty.png", 20, 20)
    style.my_bar.xmaximum = 128 # bar width
    style.my_bar.ymaximum = 30 # bar height
remember to change parameters and put the right gfx files above
Sorry, I'm a noob and don't really understand :oops: ... where would I put this code? In the options section? Or in the init part of the script?

And what do you mean by
change parameters and put the right gfx files above
?

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4085
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: love bar final queries...

#6 Post by jack_norton »

You can put in any init python block, in options.rpy is fine.
You need to change the graphic files ("gfx/bar_full.png" and "gfx/bar_empty.png") to your custom bar images (bar filled and bar empty).
follow me on Image Image Image
computer games

saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

Re: love bar final queries...

#7 Post by saskuto »

jack_norton wrote:You can put in any init python block, in options.rpy is fine.
You need to change the graphic files ("gfx/bar_full.png" and "gfx/bar_empty.png") to your custom bar images (bar filled and bar empty).
Well I pasted it into the part where it says in options ## More customizations can go here. And now I get this error:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 271 of L:\Visual Novels\software\renpy-6.10.0\Shinigami Academy/game/options.rpy: expected statement.
style.my_bar = Style(style.default)
             ^

On line 272 of L:\Visual Novels\software\renpy-6.10.0\Shinigami Academy/game/options.rpy: expected statement.
style.my_bar.left_bar = Frame("gfx/bar_full.png", 20, 20)
                      ^

On line 273 of L:\Visual Novels\software\renpy-6.10.0\Shinigami Academy/game/options.rpy: expected statement.
style.my_bar.right_bar = Frame("gfx/bar_empty.png", 20, 20)
                       ^

On line 274 of L:\Visual Novels\software\renpy-6.10.0\Shinigami Academy/game/options.rpy: expected statement.
style.my_bar.xmaximum = 400 
                      ^

On line 275 of L:\Visual Novels\software\renpy-6.10.0\Shinigami Academy/game/options.rpy: expected statement.
style.my_bar.ymaximum = 100 
                      ^

Ren'Py Version: Ren'Py 6.10.0e
Also do you mean I should overwrite the files rrslider_empty.png and rrslider_full.png in the 'common' folder?

Sorry if i'm being slow! :(

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4085
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: love bar final queries...

#8 Post by jack_norton »

put it this way on top of your code:

Code: Select all

init python:
    #custom bar
    style.my_bar = Style(style.default)
    style.my_bar.left_bar = Frame("gfx/bar_full.png", 20, 20)
    style.my_bar.right_bar = Frame("gfx/bar_empty.png", 20, 20)
    style.my_bar.xmaximum = 128 # bar width
    style.my_bar.ymaximum = 30 # bar height
you simply need to add your own custom bar images and then put the path in the two lines above
follow me on Image Image Image
computer games

saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

Re: love bar final queries...

#9 Post by saskuto »

jack_norton wrote:put it this way on top of your code:

Code: Select all

init python:
    #custom bar
    style.my_bar = Style(style.default)
    style.my_bar.left_bar = Frame("gfx/bar_full.png", 20, 20)
    style.my_bar.right_bar = Frame("gfx/bar_empty.png", 20, 20)
    style.my_bar.xmaximum = 128 # bar width
    style.my_bar.ymaximum = 30 # bar height
you simply need to add your own custom bar images and then put the path in the two lines above
ok so i put this at the very top of my options page and no error comes up anymore so ty!
I still don't understand where I am meant to put my custom bar png files or how I get them to show instead of the theme roundrect one tho :?:

User avatar
Midnighticequeen
Veteran
Posts: 292
Joined: Fri Apr 04, 2008 4:04 pm
Completed: Bunni and Kitty, Sweethearts, Tiesa's Tales
Projects: Wish
Organization: Ice Queen Games
itch: icequeenstudios
Contact:

Re: love bar final queries...

#10 Post by Midnighticequeen »

I always wondered how you made those cute love bars. Now I know, thanks :D

User avatar
jack_norton
Lemma-Class Veteran
Posts: 4085
Joined: Mon Jul 21, 2008 5:41 pm
Completed: Too many! See my homepage
Projects: A lot! See www.winterwolves.com
Tumblr: winterwolvesgames
Contact:

Re: love bar final queries...

#11 Post by jack_norton »

saskuto wrote: I still don't understand where I am meant to put my custom bar png files or how I get them to show instead of the theme roundrect one tho :?:
Anywhere in game directory like you do with the rest of your art (I assume your game HAS some art ??).
Then you use the style parameter when you put the bar, like:

Code: Select all

ui.bar(max_love,current_love_daisuke, xmaximum=150, xpos=10, ypos=450,style="my_bar")
BTW this is also clearly explained in renpy docs...try reading them, so pytom didn't wrote them for nothing! :mrgreen:
follow me on Image Image Image
computer games

saskuto
Regular
Posts: 64
Joined: Fri Jan 15, 2010 2:56 pm
Contact:

Re: love bar final queries...

#12 Post by saskuto »

jack_norton wrote:
saskuto wrote: I still don't understand where I am meant to put my custom bar png files or how I get them to show instead of the theme roundrect one tho :?:
Anywhere in game directory like you do with the rest of your art (I assume your game HAS some art ??).
Then you use the style parameter when you put the bar, like:

Code: Select all

ui.bar(max_love,current_love_daisuke, xmaximum=150, xpos=10, ypos=450,style="my_bar")
BTW this is also clearly explained in renpy docs...try reading them, so pytom didn't wrote them for nothing! :mrgreen:
ah yep it has art lol
I did put them in the same folder but was confused when they didn't show up so thought I had to put them somewhere else. So the only thing wrong was i forgot to add the code by the ui.bar bit to call it :oops:

and pytoms docs have helped me so much already, he definitely didn't write them for nothing! :D *bows to pytom-sensei*

LittleUrchin
Regular
Posts: 43
Joined: Sat Aug 11, 2012 4:53 pm
Location: Trapped inside a snow cone with a purple walrus and a broken jukebox
Contact:

Re: love bar final queries... (SOLVED)

#13 Post by LittleUrchin »

I know this is old, but I'm using this code for my game and it works, there aren't any errors popping up, but it's not showing up exactly how I need it to.

So my question is this: how do you customize the style if the edges of the actual bar doesn't start immediately from the edges of the image used?

Hope that makes sense. Thanks in advance to anyone who answers this.

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

Re: love bar final queries... (SOLVED)

#14 Post by Alex »

I assume you have horizontal bars, so try to set the left and the right gutter's size to zero

Code: Select all

style.my_bar.left_gutter = 0
style.my_bar.right_gutter = 0
http://www.renpy.org/doc/html/style.htm ... properties

LittleUrchin
Regular
Posts: 43
Joined: Sat Aug 11, 2012 4:53 pm
Location: Trapped inside a snow cone with a purple walrus and a broken jukebox
Contact:

Re: love bar final queries... (SOLVED)

#15 Post by LittleUrchin »

Alex wrote:I assume you have horizontal bars, so try to set the left and the right gutter's size to zero

Code: Select all

style.my_bar.left_gutter = 0
style.my_bar.right_gutter = 0
http://www.renpy.org/doc/html/style.htm ... properties
Thanks, I'll try this!

Post Reply

Who is online

Users browsing this forum: No registered users