How to make a Gui Screen that displays your money.

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
Hudacious
Regular
Posts: 27
Joined: Sun Aug 28, 2016 3:20 pm
Contact:

How to make a Gui Screen that displays your money.

#1 Post by Hudacious »

Hey everyone, i'm really stuck. I've been wanting to create a GUI screen or just basic UI screen at the top of my game that displays the player's current gold count.

Any ideas on how it could be done? Thanks.

User avatar
gamerbum
Regular
Posts: 128
Joined: Fri Sep 18, 2015 4:40 pm
Projects: Our Lovely Escape, Mizari Loves Company
Organization: Reine Works
Tumblr: reineworks
Location: Canada
Contact:

Re: How to make a Gui Screen that displays your money.

#2 Post by gamerbum »

I haven't needed to do it and thus haven't actually tried, but couldn't you theoretically just add it on as a section of the quick menu screen (since that displays while you're actively playing the game) and to display the player's total gold, simply have it call the variable that counts gold?

Hudacious
Regular
Posts: 27
Joined: Sun Aug 28, 2016 3:20 pm
Contact:

Re: How to make a Gui Screen that displays your money.

#3 Post by Hudacious »

gamerbum wrote:I haven't needed to do it and thus haven't actually tried, but couldn't you theoretically just add it on as a section of the quick menu screen (since that displays while you're actively playing the game) and to display the player's total gold, simply have it call the variable that counts gold?
How would I do that? I'm really new to Renpy so i like to know the steps to absolutely everything.

User avatar
Iylae
Regular
Posts: 73
Joined: Sat Jan 09, 2016 6:57 am
Location: Cornwall, UK
Contact:

Re: How to make a Gui Screen that displays your money.

#4 Post by Iylae »

What you're looking for is answered here viewtopic.php?f=8&t=40010#p426163

Considering this was posted only two days ago, you really should try and look for things before asking questions. The simpler the question the more likely the answer exists already.
Image
  If we are what we repeatedly do, then good coding is not an act, but a habit

Hudacious
Regular
Posts: 27
Joined: Sun Aug 28, 2016 3:20 pm
Contact:

Re: How to make a Gui Screen that displays your money.

#5 Post by Hudacious »

Iylae wrote:What you're looking for is answered here viewtopic.php?f=8&t=40010#p426163

Considering this was posted only two days ago, you really should try and look for things before asking questions. The simpler the question the more likely the answer exists already.
In all fairness, the topic was titled something much different than what I was directly looking for. This tends to be the issue in situations like these.

One more question, because of that topic, i've been able to successfully pull it off. The only issue now is that there is no background behind the text. How at all could I do that? Thanks

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

Re: How to make a Gui Screen that displays your money.

#6 Post by Alex »

Try to put text inside a frame - https://www.renpy.org/doc/html/screens.html#frame

Hudacious
Regular
Posts: 27
Joined: Sun Aug 28, 2016 3:20 pm
Contact:

Re: How to make a Gui Screen that displays your money.

#7 Post by Hudacious »

Alex wrote:Try to put text inside a frame - https://www.renpy.org/doc/html/screens.html#frame
Thanks for the reply, I've been practicing around with it but so far i've come up with nothing successful. Sadly for me, i'm the type of person who learns from examples rather than pre-context statements.

Lets say for instance that I use this code.

Code: Select all

default hp = 10

screen stats():
    text "HP: [hp]"

label start:
    show screen stats
    "Game starts."
    $hp = 5
    "You now have 5 hp, you can see that on the screen."
How exactly would I put the frame behind the output? I really do apologise if it seems like i'm asking to be spoonfed, it really isn't my intention, I just learn much faster through solid examples.

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: How to make a Gui Screen that displays your money.

#8 Post by kivik »

Code: Select all

screen stats():
    frame:
        text "HP: [hp]"
This should do it. As the example code shows, screen can contain frames, so you just need to add the frame: tag and indent what you want inside the frame beneath that line.

You can pretty much mix and match, so you can have text within a hbox within frame within a vbox within a window within a screen.

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: How to make a Gui Screen that displays your money.

#9 Post by papiersam »

Don't forget zorder if you want the screen to stay above the other screens and all.

Post Reply

Who is online

Users browsing this forum: No registered users