Help Displaying Bar (Where to put code)

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
SmartAppleGames
Newbie
Posts: 15
Joined: Wed Feb 15, 2017 12:39 am
Contact:

Help Displaying Bar (Where to put code)

#1 Post by SmartAppleGames » Wed Feb 15, 2017 12:53 am

hi im having difficulty displaying bars for ui, im not sure where in the code structure to put it. currently the only way to load game is to put it above label start: if i put anywhere after it, i get errors

# The game starts here.

screen sidebar:
frame:
has vbox

bar value stat range 100

label start:

# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.

scene bg room

# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.

show eileen happy

# These display lines of dialogue.

"Hello, world."

a "You've created a new Ren'Py game."

a "Once you add a story, pictures, and music, you can release it to the world!"

# This ends the game.

return

the above works but no bar is displayed but no errors either.

# The game starts here.

label start:

screen sidebar:
frame:
has vbox

bar value stat range 100

# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.

scene bg room

# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.

show eileen happy

# These display lines of dialogue.

"Hello, world."

a "You've created a new Ren'Py game."

a "Once you add a story, pictures, and music, you can release it to the world!"

# This ends the game.

return

i get the following errors if i put any bar code after label start as seen above

screen sidebar:<- screen expect a non-empty block
frame->: expected statement

all errors, where do i put code so it displays or is did i even code the bar right? help plz im new to ren'py

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Help Displaying Bar (Where to put code)

#2 Post by wyverngem » Wed Feb 15, 2017 1:23 am

You need to show the screen by using this code

Code: Select all

show screen sidebar
It can be placed in any label. Also you need to define your stat variable.

Code: Select all

default stat = 0

screen sidebar:
    frame:
        has vbox
        bar value stat range 100

label start:
    scene bg room
    show eileen happy
    show screen sidebar
    "Hello, world."
    a "You've created a new Ren'Py game."
    a "Once you add a story, pictures, and music, you can release it to the world!"
return

User avatar
SmartAppleGames
Newbie
Posts: 15
Joined: Wed Feb 15, 2017 12:39 am
Contact:

Re: Help Displaying Bar (Where to put code)

#3 Post by SmartAppleGames » Wed Feb 15, 2017 1:40 am

thank you so much it worked! now i can design ui.

Post Reply

Who is online

Users browsing this forum: No registered users