Show number of unique endings achieved in main menu [Solved]
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.
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.
Show number of unique endings achieved in main menu [Solved]
Hi >< Sorry this is probably a really stupid question. I'm trying to display how many endings finished in the main menu, and I followed this post: http://lemmasoft.renai.us/forums/viewto ... 29#p134417
It worked perfectly, up until I actually tried it. I probably messed up on the increasing persistent endings variable part (I basically just put $ persistent.endings_seen +=1 at the end of every ending), but I'm trying to get the number to only increase when I get a new different ending. Instead, even if I get the same ending over and over again, the number keeps on increasing >< I'm not sure how to fix that.
If anyone could help that'd be amazing. Thank you!
It worked perfectly, up until I actually tried it. I probably messed up on the increasing persistent endings variable part (I basically just put $ persistent.endings_seen +=1 at the end of every ending), but I'm trying to get the number to only increase when I get a new different ending. Instead, even if I get the same ending over and over again, the number keeps on increasing >< I'm not sure how to fix that.
If anyone could help that'd be amazing. Thank you!
Last edited by Iwako on Fri Dec 13, 2013 8:16 am, edited 1 time in total.
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Show number of unique endings achieved in main menu?
I am on my iPad so I can't be totally specific, nor can I check the code in my own game, so I can't give you that info...but off the top of head, I can think of a couple different ways of doing it. In my game I wanted to keep track of easy specific ending achieved, but it looks like you just need the total number of endings achieved. So...
The first thing I can think of is that each ending has its own true/false variable which starts off as false.
For example: $ persistent.end1 = False
Then at the end of each of your individual ending blocks do an if statement like this:
Again, you'll have to check to make sure that is spelled right, but this idea checks to see if you've done the ending already. If yes, nothing happens. If no, it flags the ending complete and increases your ending seen variable.
The first thing I can think of is that each ending has its own true/false variable which starts off as false.
For example: $ persistent.end1 = False
Then at the end of each of your individual ending blocks do an if statement like this:
Code: Select all
if persistent.end1 = false:
$ persistent.end1 == true
$ persistent.endings_seen += 1A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Show number of unique endings achieved in main menu?
trooper6's idea seems fine, but the code seems not right:
All the persistent.WHATEVER variables return None if they are not set, so, I think you need to set the 'persistent.endings_seen' variable to 0 before using it.
EDIT: corrected an error in python block
Code: Select all
#Somewhere, in a .rpy file (outside a label):
init python:
if persistent.endings_seen is None:
persistent.endings_seen = 0
# At the end of every path:
if persistent.end1 is None:
$ persistent.end1 = True
$ persistent.endings_seen += 1EDIT: corrected an error in python block
Last edited by xavimat on Fri Dec 13, 2013 4:26 pm, edited 1 time in total.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Show number of unique endings achieved in main menu?
Good info xavimat! I had just imagined initializing all the persistent variables at the start block...I tend to do that by habit, but didn't explicitly say so.xavimat wrote:trooper6's idea seems fine, but the code seems not right:All the persistent.WHATEVER variables return None if they are not set, so, I think you need to set the 'persistent.endings_seen' variable to 0 before using it.Code: Select all
#Somewhere, in a .rpy file (outside a label): init python: if persistent.endings_seen is None: $ persistent.endings_seen = 0 # At the end of every path: if persistent.end1 is None: $ persistent.end1 = True $ persistent.endings_seen += 1
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Show number of unique endings achieved in main menu?
Oh thank you so much! It makes a lot of sense.
However, I'm having a slight problem with the init code. I'm supposed to put
in a .rpy file outside of labels right? >< But I keep getting some syntax error whenever I get to that bit. Did I mess up anywhere?
Thank you again!
However, I'm having a slight problem with the init code. I'm supposed to put
Code: Select all
init python:
if persistent.endings_seen is None:
$ persistent.endings_seen = 0Thank you again!
- xavimat
- Eileen-Class Veteran
- Posts: 1458
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love, unknown
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Contact:
Re: Show number of unique endings achieved in main menu?
Yes, my fault: the symbol $ is not needed inside a python block. Simply delete it.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Re: Show number of unique endings achieved in main menu?
Oh! Works perfectly now. Thank you very much! 
Who is online
Users browsing this forum: No registered users
