passwords
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
passwords
Sorry for all the noobie questions. Here is one more.
Assuming the multi-game persistent data thing might be too complex to pull off (I have another post on that), is there a way to prompt users for passwords in Renpy? I've seen posts about this but I'm not sure if they referred to IF in general. I'm interested in making different passwords lead to different conditions.
If there is some way to save data from one game and load that save file to another game, that would still be the preferred solution, but I'm not expecting to be able to do that. Or can I?
That's all from me, thanks for your help.
BOZANCE
Assuming the multi-game persistent data thing might be too complex to pull off (I have another post on that), is there a way to prompt users for passwords in Renpy? I've seen posts about this but I'm not sure if they referred to IF in general. I'm interested in making different passwords lead to different conditions.
If there is some way to save data from one game and load that save file to another game, that would still be the preferred solution, but I'm not expecting to be able to do that. Or can I?
That's all from me, thanks for your help.
BOZANCE
-
- King of Lolies
- Posts: 4538
- Joined: Mon Nov 26, 2007 9:57 pm
- Completed: R.S.P
- Location: Bandung, West Java, Indonesia
- Contact:
Re: passwords
You coul use multipersistent data/variables to achieve similar result.
"Double the princesses, quadruple the fun!" - Haken Browning (SRW-OG Endless Frontier)
DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW
DeviantArt Account
MoeToMecha Blog (under construction)
Lolicondria Blog (under construction) <- NSFW
-
- Miko-Class Veteran
- Posts: 636
- Joined: Thu May 14, 2009 8:15 pm
- Projects: Castle of Arhannia
- Contact:
Re: passwords
well, I'm not sure how you would generate the passwords, but to prompt for them you would just use renpy.input()
somehow though, it does seem like multipersistent data would be easier.
somehow though, it does seem like multipersistent data would be easier.
Re: passwords
I would prefer to use multipersistent, though I'm having trouble making it work.
Are multipersistent variables not used like regular variables? In the example below, Game 2 always starts the same way regardless of whether I turned the lights on or off in Game 1. These are literally the full texts of my test games so any input would be welcome.
GAME 1
init:
$ mp = MultiPersistent("bozance")
$ mp.lights = False
label start:
"Turn on lights?"
menu:
"No.":
jump off
"Yes.":
jump on
label off:
"Lights are still off."
label on:
$ mp.lights = True
$ mp.save()
"You turn on the lights."
GAME 2
init:
$ mp = MultiPersistent("bozance")
label start:
if mp.lights = True:
"The lights are on."
else:
"The lights are off."
Are multipersistent variables not used like regular variables? In the example below, Game 2 always starts the same way regardless of whether I turned the lights on or off in Game 1. These are literally the full texts of my test games so any input would be welcome.
GAME 1
init:
$ mp = MultiPersistent("bozance")
$ mp.lights = False
label start:
"Turn on lights?"
menu:
"No.":
jump off
"Yes.":
jump on
label off:
"Lights are still off."
label on:
$ mp.lights = True
$ mp.save()
"You turn on the lights."
GAME 2
init:
$ mp = MultiPersistent("bozance")
label start:
if mp.lights = True:
"The lights are on."
else:
"The lights are off."
Re: passwords
You've got the right idea about MultiPersistent, but try "==" instead of "=" when you're checking a value. "==" is the comparison operator, while "=" only ever assigns the value on the right to the value on the left.bozance wrote:Code: Select all
if mp.lights = True:
Server error: user 'Jake' not found
Re: passwords
Even with that typo corrected the data doesn't seem to persist. Is there something basic I'm not doing? I only see one page on this in the tutorials and it seems straightforward enough, but I'm obviously missing something. Do I have to call out the multipersistent variables in the Game 2 initblock?
- PyTom
- Ren'Py Creator
- Posts: 16096
- Joined: Mon Feb 02, 2004 10:58 am
- Completed: Moonlight Walks
- Projects: Ren'Py
- IRC Nick: renpytom
- Github: renpytom
- itch: renpytom
- Location: Kings Park, NY
- Contact:
Re: passwords
Are you calling mp.save()?
Really, is this data that should be persisting between multiple games? Or is this just normal persistent data, that is shared between multiple plays of a a single game?
Really, is this data that should be persisting between multiple games? Or is this just normal persistent data, that is shared between multiple plays of a a single game?
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom(When was the last time you backed up your game?)
Software > Drama • https://www.patreon.com/renpytom
Re: passwords
Not even sure what "calling" save means. Apologies if I should know better.
I'm interested in preserving a state from one game to another totally different game. So if lights are on when you complete game 1, they're on at start of game 2. I haven't left anything out in my example... what you see is literally what I've got for this test.
I'm interested in preserving a state from one game to another totally different game. So if lights are on when you complete game 1, they're on at start of game 2. I haven't left anything out in my example... what you see is literally what I've got for this test.
Re: passwords
The reason that you're only ever getting "The lights are on" in the second game is that you've only actually saved the multi-persistent data in the branch where the player turns the lights on. So they might start off by default, but that never gets saved - only if the player turns the lights on does the var get saved so that it shows up in the other game. You need to save whenever you make a change to a multi-persistent variable.
So I guess you must have selected 'on' the first time, and it's saved that, and since then it's been reporting as 'on' every time because it never gets overwritten by anything else... otherwise you'd have got an error telling you that 'mp.lights' doesn't exist, if you'd run the second game before ever turning the lights on in the first one.
("Calling" is how we refer to the act of invoking a method - giving the computer the instruction to perform a particular function. So when you type:
you're 'calling' the save method.)
So I guess you must have selected 'on' the first time, and it's saved that, and since then it's been reporting as 'on' every time because it never gets overwritten by anything else... otherwise you'd have got an error telling you that 'mp.lights' doesn't exist, if you'd run the second game before ever turning the lights on in the first one.
("Calling" is how we refer to the act of invoking a method - giving the computer the instruction to perform a particular function. So when you type:
Code: Select all
$ mp.save()
Server error: user 'Jake' not found
Re: passwords
Still no luck when I add the $mp.save() to both conditions. Lights are always off in the second game. I must be missing something really simple. This is what I have (see below); if anyone can solve this, I will reward them handsomely with positive vibes and well wishes (I'm a little short on money these days unfortunately).
Do I need to save Game 1 as I'm playing it? I don't really see how that would work as I can't load anything for Game 2.
GAME 1
init:
$ mp = MultiPersistent("bozance")
$ mp.lights=False
label start:
"Turn on lights?"
menu:
"No.":
jump off
"Yes.":
jump on
label off:
$mp.save()
"Lights are still off."
label on:
$mp.save()
$mp.lights==True
"You turn on the lights."
GAME 2
init:
$ mp = MultiPersistent("bozance")
label start:
if mp.lights==True:
"The lights are on."
else:
"The lights are off."
Do I need to save Game 1 as I'm playing it? I don't really see how that would work as I can't load anything for Game 2.
GAME 1
init:
$ mp = MultiPersistent("bozance")
$ mp.lights=False
label start:
"Turn on lights?"
menu:
"No.":
jump off
"Yes.":
jump on
label off:
$mp.save()
"Lights are still off."
label on:
$mp.save()
$mp.lights==True
"You turn on the lights."
GAME 2
init:
$ mp = MultiPersistent("bozance")
label start:
if mp.lights==True:
"The lights are on."
else:
"The lights are off."
Re: passwords
Now you've moved the:bozance wrote:Code: Select all
label on: $mp.save() $mp.lights==True
Code: Select all
$mp.save()
On a related note: it's a good idea, when you're posting blocks of code, to enclose them in 'code' tags; there's a button in the editor between 'Quote' and 'List' for it. Like that the spacing and indentation is preserved, which is relevant for Ren'Py/Python code.
Server error: user 'Jake' not found
-
- Miko-Class Veteran
- Posts: 701
- Joined: Sat May 26, 2007 3:41 pm
- Contact:
Re: passwords
This doesn't set a variable. It checks if the variable has been set, and discards the result. Use this instead:bozance wrote: $mp.lights==True
Code: Select all
$mp.lights=True
Re: passwords
Yes yes YES!!!!!
HAAAA!!!
Thank you for your insights. I wasn't confident in proceeding with what I'm doing without figuring this out. You can tell I'm a newbie. Thank you VERY VERY MUCH!!!
HAAAA!!!
Thank you for your insights. I wasn't confident in proceeding with what I'm doing without figuring this out. You can tell I'm a newbie. Thank you VERY VERY MUCH!!!
Re: passwords
Wow, I just read my response (see above) and I think I come across as a bit nuts. But I really am excited... I've been trying to get a conditional novel going for years and finally settled upon Renpy to do so, and believe it or not this issue was at the heart of whether I could do what I really want to do.
Thanks again to all who posted to this thread. My exuberance is indeed real, if a bit nutty.
Thanks again to all who posted to this thread. My exuberance is indeed real, if a bit nutty.
Who is online
Users browsing this forum: No registered users