Stats screen issues.

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
Steffenator
Regular
Posts: 53
Joined: Fri Feb 17, 2017 11:58 am
Contact:

Stats screen issues.

#1 Post by Steffenator »

Ok, gang...

I used the old documentation (I'm sorry) to add a stats screen that appears when a button is clicked, nothing fancy, just like the documentation says here... https://www.renpy.org/wiki/renpy/doc/co ... ion_Screen

I tried it... didn't work. No button or texty thing of any kind appeared, BUT there were also no errors.
I tried it with a freshly created project... worked perfectly.

I wonder if I may have fracked something up in my screens.rpy file, because I'd been digging around in there, changing colors and whatnot, but I can't remember what part is related to text buttons and stuff.
Side note: My in-game menu buttons show up fine. Dunno if that's related to what I'm trying to do.
Another side note: I backed up my current screens.rpy, and moved a fresh one into my game directory, and I got a flood of errors. I think my current game directory might have been created with the previous version of RenPy. Would that cause this kind of trouble?

Here's the code I used... with only a few modifications from the original.

Code: Select all

#############################################
###    This is in my screens.rpy file
#############################################
screen button:
    vbox xalign 0.5 yalign 0.5:
        textbutton "Show Stats" action ui.callsinnewcontext("aff_screen_label")

screen aff_screen:
    frame:
        has vbox
        text "Gentleman: [Points_Gentle] points"
        text "Nice: [Points_Nice] points"
        text "Typical Guy: [Points_Tguy] points"
        text "Funny: [Points_Funny] points"
        text "Fun: [Points_Fun] points"
        text "Smart: [Points_Smart] points"
        text "Modesty: [Points_Modesty] points"

        textbutton "Return" action Return()
label aff_screen_label:
    call screen aff_screen
    return

############################################
###    Below this line is what is in my init section, and scripts.rpy file
############################################

init:
    $ Points_Nice = 0
    $ Points_Tguy = 0
    $ Points_Funny = 0
    $ Points_Fun = 0
    $ Points_Gentle = 0
    $ Points_Smart = 0
    $ Points_Modest = 0
    $ variable = True

label start:
    show screen button
Thanks!
There once was a language called Ren'Py
that made all the wannabes cry... with joy.
It gave them the power,
they spent every hour,
to finish a game, or die.


philat
Eileen-Class Veteran
Posts: 1900
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Stats screen issues.

#2 Post by philat »

Somebody seriously needs to sticky a post on these forums: 99.9% chance ui.callsinnewcontext is NOT WHAT YOU ARE LOOKING FOR.

It also sounds like you're trying to share screens.rpy between legacy and new gui templates. Won't work.

Use default for variables, not init.

Code: Select all

screen button:
    vbox xalign 0.5 yalign 0.5:
        textbutton "Show Stats" action Show("stats_screen")

screen stats_screen:
    # modal True # uncomment if you want to disable interaction with other screens while stats_screen is up.
    frame: # do you need this frame?
        has vbox
        text "Gentleman: [Points_Gentle] points"
        text "Nice: [Points_Nice] points"
        text "Typical Guy: [Points_Tguy] points"
        text "Funny: [Points_Funny] points"
        text "Fun: [Points_Fun] points"
        text "Smart: [Points_Smart] points"
        text "Modesty: [Points_Modesty] points"

        textbutton "Return" action Hide("stats_screen")
And then just show screen button.

User avatar
Steffenator
Regular
Posts: 53
Joined: Fri Feb 17, 2017 11:58 am
Contact:

Re: Stats screen issues.

#3 Post by Steffenator »

That did the trick.
Thanks!

I was being too specific when I searched for this in the documentation. I should have just read the Screen Language section. It's fairly plain there.
There once was a language called Ren'Py
that made all the wannabes cry... with joy.
It gave them the power,
they spent every hour,
to finish a game, or die.


Post Reply

Who is online

Users browsing this forum: No registered users