Save values (variables?)
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.
- Ayane_Ranma
- Newbie
- Posts: 5
- Joined: Mon Jan 04, 2016 9:49 am
- Contact:
Save values (variables?)
Hello
I am quite new here and have made my first experiences with Renpy.
I plan to make a dating game. So far I work with Artists and have written down a concept.
With Renpy I am able to create a simple visual novel thanks to the tutorial.
A whole game is a bit much yet though, so I search here for help.
My Questions:
1.
I need to be able to save values. (variables?)
In the game the player should be able to level up skills.
So the game should save the current skill levels.
2.
Also I need an interface, where the player can level up the skills.
How do I implement another interface?
3.
The game needs to use the saved skill values. (variables?)
Example: The player has a conversation with a character. The character asks the player a question.
Now the player gets answer option. A B and C.
But the game checks the current skill levels of the player and because the skill level is over 7 there will also appear an answer option D.
If the player had a skill level lower than 6, the answer option D should not appear.
This sounds like a simple if then else. But how do I implement this?
I have only very basic programming knowledge and am new to python.
Is there maybe a game out there that is simple and free to look into how its made?
Something like an example to use as model?
Thank you so far for this forum and the developers for Renpy!
Greetings
Ayane
I am quite new here and have made my first experiences with Renpy.
I plan to make a dating game. So far I work with Artists and have written down a concept.
With Renpy I am able to create a simple visual novel thanks to the tutorial.
A whole game is a bit much yet though, so I search here for help.
My Questions:
1.
I need to be able to save values. (variables?)
In the game the player should be able to level up skills.
So the game should save the current skill levels.
2.
Also I need an interface, where the player can level up the skills.
How do I implement another interface?
3.
The game needs to use the saved skill values. (variables?)
Example: The player has a conversation with a character. The character asks the player a question.
Now the player gets answer option. A B and C.
But the game checks the current skill levels of the player and because the skill level is over 7 there will also appear an answer option D.
If the player had a skill level lower than 6, the answer option D should not appear.
This sounds like a simple if then else. But how do I implement this?
I have only very basic programming knowledge and am new to python.
Is there maybe a game out there that is simple and free to look into how its made?
Something like an example to use as model?
Thank you so far for this forum and the developers for Renpy!
Greetings
Ayane
Re: Save values (variables?)
Greetings! You should try the tutorial game that ships with Ren'Py - it shows most of features (from basics to advanced stuff).
Also, oficial documentation will be your best friend (check the quickstart first) - http://www.renpy.org/doc/html/index.html
As for your 3rd question - see this page http://www.renpy.org/doc/html/menus.html
Also, oficial documentation will be your best friend (check the quickstart first) - http://www.renpy.org/doc/html/index.html
As for your 3rd question - see this page http://www.renpy.org/doc/html/menus.html
- Ayane_Ranma
- Newbie
- Posts: 5
- Joined: Mon Jan 04, 2016 9:49 am
- Contact:
Re: Save values (variables?)
The ingame menu is also explained well in the tutorial
But what can I do if i want my own designed interface instead of a simple menu?
The Renpy tutorial also tells that there is enhanced decision making possible.(see picture)
Where can I find more Information to that?
Maybe like they did in Long live the Queen. (see picture)
I went trough the Renpy tutorial, but still got these 3 questions, either because I did not find the answer or I did not understand the topic when it mentioned a solution :/
I am really not a programmer.
The tutorial once mentions also persistant data, wich sounds exactly like what I need, but I cant find an explanation :/
But what can I do if i want my own designed interface instead of a simple menu?
The Renpy tutorial also tells that there is enhanced decision making possible.(see picture)
Where can I find more Information to that?
Maybe like they did in Long live the Queen. (see picture)
I went trough the Renpy tutorial, but still got these 3 questions, either because I did not find the answer or I did not understand the topic when it mentioned a solution :/
I am really not a programmer.
The tutorial once mentions also persistant data, wich sounds exactly like what I need, but I cant find an explanation :/
Re: Save values (variables?)
1. The ability to save the game state is the default feature of Ren'Py.
2. You can use screens to create interface you need - http://www.renpy.org/doc/html/screens.html
3. Conditional choice is described at the end of an article - http://www.renpy.org/doc/html/menus.html
The interface you've showed looks like an imagemap - http://www.renpy.org/doc/html/screens.h ... statements (it also described in tutorial)
Also, see - http://lemmasoft.renai.us/forums/viewto ... 90#p181690
2. You can use screens to create interface you need - http://www.renpy.org/doc/html/screens.html
3. Conditional choice is described at the end of an article - http://www.renpy.org/doc/html/menus.html
The interface you've showed looks like an imagemap - http://www.renpy.org/doc/html/screens.h ... statements (it also described in tutorial)
Also, see - http://lemmasoft.renai.us/forums/viewto ... 90#p181690
- Ayane_Ranma
- Newbie
- Posts: 5
- Joined: Mon Jan 04, 2016 9:49 am
- Contact:
Re: Save values (variables?)
Thank you very much
The shown section are not easy to understand, but I can work with it.
I also managed to find an easy to understand explanation of things I was confused about:
http://renpy.org/wiki/renpy/doc/tutoria ... er_Choices
The shown section are not easy to understand, but I can work with it.
I also managed to find an easy to understand explanation of things I was confused about:
http://renpy.org/wiki/renpy/doc/tutoria ... er_Choices
Re: Save values (variables?)
Ok, I'm not sure how advanced you are with these things, so I'll try to explain them in the most basic way I know of.
To start writing your renpy code you first open the script.rpy file and find "label start:", this is where renpy will start reading through your code, if you put code past "label start:" that will be the first code read once your game starts
Renpy code is very similar to python code, with the exception that when you define a variable or change its value you put a $ before that line of code. This rule doesn't include things like if statements, you don't need to put a $ before if statements in renpy code, you only put it before code when you declare a variable or change it's value. You can define a variable anywhere in the code, but if you try to read the variable before it was defined you will get an error.
renpy code:
python code:
Renpy code also lacks the "for" loop statement, but it does include the "while" loop statement.
Renpy reads a text loosely placed into two quote marks as a function which renders the text in the dialogue box
You can, but don't have to, define a specific "character" which gives the text some defined stylization and attributes, if you do that you can then place it before the text to render the text with the defined characteristics like this
You can also use the complete normal python syntax/code in "python blocks", to make a block like that, you write something like
because renpy and python are both sensitive to tabulation, tabulation is important, for example you can write something like this
or you could write something similar with only renpy code and the while statement
If you want to make a more complex game than a simple visual novel, I highly recommend checking out a basic python tutorial first. It'll only take you a couple of hours and will likely become very helpful later on.
Personally, I enjoyed this one https://www.codecademy.com/learn/python
For something simpler and more renpy centered, youtube always has some tutorials for everything
like here
https://www.youtube.com/watch?v=h58CKf57YDk
https://www.youtube.com/watch?v=3K3UA6U4PGI
Maybe not the best, but it should give you some idea.
For all purpose renpy labels act in ways similar to python functions. Normally renpy reads them one after another, but they can also be called like python functions.
I think I would have understood renpy syntax much better if I originally had some python knowledge before I started playing with it.
To construct new menu screens you want to use the renpy screen syntax/language which alex already linked you to
To declare a new screen you want to go to the screens.rpy file and write something like
because this code structure is based on tabulation, this is a complete block of code
Once you define your screen, the simplest way to open and hide your screen inside the game, you find a place in your game script when you want the screen to open and write something like
I hope that will be helpful to you!
To start writing your renpy code you first open the script.rpy file and find "label start:", this is where renpy will start reading through your code, if you put code past "label start:" that will be the first code read once your game starts
Renpy code is very similar to python code, with the exception that when you define a variable or change its value you put a $ before that line of code. This rule doesn't include things like if statements, you don't need to put a $ before if statements in renpy code, you only put it before code when you declare a variable or change it's value. You can define a variable anywhere in the code, but if you try to read the variable before it was defined you will get an error.
renpy code:
Code: Select all
$ x = 5
Code: Select all
x = 5
Renpy reads a text loosely placed into two quote marks as a function which renders the text in the dialogue box
Code: Select all
"Show this text"
Code: Select all
john "Show this text"
Code: Select all
python:
if a == 5:
b = 4
Code: Select all
label example:
"Hello"
python:
for a in range(0,5):
a+=1
"[a]"
Code: Select all
label example:
"Hello"
$ a = 0
while a < 5:
$ a+=1
"[a]"
if a == 4:
"You won"
else:
"You lost"
Personally, I enjoyed this one https://www.codecademy.com/learn/python
For something simpler and more renpy centered, youtube always has some tutorials for everything
like here
https://www.youtube.com/watch?v=h58CKf57YDk
https://www.youtube.com/watch?v=3K3UA6U4PGI
Maybe not the best, but it should give you some idea.
For all purpose renpy labels act in ways similar to python functions. Normally renpy reads them one after another, but they can also be called like python functions.
I think I would have understood renpy syntax much better if I originally had some python knowledge before I started playing with it.
To construct new menu screens you want to use the renpy screen syntax/language which alex already linked you to
To declare a new screen you want to go to the screens.rpy file and write something like
Code: Select all
screen myScreen:
frame xpos 0.5 ypos 0.5:
has vbox
text "hello"
Once you define your screen, the simplest way to open and hide your screen inside the game, you find a place in your game script when you want the screen to open and write something like
Code: Select all
"Hello my friend"
show screen myScreen
"Good day"
hide screen myScreen
- Taleweaver
- Writing Maniac
- Posts: 3428
- Joined: Tue Nov 11, 2003 8:51 am
- Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
- Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
- Organization: Tall Tales Productions
- Location: Germany
- Contact:
Re: Save values (variables?)
Moved to Ren'Py Questions.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of DaemonophiliaScriptwriter and director of The Dreaming
Scriptwriter of Zenith ChroniclesScriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is DeadScriptwriter and producer of Adrift
More about me in my blog"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira
- Ayane_Ranma
- Newbie
- Posts: 5
- Joined: Mon Jan 04, 2016 9:49 am
- Contact:
Re: Save values (variables?)
Thank you neowired
Your explanation is easier to understand.
I think I can work with this or at least give it a try.
Your explanation is easier to understand.
I think I can work with this or at least give it a try.
Who is online
Users browsing this forum: No registered users