Ren'Py Does "return" resets conditionals?

AmazonessKing

Amazoness Entrepreneur
Aug 13, 2019
1,898
2,917
Hi mates, a question. Does the ren'py return command resets conditionals? Because I was planning on using return at the end of each of my girl's routes, and it's fine that SOME conditionals return so I could get rid of some redundant code then.

The problem is that there are a couple of specific conditionals that I need to be kept in the game to unlock secret routes when you finish the main routes. The hidden routes are hidden with a conditional that becomes True when you reach the end of a route, but it's followed with return, and I tried to trigger this hidden menu by triggering the other flags, 3 in total, but the menu doesn't seem to appear.

If so, should I end the routes with a different command other than return? Like jumping to a different label?
You don't have permission to view the spoiler content. Log in or register now.
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,486
7,006
Not sure what you mean by "does return command reset conditionals." "return" is used to go back to the instruction right after a "call." If you execute "return" without having had a "call" before that, you essentially end the current game and go back to the main menu. (Which _would_ lose all your game-specific settings.)
 

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,655
23,746
Hi mates, a question. Does the ren'py return command resets conditionals? Because I was planning on using return at the end of each of my girl's routes, and it's fine that SOME conditionals return so I could get rid of some redundant code then.

The problem is that there are a couple of specific conditionals that I need to be kept in the game to unlock secret routes when you finish the main routes. The hidden routes are hidden with a conditional that becomes True when you reach the end of a route, but it's followed with return, and I tried to trigger this hidden menu by triggering the other flags, 3 in total, but the menu doesn't seem to appear.

If so, should I end the routes with a different command other than return? Like jumping to a different label?
You don't have permission to view the spoiler content. Log in or register now.
you might want to check out the doc entry about if some values should persist after your game ends.
 
  • Like
Reactions: AmazonessKing

AmazonessKing

Amazoness Entrepreneur
Aug 13, 2019
1,898
2,917
you might want to check out the doc entry about if some values should persist after your game ends.
This did it. As additional information, return does reset all your conditionals.
Code:
default points = 0

label start
    $ points += 1
    
return
That would reset your point to zero if you start a new game from the main menu. Also, you don't need to define persistent data as you may define any other variant in the game.

ALSO!
What's the difference between default and define?
 

the66

beware, the germans are cumming
Modder
Donor
Respected User
Jan 27, 2017
7,655
23,746
simplified rule of thumb:
you use define to declare constants that won't get changed later and also won't get saved.​
you use default for variables that also gets saved.​
more in-depth: