Ren'Py [Solved]how to make bar in renpy that you can't adjust

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,130
3,194
I have trying to put a status bar that's you can't adjust but all I found is bars that you can adjust

I'm using this code here and I have already ask there


here is the code
Code:
init python:

    #This controls when the love-points floater appears.
    show_amber=False
    show_arthur=False
    show_shino=False

    ## ------------ Love Points Floater ----------------------

    def stats_overlay():

        # --- Amber's Love Bar -------
        if show_amber:
            ui.frame(
                xalign = 0.5, #centered
                ypos = 400,) #400 px Down from the Top

            ui.vbox(xalign = 0.5)
            ui.text ("Amber's Love Points: %d" %amber_love,
                xalign = 0.5)
            ui.bar(max_love, amber_love,
                style="my_bar")

            ui.close()

        # --- Samber's Love Bar -------
        if show_samber:
            ui.frame(
                xalign = 0.5,
                ypos = 400,)

            ui.vbox()
            ui.text ("Samber's Love Points: %d" %samber_love,
                xalign = 0.5)
            ui.bar(max_love, samber_love,
                style="my_bar")

            ui.close()

        # --- Mother's Love Bar -------
        if show_mother:
            ui.frame(
                xalign = 0.5,
                ypos = 400,)

            ui.vbox()
            ui.text ("Mother's Love Points: %d" %mother_love,
                xalign = 0.5)
            ui.bar(max_love, mother_love,
                style="my_bar")

            ui.close()

    config.overlay_functions.append(stats_overlay)

init -2 python:
    amber_love = 10
    max_love = 300

    samber_love = 10
    max_love = 150

    mother_love  = 10
    max_love = 150

init -5 python:
    #custom bar
    style.my_bar = Style(style.default)
    style.my_bar.xalign = 0.5
    style.my_bar.xmaximum = 315 # bar width
    style.my_bar.ymaximum = 30 # bar height
    style.my_bar.left_gutter = 5
    style.my_bar.right_gutter = 5

    # I have all my User Interface graphics stored in one file called ui.
    # To access them in my code, I put ui/ in front of all images in that file.

    style.my_bar.left_bar = Frame("gui/bar_full.png", 0, 0)
    style.my_bar.right_bar = Frame("gui/bar_empty.png", 0, 0)
    style.my_bar.hover_left_bar = Frame("gui/bar_hover.png", 0, 0)

    style.my_bar.thumb = "gui/thumb.png"
    style.my_bar.thumb_shadow = None
    style.my_bar.thumb_offset = 5
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
Hmm...

Not sure about all that ui. stuff. Since that example is dated 2013 - I'm going to guess that's the hard/old way of doing things.

I'd expect a to just be part of a , displayed on screen by using either or (with ).

You could try looking at this thread:
https://f95zone.to/threads/hovering-over-a-bar-for-tooltip.60619/

Whilst it's not talking about how to add bars exactly, it does include an example of a bar used in the same way you're talking about. Just ignore the talk about tooltips.

That person's game is iNSight of You, you could rip it apart with UnRen (0.9, as 0.8 doesn't work with some games) to see how they're putting their screen UI together.
 
  • Like
Reactions: rayminator

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
What do you want the bar to achieve? If its just a bar to use as something to to overlay stats or whatever on?
 

rayminator

Engaged Member
Respected User
Sep 26, 2018
3,130
3,194
thank you that worked

Code:
bar:
                #xpos 1100 ypos 100
                xysize(270,100)
                value amber_love
                range 100
                left_bar "gui/love100.png"
                right_bar "gui/love.png"