Beginner questions

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
LittlJack
Newbie
Posts: 1
Joined: Tue Mar 05, 2019 5:52 pm
Contact:

Beginner questions

#1 Post by LittlJack » Tue Mar 05, 2019 6:01 pm

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.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1433
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: xavimat
Location: Italy
Contact:

Re: Beginner questions

#2 Post by xavimat » Wed Mar 06, 2019 11:38 am

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
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Cops&Robbers A two-player experiment
Fear&Love Why can’t we simply express our feelings? Why am I afraid to say ‘I love you’?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Andredron