Hi! I'm relatively new to ren.py and I'm trying to do something with persistent data but I don't know how. What I'n trying to do is add a pop up text box (like an xbox or steam achievement) after a player has played through a second time. What I'm having trouble with is the indentations---and just about everything else. Can anyone help me out?
It's a mess.
Sort of like:
python:
if persistent.plays is None:
persistent.plays = 1
else:
persistent.plays += 1
frame:
xpos 20
ypos 550
has vbox
text "{b}{color=#000033}Welcome Back!{/b}{/color}"
Persistent Data Pop Up Issue
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.
-
- Newbie
- Posts: 24
- Joined: Sun Apr 26, 2015 9:29 pm
- Contact:
- SinnyROM
- Regular
- Posts: 166
- Joined: Mon Jul 08, 2013 12:25 am
- Projects: Blue Birth
- Organization: Cosmic Static Games
- Contact:
Re: Persistent Data Pop Up Issue
There's a brief explanation in the documentation, which can explain it better than I can! I've added some indents and notes on different language types in your example, but remember next time to use the tags so the indents are preserved. The more you work with Renpy the easier it is to get the hang of it.
I also made some modifications in case you want to define a new playthrough as starting from the main menu rather than opening a completely new window.
Code: Select all
I also made some modifications in case you want to define a new playthrough as starting from the main menu rather than opening a completely new window.
Code: Select all
### Python code block
init python:
# If block
if persistent.plays is None:
persistent.plays = 1
else:
persistent.plays += 1 # a play means closing the game completely then opening it again
### Renpy code block (this particular one is a label)
label start:
# Show the screen we created called persistent_plays_screen when this condition is fulfilled
if persistent.plays > 1:
show screen persistent_plays_screen
# Python code below, prefixed by $ so it can be used in a Renpy block
# $ persistent.plays += 1 # a play means starting a new game from the main menu
"Persistent.plays = [persistent.plays]"
return
### Screen language (found in screens.rpy)
screen persistent_plays_screen:
# Screen language block
frame:
xpos 20
ypos 550
has vbox
text "{b}{color=#000033}Welcome Back!{/b}{/color}"
# converting the above text tags to screen language
text "Welcome Back!" bold True color "#000033"
Who is online
Users browsing this forum: Ocelot