Page 1 of 1

Beginner questions

Posted: Tue Mar 05, 2019 6:01 pm
by LittlJack
Hello there

Since I am a softwaredeveloper I want to get quick into the RenPy script language.
I took a quick look at the docu and saw that it is a beginner documentation so maybe I can get into it quicker with some advanced questions the I could not answer myself.

1. Is it possible to create a OOP structure?
2. Is it possible to split code into multiple files?
3. How do I call functions with parameters, for example this crashes the game:

Code: Select all

... in screens.py
screen main_character_stats(money):
    frame:
        xalign 0.01 ypos 40
        text _("Money : XXX")
        
        
        ... in script.py
        $ money = 200
        show screen main_character_stats(money)
4. Is it possible to have multiple characters on the screen?
5. How can I make a status lable like the money lable or similiar visible persistent?
6. Is there a way to store a game state with variable data like money in a simple way or do I have to write an own serializer and store it to a json or similiar?

I guess that is the most important for beginning.
Thanks for your help.

Re: Beginner questions

Posted: Wed Mar 06, 2019 11:38 am
by xavimat
1. you can include python code inside renpy. To define classes you can use an "init python" block. https://renpy.org/doc/html/python.html# ... -statement

2. Yes. viewtopic.php?f=4&t=53442&p=503389&hili ... es#p503306

3. It seems that code should work, if it crashes, the error must be elsewhere. I guess you are mixing label-code and screen-code. (Better if you define the money variable first with "default". https://renpy.org/doc/html/python.html# ... -statement )

4. You don't have "characters" on screen but displayables. You can use "show" to show different pictures. Renpy does not know if the picture itself represents a character or an avocado. You can use "scene" to clear the screen of images "showed" and present a new one. That's the reason "scene" is used mostly to show backgrounds (like a change of scene in a film).

5. There are two languages inside renpy (well, more than two), label language is different from screen language. There is not a "status label", but you can show a screen with that information.

6. I'm not sure if you are talking about the save/load system that renpy has out of the box. https://renpy.org/doc/html/save_load_rollback.html