A status button that can be clicked on during the gameplay

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
User avatar
Chansel
Veteran
Posts: 249
Joined: Sat May 01, 2010 6:11 pm
Projects: School's Out! -- A GxB or GxG VN/Dating Sim
Location: The Netherlands, Noord-Brabant
Contact:

A status button that can be clicked on during the gameplay

#1 Post by Chansel » Tue May 04, 2010 6:07 am

Hello everyone!
I've been lurking around for quite some time now and I've found many great solutions to my problems on this forum.
So thanks a million for that! =D
But alas, I haven't been able to figure this out by myself... So I was hoping some of you great minds could help me out ^^

My problem is this:
I have used the cookbook section to create buttons that are visible during the game. One of these buttons is supposed to be for 'Stats'. Meaning that if you click on it, the Status screen pops up showing your stats. You then have to click the 'return' button to go back to your game and that's that.

Simple, right?
Well... not for me ^^"
I've tried everything I could get my hands on, and failed. Miserably. I honestly don't know how to do this... So could someone please help me out with this? Pretty please? With a cherry on top?

ps. I attached two screenshots to illustrate what I mean, just in case.
Attachments
screenshot2.png
screenshot.png
Image ~ A GxB or GxG Visual Novel/Dating Sim

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: A status button that can be clicked on during the gamepl

#2 Post by Aleema » Tue May 04, 2010 8:59 am

You can try a simple fix like this:

Code: Select all

label stats:
    python:
        ui.textbutton("Go Back", clicked=ui.returns("goback"))
    $ picked = ui.interact()
    if picked == "goback":
        return
Where, your stat button is "clicked=ccinc("stats")" (ccinc only if you're using the cookbook code).
Just customize the stats label to look like your screen, and it should work. You might want to disable access to the menu so players aren't tempted to save at that screen (thus screwing up the "return" command).

User avatar
Chansel
Veteran
Posts: 249
Joined: Sat May 01, 2010 6:11 pm
Projects: School's Out! -- A GxB or GxG VN/Dating Sim
Location: The Netherlands, Noord-Brabant
Contact:

Re: A status button that can be clicked on during the gamepl

#3 Post by Chansel » Tue May 04, 2010 11:05 am

Yes, thank you ^^
That solves one of the problems and it's working perfectly.

But I'm afraid that editing the screen to look like my image is a part of my problem... Sorry for not stating this clearly.

I mean, should I use imagemaps as with my main menu?
Or some form of ui?
Or do something I haven't even thought of? (This is most likely)

Sorry if this is a really dumb question, but I just can't find it. I feel utterly lost and overwhelmed by all the python, init and god knows what codes :S
Image ~ A GxB or GxG Visual Novel/Dating Sim

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: A status button that can be clicked on during the gamepl

#4 Post by Aleema » Tue May 04, 2010 11:27 am

Don't fret, I can help. Interfaces are my favorite part, too. :3
Chansel wrote:I mean, should I use imagemaps as with my main menu?
Or some form of ui?
Or do something I haven't even thought of? (This is most likely)
Nope, those are basically your two options, hehe. Imagemaps are generally easier (because it's easier to build in Photoshop), but since this is menu that needs to display stats, you will need to learn to use the UI functions. The first concept you should grasp is how to make tables out of UI functions.

Code: Select all

label stats:
    python:
        ui.hbox()
        
        ui.vbox()
        ui.close()
        
        ui.vbox()
        ui.close()
        
        ui.close()
        
This creates two columns, side by side (which is what I see in your example image). Inside of those ui.vbox's (columns) you would put the images (or buttons? I'm not sure what those are) and the text that says how much your stat is. For instance:

Code: Select all

label stats:
    scene backgroundgraphic
    python:
        ui.hbox()
        
        # Column 1
        ui.vbox()
        # Title 1
        ui.text("STATS")
        # Charisma
        ui.frame(background="bubble.png")
        ui.text("Charisma: %d"%c_points)
        # Fitness
        ui.frame(background="bubble.png")
        ui.text("Fitness: %d"%f_points)
        # Intelligence
        ui.frame(background="bubble.png")
        ui.text("Intelligence: %d"%i_points)
        
        ui.close()
        
         # Column 2
        ui.vbox()
        # Title 2
        ui.text("APPEARANCE")
        # Hair
        ui.frame(background="bubble.png")
        ui.text("Hair: %d"%h_points)
        # Body
        ui.frame(background="bubble.png")
        ui.text("Body: %d"%b_points)
        # Skin
        ui.frame(background="bubble.png")
        ui.text("Skin: %d"%s_points)
        
        ui.close()
        
        ui.close()
        
        ui.textbutton("Go Back", clicked=ui.returns("goback"), ypos=0.9, xpos=0.5)
        
    $ picked = ui.interact()
    if picked == "goback":
        return
ui.frame contains 1 widget, in this case the text, and is desirable because you can change it's background image to whatever. I recommend that you make the "backgroundgraphic" anything that doesn't need to be interacted with, such as the titles and the girl (unless she's dynamic). In which case, the bubble graphic and titles and such wouldn't need to be coded, like I had up there. BUT, you'll have to spend a lot of time aligning the text that you do have to code to match the background.

Does that help?

User avatar
Chansel
Veteran
Posts: 249
Joined: Sat May 01, 2010 6:11 pm
Projects: School's Out! -- A GxB or GxG VN/Dating Sim
Location: The Netherlands, Noord-Brabant
Contact:

Re: A status button that can be clicked on during the gamepl

#5 Post by Chansel » Wed May 05, 2010 11:14 am

You. Are. Amazing!!

Thank you so much for your (very quick) help =D
The status screen is finished now, yay ^^

Oh, and let me just say that your RockRobin project looks very interesting. I hope you'll finish that soon ^^ (if you're still working on it. I noticed the post were from 2008 O.o)
Image ~ A GxB or GxG Visual Novel/Dating Sim

User avatar
Aleema
Lemma-Class Veteran
Posts: 2677
Joined: Fri May 23, 2008 2:11 pm
Organization: happyB
Tumblr: happybackwards
Contact:

Re: A status button that can be clicked on during the gamepl

#6 Post by Aleema » Wed May 05, 2010 11:50 am

Chansel wrote:Oh, and let me just say that your RockRobin project looks very interesting. I hope you'll finish that soon ^^ (if you're still working on it. I noticed the post were from 2008 O.o)
You're welcome, of course. ^^

And thanks for the interest in Rock Robin! I am working on it at this very moment! :D
As for the post being made in 2008 ... I have no idea what that's about, I started it, like, a month ago. =P

Post Reply

Who is online

Users browsing this forum: No registered users