Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Sat May 18, 2013 7:59 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Wed May 11, 2011 5:15 pm 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
Oh boy...XD ah, time for me to show my code inept side again.

Basically, I'm planning to use a counter to keep track of how many endings/scenes (I'm still debating which, but this can be easily changed as I go.) have been seen, in oder to tell how much of the game has been beaten.

That much I've got figured out. However, I'd like to be able to display it somewhere, preferably the main menu, so the player can gauge their progress. I'm just not sure how to do this.

Bearing in mind too that..I haven't made a game in a while, and some of the changes made to Renpy are throwing me for a loop right now. xD;

This isn't totally essential, so I won't be too hurt if it doesn't work out, but it'd be a very appreciated feature. c:

Thanks~


Last edited by Mole-chan on Fri May 13, 2011 7:20 pm, edited 3 times in total.

Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 12:07 am 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10770
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
Are you using screens for the main menu? If so, it's pretty easy to add - you can use a bar or a text for this, which would you prefer?

_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt


Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 12:18 am 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
Yes, I am using screens, since I'm basically just using a test project to get this figured out for the real thing. Though I haven't done a renpy project since 6.10, so I am still getting used to it. XD

As for bar or text, I have no preference. c: I guess a bar would look more appealing.


Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 2:24 pm 
Regular
User avatar

Joined: Fri Jun 11, 2010 4:01 am
Posts: 94
Projects: RHS
Sorry to intrude, but how about a bar with text? How would that be done?

_________________
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/


Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 2:51 pm 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
roankun wrote:
Sorry to intrude, but how about a bar with text? How would that be done?


Couldn't you just wait until someone answered my question? ._.; This is basically the same thing I asked.


Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 11:29 pm 
Regular
User avatar

Joined: Fri Jun 11, 2010 4:01 am
Posts: 94
Projects: RHS
Erm, I'm sorry. :( I guess I was hoping that someone would answer it at the same time, since most threads tend to be forgotten once somebody answers one question.

_________________
I don't have any kind words to spare to someone who already has all the reason in the world to feel good about himself.
http://roankun.wordpress.com/


Top
 Profile Send private message  
 
PostPosted: Thu May 12, 2011 11:49 pm 
Lemma-Class Veteran
User avatar

Joined: Fri May 23, 2008 2:11 pm
Posts: 2545
Location: USA
Projects: RockRobin
All right, don't anybody get moody. Here's how you display text and bars in SL ...

Let's show text+bar on the main menu. Find "screen main_menu" in screens.rpy (newer Ren'Py games only). We're going to add the text widget and the bar widget at the bottom left corner.

First, I make a vbox, so that I can show the Text on top of the Bar (or visa versa). I make sure to add the positional properties under the vbox to place these widgets where I want them on the main menu. I make sure that the vbox is aligned so that it is not inside of any other widget (like the navigation's frame).

Under that, I add my Text and Bar widgets in their simplest forms. I'm assuming that you are keeping count of the number of endings in a variable that is a number. In this example, it is called endings_seen, and I put a fake maximum of 5 total. The default would be 0, and you would count up for each ending seen, optimally. If you're doing this another way, tell me.

Anyway, here's my finished example (new stuff is in the bottom vbox):
Code:
screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Start Game") action Start()
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit(confirm=False)
       
    vbox:
        xpos 0.02 ypos 0.98
        xanchor 0.0 yanchor 1.0
       
        $ howmanyend = "Endings Seen: %d / 5" % endings_seen
        text howmanyend xalign 0.5
        bar value endings_seen range 5 xmaximum 250 xalign 0.5

_________________
I apologize in advance for being extremely opinionated.
[Tutorial] How to Customize the Textbox
[Tutorial] How to Customize Game Menus
Icon art by Mocha07734


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 5:36 pm 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
Aleema wrote:
All right, don't anybody get moody. Here's how you display text and bars in SL ...

Let's show text+bar on the main menu. Find "screen main_menu" in screens.rpy (newer Ren'Py games only). We're going to add the text widget and the bar widget at the bottom left corner.

First, I make a vbox, so that I can show the Text on top of the Bar (or visa versa). I make sure to add the positional properties under the vbox to place these widgets where I want them on the main menu. I make sure that the vbox is aligned so that it is not inside of any other widget (like the navigation's frame).

Under that, I add my Text and Bar widgets in their simplest forms. I'm assuming that you are keeping count of the number of endings in a variable that is a number. In this example, it is called endings_seen, and I put a fake maximum of 5 total. The default would be 0, and you would count up for each ending seen, optimally. If you're doing this another way, tell me.

Anyway, here's my finished example (new stuff is in the bottom vbox):
Code:
screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Start Game") action Start()
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit(confirm=False)
       
    vbox:
        xpos 0.02 ypos 0.98
        xanchor 0.0 yanchor 1.0
       
        $ howmanyend = "Endings Seen: %d / 5" % endings_seen
        text howmanyend xalign 0.5
        bar value endings_seen range 5 xmaximum 250 xalign 0.5


That looks perfect, thanks! and yes, that's actually exactly what I'm doing. The number variable is initially stored as 0, and counted up at the end of each route, after checking to see if that route hasn't already been cleared.


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 5:50 pm 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
ah, and problem. .v.;;; I'm testing the actual "having the ending count go up in the script and updating the display" portion. and it seems if it's defined in the script, it won't be in the main menu, and vice versa. It seems like it should be able to look in the script, am I missing something here?

ORZ I'm sorry. I'm kind of dumb at this I guess.


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 6:16 pm 
Lemma-Class Veteran
User avatar

Joined: Fri May 23, 2008 2:11 pm
Posts: 2545
Location: USA
Projects: RockRobin
Sorry, make endings_seen a persistent variable, not a regular variable. It should be:
Code:
vbox:
        xpos 0.02 ypos 0.98
        xanchor 0.0 yanchor 1.0
       
        $ howmanyend = "Endings Seen: %d / 5" % persistent.endings_seen
        text howmanyend xalign 0.5
        bar value persistent.endings_seen range 5 xmaximum 250 xalign 0.5

And you initialize the variable in an init block somewhere:
Code:
if persistent.endings_seen is None:
        $ persistent.endings_seen = 0

_________________
I apologize in advance for being extremely opinionated.
[Tutorial] How to Customize the Textbox
[Tutorial] How to Customize Game Menus
Icon art by Mocha07734


Top
 Profile Send private message  
 
PostPosted: Fri May 13, 2011 6:52 pm 
Regular
User avatar

Joined: Thu Aug 27, 2009 12:46 am
Posts: 133
Projects: Spell'mon (fantasy manga), <3, DUAEL (current project)
Aleema wrote:
Sorry, make endings_seen a persistent variable, not a regular variable. It should be:
Code:
vbox:
        xpos 0.02 ypos 0.98
        xanchor 0.0 yanchor 1.0
       
        $ howmanyend = "Endings Seen: %d / 5" % persistent.endings_seen
        text howmanyend xalign 0.5
        bar value persistent.endings_seen range 5 xmaximum 250 xalign 0.5

And you initialize the variable in an init block somewhere:
Code:
if persistent.endings_seen is None:
        $ persistent.endings_seen = 0

derp. In hindsight that makes a lot of sense. xDD Thank you.

edit: Made the necessary changes and it works like a charm!! c: Thank you very much!


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group